Imported Upstream version 6.0.0 upstream upstream/6.0.0
authorChanho Park <chanho61.park@samsung.com>
Thu, 11 Sep 2014 08:41:21 +0000 (17:41 +0900)
committerChanho Park <chanho61.park@samsung.com>
Thu, 11 Sep 2014 08:41:21 +0000 (17:41 +0900)
1950 files changed:
.gdbinit
AUTHORS
COPYING.LESSERv3 [new file with mode: 0644]
COPYING.LIB [deleted file]
COPYINGv2 [new file with mode: 0644]
COPYINGv3 [new file with mode: 0644]
ChangeLog
INSTALL
INSTALL.autoconf
Makefile.am
Makefile.in
NEWS
README
acinclude.m4
assert.c
bootstrap.c
compat.c
config.guess
config.in
config.sub
configfsf.guess
configfsf.sub [changed mode: 0755->0644]
configure
configure.ac
cxx/Makefile.am
cxx/Makefile.in
cxx/dummy.cc
cxx/isfuns.cc
cxx/ismpf.cc
cxx/ismpq.cc
cxx/ismpz.cc
cxx/ismpznw.cc
cxx/limits.cc
cxx/osdoprnti.cc
cxx/osfuns.cc
cxx/osmpf.cc
cxx/osmpq.cc
cxx/osmpz.cc
demos/Makefile.am
demos/Makefile.in
demos/calc/Makefile.am
demos/calc/Makefile.in
demos/calc/README
demos/calc/calc-common.h
demos/calc/calc-config-h.in
demos/calc/calc.c
demos/calc/calc.y
demos/calc/calclex.c
demos/calc/calclex.l
demos/calc/calcread.c
demos/expr/Makefile.am
demos/expr/Makefile.in
demos/expr/README
demos/expr/expr-impl.h
demos/expr/expr.c
demos/expr/expr.h
demos/expr/exprf.c
demos/expr/exprfa.c
demos/expr/exprq.c
demos/expr/exprqa.c
demos/expr/exprv.c
demos/expr/exprz.c
demos/expr/exprza.c
demos/expr/run-expr.c
demos/expr/t-expr.c
demos/factorize.c
demos/isprime.c
demos/perl/GMP.pm
demos/perl/GMP.xs
demos/perl/GMP/Mpf.pm
demos/perl/GMP/Mpq.pm
demos/perl/GMP/Mpz.pm
demos/perl/GMP/Rand.pm
demos/perl/INSTALL
demos/perl/Makefile.PL
demos/perl/sample.pl
demos/perl/test.pl
demos/perl/test2.pl
demos/perl/typemap
demos/pexpr-config-h.in
demos/pexpr.c
demos/primes.c
demos/qcn.c
doc/Makefile.am
doc/Makefile.in
doc/configuration
doc/fdl-1.3.texi
doc/gmp.info
doc/gmp.info-1
doc/gmp.info-2
doc/gmp.texi
doc/isa_abi_headache
doc/mdate-sh
doc/projects.html
doc/stamp-vti
doc/tasks.html
doc/texinfo.tex
doc/version.texi
errno.c
extract-dbl.c
gen-bases.c
gen-fac.c
gen-fib.c
gen-jacobitab.c
gen-psqr.c
gen-trialdivtab.c
gmp-h.in
gmp-impl.h
gmpxx.h
install-sh
invalid.c
longlong.h
memory.c
mini-gmp/README
mini-gmp/mini-gmp.c
mini-gmp/mini-gmp.h
mini-gmp/tests/Makefile
mini-gmp/tests/hex-random.c
mini-gmp/tests/hex-random.h
mini-gmp/tests/mini-random.c
mini-gmp/tests/mini-random.h
mini-gmp/tests/run-tests
mini-gmp/tests/t-add.c
mini-gmp/tests/t-aorsmul.c [new file with mode: 0644]
mini-gmp/tests/t-bitops.c
mini-gmp/tests/t-cmp_d.c
mini-gmp/tests/t-comb.c
mini-gmp/tests/t-cong.c [new file with mode: 0644]
mini-gmp/tests/t-div.c
mini-gmp/tests/t-div_2exp.c
mini-gmp/tests/t-double.c
mini-gmp/tests/t-gcd.c
mini-gmp/tests/t-import.c
mini-gmp/tests/t-invert.c
mini-gmp/tests/t-lcm.c
mini-gmp/tests/t-limbs.c [new file with mode: 0644]
mini-gmp/tests/t-logops.c
mini-gmp/tests/t-mul.c
mini-gmp/tests/t-powm.c
mini-gmp/tests/t-pprime_p.c [new file with mode: 0644]
mini-gmp/tests/t-reuse.c
mini-gmp/tests/t-root.c
mini-gmp/tests/t-scan.c
mini-gmp/tests/t-signed.c
mini-gmp/tests/t-sqrt.c
mini-gmp/tests/t-str.c
mini-gmp/tests/t-sub.c
mini-gmp/tests/testutils.c
mini-gmp/tests/testutils.h
missing
mp_bpl.c
mp_clz_tab.c
mp_dv_tab.c
mp_get_fns.c
mp_minv_tab.c
mp_set_fns.c
mpf/Makefile.am
mpf/Makefile.in
mpf/abs.c
mpf/add.c
mpf/add_ui.c
mpf/ceilfloor.c
mpf/clear.c
mpf/clears.c
mpf/cmp.c
mpf/cmp_d.c
mpf/cmp_si.c
mpf/cmp_ui.c
mpf/div.c
mpf/div_2exp.c
mpf/div_ui.c
mpf/dump.c
mpf/eq.c
mpf/fits_s.h
mpf/fits_sint.c
mpf/fits_slong.c
mpf/fits_sshort.c
mpf/fits_u.h
mpf/fits_uint.c
mpf/fits_ulong.c
mpf/fits_ushort.c
mpf/get_d.c
mpf/get_d_2exp.c
mpf/get_dfl_prec.c
mpf/get_prc.c
mpf/get_si.c
mpf/get_str.c
mpf/get_ui.c
mpf/init.c
mpf/init2.c
mpf/inits.c
mpf/inp_str.c
mpf/int_p.c
mpf/iset.c
mpf/iset_d.c
mpf/iset_si.c
mpf/iset_str.c
mpf/iset_ui.c
mpf/mul.c
mpf/mul_2exp.c
mpf/mul_ui.c
mpf/neg.c
mpf/out_str.c
mpf/pow_ui.c
mpf/random2.c
mpf/reldiff.c
mpf/set.c
mpf/set_d.c
mpf/set_dfl_prec.c
mpf/set_prc.c
mpf/set_prc_raw.c
mpf/set_q.c
mpf/set_si.c
mpf/set_str.c
mpf/set_ui.c
mpf/set_z.c
mpf/size.c
mpf/sqrt.c
mpf/sqrt_ui.c
mpf/sub.c
mpf/sub_ui.c
mpf/swap.c
mpf/trunc.c
mpf/ui_div.c
mpf/ui_sub.c
mpf/urandomb.c
mpn/Makeasm.am
mpn/Makefile.am
mpn/Makefile.in
mpn/README
mpn/a29k/add_n.s [deleted file]
mpn/a29k/addmul_1.s [deleted file]
mpn/a29k/lshift.s [deleted file]
mpn/a29k/mul_1.s [deleted file]
mpn/a29k/rshift.s [deleted file]
mpn/a29k/sub_n.s [deleted file]
mpn/a29k/submul_1.s [deleted file]
mpn/a29k/udiv.s [deleted file]
mpn/a29k/umul.s [deleted file]
mpn/alpha/README
mpn/alpha/add_n.asm
mpn/alpha/addmul_1.asm
mpn/alpha/alpha-defs.m4
mpn/alpha/aorslsh1_n.asm
mpn/alpha/aorslsh2_n.asm [new file with mode: 0644]
mpn/alpha/bdiv_dbm1c.asm
mpn/alpha/cntlz.asm
mpn/alpha/com.asm
mpn/alpha/copyd.asm
mpn/alpha/copyi.asm
mpn/alpha/default.m4
mpn/alpha/dive_1.c
mpn/alpha/divrem_2.asm
mpn/alpha/ev5/diveby3.asm
mpn/alpha/ev5/gmp-mparam.h
mpn/alpha/ev6/add_n.asm
mpn/alpha/ev6/aorslsh1_n.asm [new file with mode: 0644]
mpn/alpha/ev6/aorsmul_1.asm
mpn/alpha/ev6/gmp-mparam.h
mpn/alpha/ev6/mod_1_4.asm
mpn/alpha/ev6/mul_1.asm
mpn/alpha/ev6/nails/README
mpn/alpha/ev6/nails/addmul_1.asm
mpn/alpha/ev6/nails/addmul_2.asm
mpn/alpha/ev6/nails/addmul_3.asm
mpn/alpha/ev6/nails/addmul_4.asm
mpn/alpha/ev6/nails/aors_n.asm
mpn/alpha/ev6/nails/gmp-mparam.h
mpn/alpha/ev6/nails/mul_1.asm
mpn/alpha/ev6/nails/submul_1.asm
mpn/alpha/ev6/slot.pl
mpn/alpha/ev6/sqr_diagonal.asm [deleted file]
mpn/alpha/ev6/sub_n.asm
mpn/alpha/ev67/gcd_1.asm
mpn/alpha/ev67/hamdist.asm
mpn/alpha/ev67/popcount.asm
mpn/alpha/gmp-mparam.h
mpn/alpha/invert_limb.asm
mpn/alpha/lshift.asm
mpn/alpha/mod_34lsub1.asm
mpn/alpha/mode1o.asm
mpn/alpha/mul_1.asm
mpn/alpha/rshift.asm
mpn/alpha/sec_tabselect.asm [new file with mode: 0644]
mpn/alpha/sqr_diag_addlsh1.asm [new file with mode: 0644]
mpn/alpha/sqr_diagonal.asm [deleted file]
mpn/alpha/sub_n.asm
mpn/alpha/submul_1.asm
mpn/alpha/umul.asm
mpn/alpha/unicos.m4
mpn/arm/README
mpn/arm/aors_n.asm
mpn/arm/aorscnd_n.asm [deleted file]
mpn/arm/aorslsh1_n.asm
mpn/arm/aorsmul_1.asm
mpn/arm/arm-defs.m4
mpn/arm/bdiv_dbm1c.asm
mpn/arm/cnd_aors_n.asm [new file with mode: 0644]
mpn/arm/com.asm
mpn/arm/copyd.asm
mpn/arm/copyi.asm
mpn/arm/dive_1.asm [new file with mode: 0644]
mpn/arm/gmp-mparam.h
mpn/arm/invert_limb.asm
mpn/arm/logops_n.asm
mpn/arm/lshift.asm
mpn/arm/lshiftc.asm
mpn/arm/mod_34lsub1.asm
mpn/arm/mode1o.asm
mpn/arm/mul_1.asm
mpn/arm/neon/README [new file with mode: 0644]
mpn/arm/neon/hamdist.asm [new file with mode: 0644]
mpn/arm/neon/lorrshift.asm [new file with mode: 0644]
mpn/arm/neon/lshiftc.asm [new file with mode: 0644]
mpn/arm/neon/popcount.asm [new file with mode: 0644]
mpn/arm/neon/sec_tabselect.asm [new file with mode: 0644]
mpn/arm/rsh1aors_n.asm
mpn/arm/rshift.asm
mpn/arm/sec_tabselect.asm [new file with mode: 0644]
mpn/arm/udiv.asm
mpn/arm/v5/gcd_1.asm
mpn/arm/v5/mod_1_1.asm
mpn/arm/v5/mod_1_2.asm
mpn/arm/v6/addmul_1.asm
mpn/arm/v6/addmul_2.asm
mpn/arm/v6/addmul_3.asm [new file with mode: 0644]
mpn/arm/v6/dive_1.asm [new file with mode: 0644]
mpn/arm/v6/gmp-mparam.h
mpn/arm/v6/mode1o.asm [new file with mode: 0644]
mpn/arm/v6/mul_1.asm
mpn/arm/v6/mul_2.asm
mpn/arm/v6/popham.asm [new file with mode: 0644]
mpn/arm/v6/sqr_basecase.asm
mpn/arm/v6/submul_1.asm [new file with mode: 0644]
mpn/arm/v6t2/divrem_1.asm
mpn/arm/v6t2/gcd_1.asm
mpn/arm/v6t2/mode1o.asm [deleted file]
mpn/arm/v7a/cora15/addmul_1.asm [new file with mode: 0644]
mpn/arm/v7a/cora15/aors_n.asm [new file with mode: 0644]
mpn/arm/v7a/cora15/cnd_aors_n.asm [new file with mode: 0644]
mpn/arm/v7a/cora15/com.asm [new file with mode: 0644]
mpn/arm/v7a/cora15/gmp-mparam.h
mpn/arm/v7a/cora15/logops_n.asm [new file with mode: 0644]
mpn/arm/v7a/cora15/mul_1.asm [new file with mode: 0644]
mpn/arm/v7a/cora15/neon/aorsorrlsh1_n.asm [new file with mode: 0644]
mpn/arm/v7a/cora15/neon/aorsorrlsh2_n.asm [new file with mode: 0644]
mpn/arm/v7a/cora15/neon/aorsorrlshC_n.asm [new file with mode: 0644]
mpn/arm/v7a/cora15/neon/com.asm [new file with mode: 0644]
mpn/arm/v7a/cora15/neon/copyd.asm [new file with mode: 0644]
mpn/arm/v7a/cora15/neon/copyi.asm [new file with mode: 0644]
mpn/arm/v7a/cora15/neon/rsh1aors_n.asm [new file with mode: 0644]
mpn/arm/v7a/cora15/submul_1.asm [new file with mode: 0644]
mpn/arm/v7a/cora9/gmp-mparam.h [new file with mode: 0644]
mpn/arm64/aors_n.asm [new file with mode: 0644]
mpn/arm64/aorsmul_1.asm [new file with mode: 0644]
mpn/arm64/cnd_aors_n.asm [new file with mode: 0644]
mpn/arm64/copyd.asm [new file with mode: 0644]
mpn/arm64/copyi.asm [new file with mode: 0644]
mpn/arm64/gcd_1.asm [new file with mode: 0644]
mpn/arm64/invert_limb.asm [new file with mode: 0644]
mpn/arm64/logops_n.asm [new file with mode: 0644]
mpn/arm64/mul_1.asm [new file with mode: 0644]
mpn/asm-defs.m4
mpn/clipper/add_n.s [deleted file]
mpn/clipper/mul_1.s [deleted file]
mpn/clipper/sub_n.s [deleted file]
mpn/cpp-ccas
mpn/cray/README
mpn/cray/add_n.c
mpn/cray/cfp/addmul_1.c
mpn/cray/cfp/mul_1.c
mpn/cray/cfp/mulwwc90.s
mpn/cray/cfp/mulwwj90.s
mpn/cray/cfp/submul_1.c
mpn/cray/gmp-mparam.h
mpn/cray/hamdist.c
mpn/cray/ieee/addmul_1.c
mpn/cray/ieee/gmp-mparam.h
mpn/cray/ieee/invert_limb.c
mpn/cray/ieee/mul_1.c
mpn/cray/ieee/mul_basecase.c
mpn/cray/ieee/sqr_basecase.c
mpn/cray/ieee/submul_1.c
mpn/cray/lshift.c
mpn/cray/mulww.f
mpn/cray/popcount.c
mpn/cray/rshift.c
mpn/cray/sub_n.c
mpn/generic/add.c
mpn/generic/add_1.c
mpn/generic/add_err1_n.c
mpn/generic/add_err2_n.c
mpn/generic/add_err3_n.c
mpn/generic/add_n.c
mpn/generic/add_n_sub_n.c
mpn/generic/addcnd_n.c [deleted file]
mpn/generic/addmul_1.c
mpn/generic/bdiv_dbm1c.c
mpn/generic/bdiv_q.c
mpn/generic/bdiv_q_1.c
mpn/generic/bdiv_qr.c
mpn/generic/binvert.c
mpn/generic/broot.c
mpn/generic/brootinv.c
mpn/generic/bsqrt.c
mpn/generic/bsqrtinv.c
mpn/generic/cmp.c
mpn/generic/cnd_add_n.c [new file with mode: 0644]
mpn/generic/cnd_sub_n.c [new file with mode: 0644]
mpn/generic/com.c
mpn/generic/comb_tables.c
mpn/generic/copyd.c
mpn/generic/copyi.c
mpn/generic/dcpi1_bdiv_q.c
mpn/generic/dcpi1_bdiv_qr.c
mpn/generic/dcpi1_div_q.c
mpn/generic/dcpi1_div_qr.c
mpn/generic/dcpi1_divappr_q.c
mpn/generic/div_q.c
mpn/generic/div_qr_1.c [new file with mode: 0644]
mpn/generic/div_qr_1n_pi1.c [new file with mode: 0644]
mpn/generic/div_qr_1n_pi2.c [new file with mode: 0644]
mpn/generic/div_qr_1u_pi2.c [new file with mode: 0644]
mpn/generic/div_qr_2.c
mpn/generic/div_qr_2n_pi1.c
mpn/generic/div_qr_2u_pi1.c
mpn/generic/dive_1.c
mpn/generic/diveby3.c
mpn/generic/divexact.c
mpn/generic/divis.c
mpn/generic/divrem.c
mpn/generic/divrem_1.c
mpn/generic/divrem_2.c
mpn/generic/dump.c
mpn/generic/fib2_ui.c
mpn/generic/gcd.c
mpn/generic/gcd_1.c
mpn/generic/gcd_subdiv_step.c
mpn/generic/gcdext.c
mpn/generic/gcdext_1.c
mpn/generic/gcdext_lehmer.c
mpn/generic/get_d.c
mpn/generic/get_str.c
mpn/generic/gmp-mparam.h
mpn/generic/hgcd.c
mpn/generic/hgcd2.c
mpn/generic/hgcd2_jacobi.c
mpn/generic/hgcd_appr.c
mpn/generic/hgcd_jacobi.c
mpn/generic/hgcd_matrix.c
mpn/generic/hgcd_reduce.c
mpn/generic/hgcd_step.c
mpn/generic/invert.c
mpn/generic/invertappr.c
mpn/generic/jacbase.c
mpn/generic/jacobi.c
mpn/generic/jacobi_2.c
mpn/generic/logops_n.c
mpn/generic/lshift.c
mpn/generic/lshiftc.c
mpn/generic/matrix22_mul.c
mpn/generic/matrix22_mul1_inverse_vector.c
mpn/generic/mod_1.c
mpn/generic/mod_1_1.c
mpn/generic/mod_1_2.c
mpn/generic/mod_1_3.c
mpn/generic/mod_1_4.c
mpn/generic/mod_34lsub1.c
mpn/generic/mode1o.c
mpn/generic/mu_bdiv_q.c
mpn/generic/mu_bdiv_qr.c
mpn/generic/mu_div_q.c
mpn/generic/mu_div_qr.c
mpn/generic/mu_divappr_q.c
mpn/generic/mul.c
mpn/generic/mul_1.c
mpn/generic/mul_basecase.c
mpn/generic/mul_fft.c
mpn/generic/mul_n.c
mpn/generic/mullo_basecase.c
mpn/generic/mullo_n.c
mpn/generic/mulmid.c
mpn/generic/mulmid_basecase.c
mpn/generic/mulmid_n.c
mpn/generic/mulmod_bnm1.c
mpn/generic/neg.c
mpn/generic/nussbaumer_mul.c
mpn/generic/perfpow.c
mpn/generic/perfsqr.c
mpn/generic/popham.c
mpn/generic/pow_1.c
mpn/generic/powlo.c
mpn/generic/powm.c
mpn/generic/powm_sec.c [deleted file]
mpn/generic/pre_divrem_1.c
mpn/generic/pre_mod_1.c
mpn/generic/random.c
mpn/generic/random2.c
mpn/generic/redc_1.c
mpn/generic/redc_2.c
mpn/generic/redc_n.c
mpn/generic/remove.c
mpn/generic/rootrem.c
mpn/generic/rshift.c
mpn/generic/sb_div_sec.c [deleted file]
mpn/generic/sbpi1_bdiv_q.c
mpn/generic/sbpi1_bdiv_qr.c
mpn/generic/sbpi1_div_q.c
mpn/generic/sbpi1_div_qr.c
mpn/generic/sbpi1_div_sec.c [deleted file]
mpn/generic/sbpi1_divappr_q.c
mpn/generic/scan0.c
mpn/generic/scan1.c
mpn/generic/sec_aors_1.c [new file with mode: 0644]
mpn/generic/sec_div.c [new file with mode: 0644]
mpn/generic/sec_invert.c [new file with mode: 0644]
mpn/generic/sec_mul.c [new file with mode: 0644]
mpn/generic/sec_pi1_div.c [new file with mode: 0644]
mpn/generic/sec_powm.c [new file with mode: 0644]
mpn/generic/sec_sqr.c [new file with mode: 0644]
mpn/generic/sec_tabselect.c [new file with mode: 0644]
mpn/generic/set_str.c
mpn/generic/sizeinbase.c
mpn/generic/sqr.c
mpn/generic/sqr_basecase.c
mpn/generic/sqrmod_bnm1.c
mpn/generic/sqrtrem.c
mpn/generic/sub.c
mpn/generic/sub_1.c
mpn/generic/sub_err1_n.c
mpn/generic/sub_err2_n.c
mpn/generic/sub_err3_n.c
mpn/generic/sub_n.c
mpn/generic/subcnd_n.c [deleted file]
mpn/generic/submul_1.c
mpn/generic/tabselect.c [deleted file]
mpn/generic/tdiv_qr.c
mpn/generic/toom22_mul.c
mpn/generic/toom2_sqr.c
mpn/generic/toom32_mul.c
mpn/generic/toom33_mul.c
mpn/generic/toom3_sqr.c
mpn/generic/toom42_mul.c
mpn/generic/toom42_mulmid.c
mpn/generic/toom43_mul.c
mpn/generic/toom44_mul.c
mpn/generic/toom4_sqr.c
mpn/generic/toom52_mul.c
mpn/generic/toom53_mul.c
mpn/generic/toom54_mul.c
mpn/generic/toom62_mul.c
mpn/generic/toom63_mul.c
mpn/generic/toom6_sqr.c
mpn/generic/toom6h_mul.c
mpn/generic/toom8_sqr.c
mpn/generic/toom8h_mul.c
mpn/generic/toom_couple_handling.c
mpn/generic/toom_eval_dgr3_pm1.c
mpn/generic/toom_eval_dgr3_pm2.c
mpn/generic/toom_eval_pm1.c
mpn/generic/toom_eval_pm2.c
mpn/generic/toom_eval_pm2exp.c
mpn/generic/toom_eval_pm2rexp.c
mpn/generic/toom_interpolate_12pts.c
mpn/generic/toom_interpolate_16pts.c
mpn/generic/toom_interpolate_5pts.c
mpn/generic/toom_interpolate_6pts.c
mpn/generic/toom_interpolate_7pts.c
mpn/generic/toom_interpolate_8pts.c
mpn/generic/trialdiv.c
mpn/generic/udiv_w_sdiv.c
mpn/generic/zero.c
mpn/i960/README [deleted file]
mpn/i960/add_n.s [deleted file]
mpn/i960/addmul_1.s [deleted file]
mpn/i960/mul_1.s [deleted file]
mpn/i960/sub_n.s [deleted file]
mpn/ia64/README
mpn/ia64/add_n_sub_n.asm
mpn/ia64/addmul_1.asm
mpn/ia64/addmul_2.asm
mpn/ia64/aors_n.asm
mpn/ia64/aorslsh1_n.asm [deleted file]
mpn/ia64/aorslsh2_n.asm [deleted file]
mpn/ia64/aorslshC_n.asm [deleted file]
mpn/ia64/aorsorrlsh1_n.asm [new file with mode: 0644]
mpn/ia64/aorsorrlsh2_n.asm [new file with mode: 0644]
mpn/ia64/aorsorrlshC_n.asm [new file with mode: 0644]
mpn/ia64/bdiv_dbm1c.asm
mpn/ia64/cnd_aors_n.asm [new file with mode: 0644]
mpn/ia64/copyd.asm
mpn/ia64/copyi.asm
mpn/ia64/dive_1.asm
mpn/ia64/divrem_1.asm
mpn/ia64/divrem_2.asm
mpn/ia64/gcd_1.asm
mpn/ia64/gmp-mparam.h
mpn/ia64/hamdist.asm
mpn/ia64/ia64-defs.m4
mpn/ia64/invert_limb.asm
mpn/ia64/logops_n.asm
mpn/ia64/lorrshift.asm
mpn/ia64/lshiftc.asm
mpn/ia64/mod_34lsub1.asm
mpn/ia64/mode1o.asm
mpn/ia64/mul_1.asm
mpn/ia64/mul_2.asm
mpn/ia64/popcount.asm
mpn/ia64/rsh1aors_n.asm
mpn/ia64/sec_tabselect.asm [new file with mode: 0644]
mpn/ia64/sqr_diag_addlsh1.asm
mpn/ia64/submul_1.asm
mpn/ia64/tabselect.asm [deleted file]
mpn/lisp/gmpasm-mode.el
mpn/m4-ccas
mpn/m68k/README
mpn/m68k/aors_n.asm
mpn/m68k/gmp-mparam.h
mpn/m68k/lshift.asm
mpn/m68k/m68k-defs.m4
mpn/m68k/mc68020/aorsmul_1.asm
mpn/m68k/mc68020/mul_1.asm
mpn/m68k/mc68020/udiv.asm
mpn/m68k/mc68020/umul.asm
mpn/m68k/rshift.asm
mpn/m68k/t-m68k-defs.pl
mpn/m88k/README
mpn/m88k/add_n.s
mpn/m88k/mc88110/add_n.S
mpn/m88k/mc88110/addmul_1.s
mpn/m88k/mc88110/mul_1.s
mpn/m88k/mc88110/sub_n.S
mpn/m88k/mul_1.s
mpn/m88k/sub_n.s
mpn/minithres/gmp-mparam.h
mpn/mips32/add_n.asm
mpn/mips32/addmul_1.asm
mpn/mips32/gmp-mparam.h
mpn/mips32/lshift.asm
mpn/mips32/mips-defs.m4
mpn/mips32/mips.m4
mpn/mips32/mul_1.asm
mpn/mips32/rshift.asm
mpn/mips32/sub_n.asm
mpn/mips32/submul_1.asm
mpn/mips32/umul.asm
mpn/mips64/README
mpn/mips64/add_n.asm
mpn/mips64/addmul_1.asm
mpn/mips64/gmp-mparam.h
mpn/mips64/lshift.asm
mpn/mips64/mul_1.asm
mpn/mips64/rshift.asm
mpn/mips64/sqr_diagonal.asm
mpn/mips64/sub_n.asm
mpn/mips64/submul_1.asm
mpn/mips64/umul.asm
mpn/ns32k/add_n.s [deleted file]
mpn/ns32k/addmul_1.s [deleted file]
mpn/ns32k/mul_1.s [deleted file]
mpn/ns32k/sub_n.s [deleted file]
mpn/ns32k/submul_1.s [deleted file]
mpn/pa32/README
mpn/pa32/add_n.asm
mpn/pa32/gmp-mparam.h
mpn/pa32/hppa1_1/addmul_1.asm
mpn/pa32/hppa1_1/gmp-mparam.h
mpn/pa32/hppa1_1/mul_1.asm
mpn/pa32/hppa1_1/pa7100/add_n.asm
mpn/pa32/hppa1_1/pa7100/addmul_1.asm
mpn/pa32/hppa1_1/pa7100/lshift.asm
mpn/pa32/hppa1_1/pa7100/rshift.asm
mpn/pa32/hppa1_1/pa7100/sub_n.asm
mpn/pa32/hppa1_1/pa7100/submul_1.asm
mpn/pa32/hppa1_1/sqr_diagonal.asm
mpn/pa32/hppa1_1/submul_1.asm
mpn/pa32/hppa1_1/udiv.asm
mpn/pa32/hppa1_1/umul.asm
mpn/pa32/hppa2_0/add_n.asm
mpn/pa32/hppa2_0/gmp-mparam.h
mpn/pa32/hppa2_0/sqr_diagonal.asm
mpn/pa32/hppa2_0/sub_n.asm
mpn/pa32/lshift.asm
mpn/pa32/pa-defs.m4
mpn/pa32/rshift.asm
mpn/pa32/sub_n.asm
mpn/pa32/udiv.asm
mpn/pa64/README
mpn/pa64/addmul_1.asm
mpn/pa64/aors_n.asm
mpn/pa64/aorslsh1_n.asm
mpn/pa64/gmp-mparam.h
mpn/pa64/lshift.asm
mpn/pa64/mul_1.asm
mpn/pa64/rshift.asm
mpn/pa64/sqr_diagonal.asm
mpn/pa64/submul_1.asm
mpn/pa64/udiv.asm
mpn/pa64/umul.asm
mpn/power/add_n.asm
mpn/power/addmul_1.asm
mpn/power/gmp-mparam.h
mpn/power/lshift.asm
mpn/power/mul_1.asm
mpn/power/rshift.asm
mpn/power/sdiv.asm
mpn/power/sub_n.asm
mpn/power/submul_1.asm
mpn/power/umul.asm
mpn/powerpc32/750/com.asm
mpn/powerpc32/750/gmp-mparam.h
mpn/powerpc32/750/lshift.asm
mpn/powerpc32/750/rshift.asm
mpn/powerpc32/README
mpn/powerpc32/addlsh1_n.asm
mpn/powerpc32/addmul_1.asm
mpn/powerpc32/aix.m4
mpn/powerpc32/aors_n.asm
mpn/powerpc32/bdiv_dbm1c.asm
mpn/powerpc32/darwin.m4
mpn/powerpc32/diveby3.asm
mpn/powerpc32/divrem_2.asm
mpn/powerpc32/eabi.m4
mpn/powerpc32/elf.m4
mpn/powerpc32/gmp-mparam.h
mpn/powerpc32/invert_limb.asm
mpn/powerpc32/lshift.asm
mpn/powerpc32/lshiftc.asm
mpn/powerpc32/mod_34lsub1.asm
mpn/powerpc32/mode1o.asm
mpn/powerpc32/mul_1.asm
mpn/powerpc32/p3-p7/aors_n.asm
mpn/powerpc32/p3/gmp-mparam.h
mpn/powerpc32/p4/gmp-mparam.h
mpn/powerpc32/p5/gmp-mparam.h
mpn/powerpc32/p6/gmp-mparam.h
mpn/powerpc32/p7/gmp-mparam.h
mpn/powerpc32/powerpc-defs.m4
mpn/powerpc32/rshift.asm
mpn/powerpc32/sec_tabselect.asm [new file with mode: 0644]
mpn/powerpc32/sqr_diag_addlsh1.asm [new file with mode: 0644]
mpn/powerpc32/sqr_diagonal.asm [deleted file]
mpn/powerpc32/sublsh1_n.asm
mpn/powerpc32/submul_1.asm
mpn/powerpc32/tabselect.asm [deleted file]
mpn/powerpc32/umul.asm
mpn/powerpc32/vmx/copyd.asm
mpn/powerpc32/vmx/copyi.asm
mpn/powerpc32/vmx/logops_n.asm
mpn/powerpc32/vmx/mod_34lsub1.asm
mpn/powerpc32/vmx/popcount.asm
mpn/powerpc64/README
mpn/powerpc64/aix.m4
mpn/powerpc64/com.asm
mpn/powerpc64/copyd.asm
mpn/powerpc64/copyi.asm
mpn/powerpc64/darwin.m4
mpn/powerpc64/elf.m4
mpn/powerpc64/logops_n.asm
mpn/powerpc64/lshift.asm
mpn/powerpc64/lshiftc.asm
mpn/powerpc64/mode32/add_n.asm
mpn/powerpc64/mode32/addmul_1.asm
mpn/powerpc64/mode32/mul_1.asm
mpn/powerpc64/mode32/p4/gmp-mparam.h
mpn/powerpc64/mode32/sqr_diagonal.asm
mpn/powerpc64/mode32/sub_n.asm
mpn/powerpc64/mode32/submul_1.asm
mpn/powerpc64/mode64/aors_n.asm
mpn/powerpc64/mode64/aorscnd_n.asm [deleted file]
mpn/powerpc64/mode64/aorslsh1_n.asm [deleted file]
mpn/powerpc64/mode64/aorslsh2_n.asm [deleted file]
mpn/powerpc64/mode64/aorslshC_n.asm [deleted file]
mpn/powerpc64/mode64/aorsmul_1.asm
mpn/powerpc64/mode64/aorsorrlsh1_n.asm [new file with mode: 0644]
mpn/powerpc64/mode64/aorsorrlsh2_n.asm [new file with mode: 0644]
mpn/powerpc64/mode64/aorsorrlshC_n.asm [new file with mode: 0644]
mpn/powerpc64/mode64/bdiv_dbm1c.asm
mpn/powerpc64/mode64/cnd_aors_n.asm [new file with mode: 0644]
mpn/powerpc64/mode64/dive_1.asm
mpn/powerpc64/mode64/divrem_1.asm
mpn/powerpc64/mode64/divrem_2.asm
mpn/powerpc64/mode64/gcd_1.asm [new file with mode: 0644]
mpn/powerpc64/mode64/gmp-mparam.h
mpn/powerpc64/mode64/invert_limb.asm
mpn/powerpc64/mode64/mod_1_1.asm
mpn/powerpc64/mode64/mod_1_4.asm
mpn/powerpc64/mode64/mod_34lsub1.asm
mpn/powerpc64/mode64/mode1o.asm
mpn/powerpc64/mode64/mul_1.asm
mpn/powerpc64/mode64/mul_basecase.asm
mpn/powerpc64/mode64/p3/gmp-mparam.h
mpn/powerpc64/mode64/p4/gmp-mparam.h
mpn/powerpc64/mode64/p5/gmp-mparam.h
mpn/powerpc64/mode64/p6/aorsmul_1.asm
mpn/powerpc64/mode64/p6/gmp-mparam.h
mpn/powerpc64/mode64/p6/mul_basecase.asm
mpn/powerpc64/mode64/p7/aormul_2.asm [new file with mode: 0644]
mpn/powerpc64/mode64/p7/aors_n.asm [new file with mode: 0644]
mpn/powerpc64/mode64/p7/aorsorrlsh1_n.asm [new file with mode: 0644]
mpn/powerpc64/mode64/p7/aorsorrlsh2_n.asm [new file with mode: 0644]
mpn/powerpc64/mode64/p7/aorsorrlshC_n.asm [new file with mode: 0644]
mpn/powerpc64/mode64/p7/gcd_1.asm [new file with mode: 0644]
mpn/powerpc64/mode64/p7/gmp-mparam.h
mpn/powerpc64/mode64/rsh1add_n.asm [deleted file]
mpn/powerpc64/mode64/rsh1aors_n.asm [new file with mode: 0644]
mpn/powerpc64/mode64/rsh1sub_n.asm [deleted file]
mpn/powerpc64/mode64/sqr_basecase.asm
mpn/powerpc64/p6/lshift.asm
mpn/powerpc64/p6/lshiftc.asm
mpn/powerpc64/p6/rshift.asm
mpn/powerpc64/p7/copyd.asm [new file with mode: 0644]
mpn/powerpc64/p7/copyi.asm [new file with mode: 0644]
mpn/powerpc64/p7/hamdist.asm
mpn/powerpc64/p7/popcount.asm
mpn/powerpc64/rshift.asm
mpn/powerpc64/sec_tabselect.asm [new file with mode: 0644]
mpn/powerpc64/tabselect.asm [deleted file]
mpn/powerpc64/umul.asm
mpn/powerpc64/vmx/popcount.asm
mpn/pyr/add_n.s [deleted file]
mpn/pyr/addmul_1.s [deleted file]
mpn/pyr/mul_1.s [deleted file]
mpn/pyr/sub_n.s [deleted file]
mpn/s390_32/addmul_1.asm
mpn/s390_32/copyd.asm
mpn/s390_32/copyi.asm
mpn/s390_32/esame/addmul_1.asm
mpn/s390_32/esame/aors_n.asm
mpn/s390_32/esame/aorslsh1_n.asm
mpn/s390_32/esame/bdiv_dbm1c.asm
mpn/s390_32/esame/gmp-mparam.h
mpn/s390_32/esame/mul_1.asm
mpn/s390_32/esame/mul_basecase.asm
mpn/s390_32/esame/sqr_basecase.asm
mpn/s390_32/esame/submul_1.asm
mpn/s390_32/gmp-mparam.h
mpn/s390_32/logops_n.asm
mpn/s390_32/lshift.asm
mpn/s390_32/lshiftc.asm
mpn/s390_32/mul_1.asm
mpn/s390_32/rshift.asm
mpn/s390_32/submul_1.asm
mpn/s390_64/README
mpn/s390_64/addmul_1.asm
mpn/s390_64/aorrlsh1_n.asm
mpn/s390_64/aors_n.asm
mpn/s390_64/bdiv_dbm1c.asm
mpn/s390_64/copyd.asm
mpn/s390_64/copyi.asm
mpn/s390_64/gmp-mparam.h
mpn/s390_64/invert_limb.asm
mpn/s390_64/logops_n.asm
mpn/s390_64/lshift.asm
mpn/s390_64/lshiftc.asm
mpn/s390_64/mod_34lsub1.asm
mpn/s390_64/mul_1.asm
mpn/s390_64/mul_basecase.asm
mpn/s390_64/rshift.asm
mpn/s390_64/sqr_basecase.asm
mpn/s390_64/sublsh1_n.asm
mpn/s390_64/submul_1.asm
mpn/s390_64/z10/gmp-mparam.h [new file with mode: 0644]
mpn/sh/add_n.asm
mpn/sh/sh2/addmul_1.asm
mpn/sh/sh2/mul_1.asm
mpn/sh/sh2/submul_1.asm
mpn/sh/sub_n.asm
mpn/sparc32/README
mpn/sparc32/add_n.asm
mpn/sparc32/addmul_1.asm
mpn/sparc32/gmp-mparam.h
mpn/sparc32/lshift.asm
mpn/sparc32/mul_1.asm
mpn/sparc32/rshift.asm
mpn/sparc32/sparc-defs.m4
mpn/sparc32/sub_n.asm
mpn/sparc32/submul_1.asm
mpn/sparc32/udiv.asm
mpn/sparc32/udiv_nfp.asm
mpn/sparc32/ultrasparct1/add_n.asm
mpn/sparc32/ultrasparct1/addmul_1.asm
mpn/sparc32/ultrasparct1/gmp-mparam.h
mpn/sparc32/ultrasparct1/mul_1.asm
mpn/sparc32/ultrasparct1/sqr_diagonal.asm
mpn/sparc32/ultrasparct1/sub_n.asm
mpn/sparc32/ultrasparct1/submul_1.asm
mpn/sparc32/umul.asm
mpn/sparc32/v8/addmul_1.asm
mpn/sparc32/v8/gmp-mparam.h
mpn/sparc32/v8/mul_1.asm
mpn/sparc32/v8/submul_1.asm
mpn/sparc32/v8/supersparc/gmp-mparam.h
mpn/sparc32/v8/supersparc/udiv.asm
mpn/sparc32/v8/udiv.asm
mpn/sparc32/v8/umul.asm
mpn/sparc32/v9/add_n.asm
mpn/sparc32/v9/addmul_1.asm
mpn/sparc32/v9/gmp-mparam.h
mpn/sparc32/v9/mul_1.asm
mpn/sparc32/v9/sqr_diagonal.asm
mpn/sparc32/v9/sub_n.asm
mpn/sparc32/v9/submul_1.asm
mpn/sparc32/v9/udiv.asm
mpn/sparc64/README
mpn/sparc64/copyd.asm
mpn/sparc64/copyi.asm
mpn/sparc64/dive_1.c
mpn/sparc64/divrem_1.c
mpn/sparc64/gcd_1.asm
mpn/sparc64/gmp-mparam.h
mpn/sparc64/lshift.asm [new file with mode: 0644]
mpn/sparc64/lshiftc.asm [new file with mode: 0644]
mpn/sparc64/mod_1.c
mpn/sparc64/mod_1_4.c
mpn/sparc64/mode1o.c
mpn/sparc64/rshift.asm [new file with mode: 0644]
mpn/sparc64/sec_tabselect.asm [new file with mode: 0644]
mpn/sparc64/sparc64.h
mpn/sparc64/ultrasparc1234/add_n.asm
mpn/sparc64/ultrasparc1234/addmul_1.asm
mpn/sparc64/ultrasparc1234/addmul_2.asm
mpn/sparc64/ultrasparc1234/lshift.asm [deleted file]
mpn/sparc64/ultrasparc1234/lshiftc.asm
mpn/sparc64/ultrasparc1234/mul_1.asm
mpn/sparc64/ultrasparc1234/rshift.asm [deleted file]
mpn/sparc64/ultrasparc1234/sqr_diagonal.asm
mpn/sparc64/ultrasparc1234/sub_n.asm
mpn/sparc64/ultrasparc1234/submul_1.asm
mpn/sparc64/ultrasparc34/gmp-mparam.h
mpn/sparc64/ultrasparct1/add_n.asm
mpn/sparc64/ultrasparct1/addlsh1_n.asm
mpn/sparc64/ultrasparct1/addlsh2_n.asm
mpn/sparc64/ultrasparct1/addlshC_n.asm
mpn/sparc64/ultrasparct1/addmul_1.asm
mpn/sparc64/ultrasparct1/gmp-mparam.h
mpn/sparc64/ultrasparct1/lshift.asm [deleted file]
mpn/sparc64/ultrasparct1/lshiftc.asm [deleted file]
mpn/sparc64/ultrasparct1/mul_1.asm
mpn/sparc64/ultrasparct1/rsblsh1_n.asm
mpn/sparc64/ultrasparct1/rsblsh2_n.asm
mpn/sparc64/ultrasparct1/rsblshC_n.asm
mpn/sparc64/ultrasparct1/rshift.asm [deleted file]
mpn/sparc64/ultrasparct1/sub_n.asm
mpn/sparc64/ultrasparct1/sublsh1_n.asm
mpn/sparc64/ultrasparct1/sublsh2_n.asm
mpn/sparc64/ultrasparct1/sublshC_n.asm
mpn/sparc64/ultrasparct1/submul_1.asm
mpn/sparc64/ultrasparct3/add_n.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/addmul_1.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/aormul_2.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/aormul_4.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/aorslsh_n.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/bdiv_dbm1c.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/cnd_aors_n.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/dive_1.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/hamdist.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/invert_limb.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/missing.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/missing.m4 [new file with mode: 0644]
mpn/sparc64/ultrasparct3/mod_1_4.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/mod_34lsub1.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/mode1o.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/mul_1.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/popcount.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/sqr_diag_addlsh1.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/sub_n.asm [new file with mode: 0644]
mpn/sparc64/ultrasparct3/submul_1.asm [new file with mode: 0644]
mpn/thumb/add_n.asm
mpn/thumb/sub_n.asm
mpn/vax/add_n.asm
mpn/vax/addmul_1.asm
mpn/vax/elf.m4
mpn/vax/gmp-mparam.h
mpn/vax/lshift.asm
mpn/vax/mul_1.asm
mpn/vax/rshift.asm
mpn/vax/sub_n.asm
mpn/vax/submul_1.asm
mpn/x86/README
mpn/x86/aors_n.asm
mpn/x86/aorsmul_1.asm
mpn/x86/atom/aorrlsh1_n.asm
mpn/x86/atom/aorrlsh2_n.asm
mpn/x86/atom/aorrlshC_n.asm
mpn/x86/atom/aors_n.asm
mpn/x86/atom/aorslshC_n.asm
mpn/x86/atom/bdiv_q_1.asm
mpn/x86/atom/cnd_add_n.asm [new file with mode: 0644]
mpn/x86/atom/cnd_sub_n.asm [new file with mode: 0644]
mpn/x86/atom/dive_1.asm
mpn/x86/atom/gmp-mparam.h
mpn/x86/atom/logops_n.asm
mpn/x86/atom/lshift.asm
mpn/x86/atom/lshiftc.asm
mpn/x86/atom/mmx/copyd.asm
mpn/x86/atom/mmx/copyi.asm
mpn/x86/atom/mmx/hamdist.asm
mpn/x86/atom/mod_34lsub1.asm
mpn/x86/atom/mode1o.asm
mpn/x86/atom/rshift.asm
mpn/x86/atom/sse2/aorsmul_1.asm
mpn/x86/atom/sse2/bdiv_dbm1c.asm
mpn/x86/atom/sse2/divrem_1.asm
mpn/x86/atom/sse2/mod_1_1.asm
mpn/x86/atom/sse2/mod_1_4.asm
mpn/x86/atom/sse2/mul_1.asm
mpn/x86/atom/sse2/mul_basecase.asm
mpn/x86/atom/sse2/popcount.asm
mpn/x86/atom/sse2/sqr_basecase.asm
mpn/x86/atom/sublsh1_n.asm
mpn/x86/atom/sublsh2_n.asm
mpn/x86/bd1/gmp-mparam.h [new file with mode: 0644]
mpn/x86/bd2/gmp-mparam.h [new file with mode: 0644]
mpn/x86/bdiv_dbm1c.asm
mpn/x86/bdiv_q_1.asm
mpn/x86/bobcat/gmp-mparam.h
mpn/x86/cnd_aors_n.asm [new file with mode: 0644]
mpn/x86/copyd.asm
mpn/x86/copyi.asm
mpn/x86/core2/gmp-mparam.h
mpn/x86/coreihwl/gmp-mparam.h [new file with mode: 0644]
mpn/x86/coreinhm/gmp-mparam.h
mpn/x86/coreisbr/gmp-mparam.h
mpn/x86/darwin.m4
mpn/x86/dive_1.asm
mpn/x86/divrem_1.asm
mpn/x86/divrem_2.asm
mpn/x86/fat/com.c
mpn/x86/fat/fat.c
mpn/x86/fat/fat_entry.asm
mpn/x86/fat/gcd_1.c
mpn/x86/fat/gmp-mparam.h
mpn/x86/fat/lshiftc.c
mpn/x86/fat/mod_1.c
mpn/x86/fat/mod_1_1.c
mpn/x86/fat/mod_1_2.c
mpn/x86/fat/mod_1_4.c
mpn/x86/fat/mode1o.c
mpn/x86/fat/mullo_basecase.c
mpn/x86/fat/redc_1.c
mpn/x86/fat/redc_2.c
mpn/x86/geode/gmp-mparam.h
mpn/x86/gmp-mparam.h
mpn/x86/i486/gmp-mparam.h
mpn/x86/k10/gmp-mparam.h
mpn/x86/k6/README
mpn/x86/k6/aors_n.asm
mpn/x86/k6/aorsmul_1.asm
mpn/x86/k6/cross.pl
mpn/x86/k6/divrem_1.asm
mpn/x86/k6/gcd_1.asm
mpn/x86/k6/gmp-mparam.h
mpn/x86/k6/k62mmx/copyd.asm
mpn/x86/k6/k62mmx/lshift.asm
mpn/x86/k6/k62mmx/rshift.asm
mpn/x86/k6/mmx/com.asm
mpn/x86/k6/mmx/dive_1.asm
mpn/x86/k6/mmx/logops_n.asm
mpn/x86/k6/mmx/lshift.asm
mpn/x86/k6/mmx/popham.asm
mpn/x86/k6/mmx/rshift.asm
mpn/x86/k6/mod_34lsub1.asm
mpn/x86/k6/mode1o.asm
mpn/x86/k6/mul_1.asm
mpn/x86/k6/mul_basecase.asm
mpn/x86/k6/pre_mod_1.asm
mpn/x86/k6/sqr_basecase.asm
mpn/x86/k7/README
mpn/x86/k7/addlsh1_n.asm
mpn/x86/k7/aors_n.asm
mpn/x86/k7/aorsmul_1.asm
mpn/x86/k7/bdiv_q_1.asm
mpn/x86/k7/dive_1.asm
mpn/x86/k7/gcd_1.asm
mpn/x86/k7/gmp-mparam.h
mpn/x86/k7/invert_limb.asm
mpn/x86/k7/mmx/com.asm
mpn/x86/k7/mmx/copyd.asm
mpn/x86/k7/mmx/copyi.asm
mpn/x86/k7/mmx/divrem_1.asm
mpn/x86/k7/mmx/lshift.asm
mpn/x86/k7/mmx/popham.asm
mpn/x86/k7/mmx/rshift.asm
mpn/x86/k7/mod_1_1.asm
mpn/x86/k7/mod_1_4.asm
mpn/x86/k7/mod_34lsub1.asm
mpn/x86/k7/mode1o.asm
mpn/x86/k7/mul_1.asm
mpn/x86/k7/mul_basecase.asm
mpn/x86/k7/sqr_basecase.asm
mpn/x86/k7/sublsh1_n.asm
mpn/x86/k8/gmp-mparam.h
mpn/x86/lshift.asm
mpn/x86/mmx/sec_tabselect.asm [new file with mode: 0644]
mpn/x86/mod_34lsub1.asm
mpn/x86/mul_1.asm
mpn/x86/mul_basecase.asm
mpn/x86/nano/gmp-mparam.h
mpn/x86/p6/README
mpn/x86/p6/aors_n.asm
mpn/x86/p6/aorsmul_1.asm
mpn/x86/p6/bdiv_q_1.asm
mpn/x86/p6/copyd.asm
mpn/x86/p6/dive_1.asm
mpn/x86/p6/gcd_1.asm
mpn/x86/p6/gmp-mparam.h
mpn/x86/p6/lshsub_n.asm
mpn/x86/p6/mmx/divrem_1.asm
mpn/x86/p6/mmx/gmp-mparam.h
mpn/x86/p6/mmx/lshift.asm
mpn/x86/p6/mmx/popham.asm
mpn/x86/p6/mmx/rshift.asm
mpn/x86/p6/mod_34lsub1.asm
mpn/x86/p6/mode1o.asm
mpn/x86/p6/mul_basecase.asm
mpn/x86/p6/p3mmx/popham.asm
mpn/x86/p6/sqr_basecase.asm
mpn/x86/p6/sse2/addmul_1.asm
mpn/x86/p6/sse2/gmp-mparam.h
mpn/x86/p6/sse2/mod_1_1.asm
mpn/x86/p6/sse2/mod_1_4.asm
mpn/x86/p6/sse2/mul_1.asm
mpn/x86/p6/sse2/mul_basecase.asm
mpn/x86/p6/sse2/popcount.asm
mpn/x86/p6/sse2/sqr_basecase.asm
mpn/x86/p6/sse2/submul_1.asm
mpn/x86/pentium/README
mpn/x86/pentium/aors_n.asm
mpn/x86/pentium/aorsmul_1.asm
mpn/x86/pentium/bdiv_q_1.asm
mpn/x86/pentium/com.asm
mpn/x86/pentium/copyd.asm
mpn/x86/pentium/copyi.asm
mpn/x86/pentium/dive_1.asm
mpn/x86/pentium/gmp-mparam.h
mpn/x86/pentium/hamdist.asm
mpn/x86/pentium/logops_n.asm
mpn/x86/pentium/lshift.asm
mpn/x86/pentium/mmx/gmp-mparam.h
mpn/x86/pentium/mmx/hamdist.asm
mpn/x86/pentium/mmx/lshift.asm
mpn/x86/pentium/mmx/mul_1.asm
mpn/x86/pentium/mmx/rshift.asm
mpn/x86/pentium/mod_34lsub1.asm
mpn/x86/pentium/mode1o.asm
mpn/x86/pentium/mul_1.asm
mpn/x86/pentium/mul_2.asm
mpn/x86/pentium/mul_basecase.asm
mpn/x86/pentium/popcount.asm
mpn/x86/pentium/rshift.asm
mpn/x86/pentium/sqr_basecase.asm
mpn/x86/pentium4/README
mpn/x86/pentium4/copyd.asm
mpn/x86/pentium4/copyi.asm
mpn/x86/pentium4/mmx/lshift.asm
mpn/x86/pentium4/mmx/popham.asm
mpn/x86/pentium4/mmx/rshift.asm
mpn/x86/pentium4/sse2/add_n.asm
mpn/x86/pentium4/sse2/addlsh1_n.asm
mpn/x86/pentium4/sse2/addmul_1.asm
mpn/x86/pentium4/sse2/bdiv_dbm1c.asm
mpn/x86/pentium4/sse2/bdiv_q_1.asm
mpn/x86/pentium4/sse2/cnd_add_n.asm [new file with mode: 0644]
mpn/x86/pentium4/sse2/cnd_sub_n.asm [new file with mode: 0644]
mpn/x86/pentium4/sse2/dive_1.asm
mpn/x86/pentium4/sse2/divrem_1.asm
mpn/x86/pentium4/sse2/gmp-mparam.h
mpn/x86/pentium4/sse2/mod_1_1.asm
mpn/x86/pentium4/sse2/mod_1_4.asm
mpn/x86/pentium4/sse2/mod_34lsub1.asm
mpn/x86/pentium4/sse2/mode1o.asm
mpn/x86/pentium4/sse2/mul_1.asm
mpn/x86/pentium4/sse2/mul_basecase.asm
mpn/x86/pentium4/sse2/popcount.asm
mpn/x86/pentium4/sse2/rsh1add_n.asm
mpn/x86/pentium4/sse2/sqr_basecase.asm
mpn/x86/pentium4/sse2/sub_n.asm
mpn/x86/pentium4/sse2/submul_1.asm
mpn/x86/rshift.asm
mpn/x86/sec_tabselect.asm [new file with mode: 0644]
mpn/x86/sqr_basecase.asm
mpn/x86/t-zdisp.sh
mpn/x86/t-zdisp2.pl
mpn/x86/tabselect.asm [deleted file]
mpn/x86/udiv.asm
mpn/x86/umul.asm
mpn/x86/x86-defs.m4
mpn/x86_64/README
mpn/x86_64/addaddmul_1msb0.asm
mpn/x86_64/addmul_2.asm
mpn/x86_64/aorrlsh1_n.asm
mpn/x86_64/aorrlsh2_n.asm
mpn/x86_64/aorrlshC_n.asm
mpn/x86_64/aorrlsh_n.asm
mpn/x86_64/aors_err1_n.asm
mpn/x86_64/aors_err2_n.asm
mpn/x86_64/aors_err3_n.asm
mpn/x86_64/aors_n.asm
mpn/x86_64/aorscnd_n.asm [deleted file]
mpn/x86_64/aorsmul_1.asm
mpn/x86_64/atom/addmul_2.asm [new file with mode: 0644]
mpn/x86_64/atom/aorrlsh1_n.asm
mpn/x86_64/atom/aorrlsh2_n.asm
mpn/x86_64/atom/aors_n.asm
mpn/x86_64/atom/aorsmul_1.asm [new file with mode: 0644]
mpn/x86_64/atom/com.asm [new file with mode: 0644]
mpn/x86_64/atom/copyd.asm
mpn/x86_64/atom/copyi.asm
mpn/x86_64/atom/dive_1.asm
mpn/x86_64/atom/gmp-mparam.h
mpn/x86_64/atom/lshift.asm
mpn/x86_64/atom/lshiftc.asm
mpn/x86_64/atom/mul_1.asm [new file with mode: 0644]
mpn/x86_64/atom/mul_2.asm [new file with mode: 0644]
mpn/x86_64/atom/popcount.asm
mpn/x86_64/atom/redc_1.asm [new file with mode: 0644]
mpn/x86_64/atom/rsh1aors_n.asm
mpn/x86_64/atom/rshift.asm
mpn/x86_64/atom/sublsh1_n.asm
mpn/x86_64/bd1/README [new file with mode: 0644]
mpn/x86_64/bd1/aorrlsh1_n.asm [new file with mode: 0644]
mpn/x86_64/bd1/aorsmul_1.asm
mpn/x86_64/bd1/com.asm [new file with mode: 0644]
mpn/x86_64/bd1/copyd.asm [new file with mode: 0644]
mpn/x86_64/bd1/copyi.asm [new file with mode: 0644]
mpn/x86_64/bd1/gcd_1.asm
mpn/x86_64/bd1/gmp-mparam.h
mpn/x86_64/bd1/hamdist.asm
mpn/x86_64/bd1/mul_1.asm
mpn/x86_64/bd1/mul_2.asm [new file with mode: 0644]
mpn/x86_64/bd1/mul_basecase.asm [new file with mode: 0644]
mpn/x86_64/bd1/popcount.asm
mpn/x86_64/bd1/sec_tabselect.asm [new file with mode: 0644]
mpn/x86_64/bd1/sublsh1_n.asm [new file with mode: 0644]
mpn/x86_64/bd2/gmp-mparam.h [new file with mode: 0644]
mpn/x86_64/bdiv_dbm1c.asm
mpn/x86_64/bdiv_q_1.asm
mpn/x86_64/bobcat/aors_n.asm [new file with mode: 0644]
mpn/x86_64/bobcat/aorsmul_1.asm
mpn/x86_64/bobcat/copyd.asm
mpn/x86_64/bobcat/copyi.asm
mpn/x86_64/bobcat/gmp-mparam.h
mpn/x86_64/bobcat/mul_1.asm
mpn/x86_64/bobcat/mul_basecase.asm
mpn/x86_64/bobcat/redc_1.asm [new file with mode: 0644]
mpn/x86_64/bobcat/sqr_basecase.asm
mpn/x86_64/cnd_aors_n.asm [new file with mode: 0644]
mpn/x86_64/com.asm
mpn/x86_64/copyd.asm
mpn/x86_64/copyi.asm
mpn/x86_64/core2/aorrlsh1_n.asm
mpn/x86_64/core2/aorrlsh2_n.asm
mpn/x86_64/core2/aorrlsh_n.asm
mpn/x86_64/core2/aors_err1_n.asm
mpn/x86_64/core2/aors_n.asm
mpn/x86_64/core2/aorsmul_1.asm
mpn/x86_64/core2/copyd.asm
mpn/x86_64/core2/copyi.asm
mpn/x86_64/core2/divrem_1.asm
mpn/x86_64/core2/gcd_1.asm
mpn/x86_64/core2/gmp-mparam.h
mpn/x86_64/core2/lshift.asm
mpn/x86_64/core2/lshiftc.asm
mpn/x86_64/core2/mul_basecase.asm [new file with mode: 0644]
mpn/x86_64/core2/mullo_basecase.asm [new file with mode: 0644]
mpn/x86_64/core2/popcount.asm
mpn/x86_64/core2/redc_1.asm [new file with mode: 0644]
mpn/x86_64/core2/rsh1aors_n.asm
mpn/x86_64/core2/rshift.asm
mpn/x86_64/core2/sec_tabselect.asm [new file with mode: 0644]
mpn/x86_64/core2/sqr_basecase.asm [new file with mode: 0644]
mpn/x86_64/core2/sublsh1_n.asm
mpn/x86_64/core2/sublsh2_n.asm
mpn/x86_64/core2/sublshC_n.asm
mpn/x86_64/coreihwl/addmul_2.asm [new file with mode: 0644]
mpn/x86_64/coreihwl/aorsmul_1.asm [new file with mode: 0644]
mpn/x86_64/coreihwl/gmp-mparam.h [new file with mode: 0644]
mpn/x86_64/coreihwl/mul_1.asm [new file with mode: 0644]
mpn/x86_64/coreihwl/mul_2.asm [new file with mode: 0644]
mpn/x86_64/coreihwl/mul_basecase.asm [new file with mode: 0644]
mpn/x86_64/coreihwl/mullo_basecase.asm [new file with mode: 0644]
mpn/x86_64/coreihwl/redc_1.asm [new file with mode: 0644]
mpn/x86_64/coreihwl/sqr_basecase.asm [new file with mode: 0644]
mpn/x86_64/coreinhm/aorrlsh_n.asm
mpn/x86_64/coreinhm/aorsmul_1.asm [new file with mode: 0644]
mpn/x86_64/coreinhm/gmp-mparam.h
mpn/x86_64/coreinhm/hamdist.asm
mpn/x86_64/coreinhm/popcount.asm
mpn/x86_64/coreinhm/redc_1.asm [new file with mode: 0644]
mpn/x86_64/coreinhm/sec_tabselect.asm [new file with mode: 0644]
mpn/x86_64/coreisbr/addmul_2.asm
mpn/x86_64/coreisbr/aorrlsh1_n.asm
mpn/x86_64/coreisbr/aorrlsh2_n.asm
mpn/x86_64/coreisbr/aorrlshC_n.asm
mpn/x86_64/coreisbr/aorrlsh_n.asm
mpn/x86_64/coreisbr/aors_n.asm
mpn/x86_64/coreisbr/aorsmul_1.asm
mpn/x86_64/coreisbr/divrem_1.asm [new file with mode: 0644]
mpn/x86_64/coreisbr/gmp-mparam.h
mpn/x86_64/coreisbr/lshift.asm
mpn/x86_64/coreisbr/lshiftc.asm
mpn/x86_64/coreisbr/mul_1.asm
mpn/x86_64/coreisbr/mul_2.asm [new file with mode: 0644]
mpn/x86_64/coreisbr/mul_basecase.asm [new file with mode: 0644]
mpn/x86_64/coreisbr/mullo_basecase.asm [new file with mode: 0644]
mpn/x86_64/coreisbr/popcount.asm [new file with mode: 0644]
mpn/x86_64/coreisbr/redc_1.asm [new file with mode: 0644]
mpn/x86_64/coreisbr/rsh1aors_n.asm
mpn/x86_64/coreisbr/rshift.asm
mpn/x86_64/coreisbr/sec_tabselect.asm [new file with mode: 0644]
mpn/x86_64/coreisbr/sqr_basecase.asm [new file with mode: 0644]
mpn/x86_64/darwin.m4
mpn/x86_64/div_qr_1n_pi1.asm [new file with mode: 0644]
mpn/x86_64/div_qr_2n_pi1.asm
mpn/x86_64/div_qr_2u_pi1.asm
mpn/x86_64/dive_1.asm
mpn/x86_64/divrem_1.asm
mpn/x86_64/divrem_2.asm
mpn/x86_64/dos64.m4
mpn/x86_64/fastavx/copyd.asm [new file with mode: 0644]
mpn/x86_64/fastavx/copyi.asm [new file with mode: 0644]
mpn/x86_64/fastsse/README
mpn/x86_64/fastsse/com-palignr.asm [new file with mode: 0644]
mpn/x86_64/fastsse/com.asm
mpn/x86_64/fastsse/copyd-palignr.asm
mpn/x86_64/fastsse/copyd.asm
mpn/x86_64/fastsse/copyi-palignr.asm
mpn/x86_64/fastsse/copyi.asm
mpn/x86_64/fastsse/lshift-movdqu2.asm
mpn/x86_64/fastsse/lshift.asm
mpn/x86_64/fastsse/lshiftc-movdqu2.asm
mpn/x86_64/fastsse/lshiftc.asm
mpn/x86_64/fastsse/rshift-movdqu2.asm
mpn/x86_64/fastsse/sec_tabselect.asm [new file with mode: 0644]
mpn/x86_64/fat/fat.c
mpn/x86_64/fat/fat_entry.asm
mpn/x86_64/fat/gmp-mparam.h
mpn/x86_64/fat/mod_1.c
mpn/x86_64/fat/mul_basecase.c [new file with mode: 0644]
mpn/x86_64/fat/mullo_basecase.c [new file with mode: 0644]
mpn/x86_64/fat/redc_1.c [new file with mode: 0644]
mpn/x86_64/fat/redc_2.c
mpn/x86_64/fat/sqr_basecase.c [new file with mode: 0644]
mpn/x86_64/gcd_1.asm
mpn/x86_64/gmp-mparam.h
mpn/x86_64/invert_limb.asm
mpn/x86_64/invert_limb_table.asm
mpn/x86_64/k10/gcd_1.asm
mpn/x86_64/k10/gmp-mparam.h
mpn/x86_64/k10/hamdist.asm
mpn/x86_64/k10/lshift.asm
mpn/x86_64/k10/lshiftc.asm
mpn/x86_64/k10/popcount.asm
mpn/x86_64/k10/rshift.asm
mpn/x86_64/k10/sec_tabselect.asm [new file with mode: 0644]
mpn/x86_64/k8/aorrlsh_n.asm
mpn/x86_64/k8/div_qr_1n_pi1.asm [new file with mode: 0644]
mpn/x86_64/k8/gmp-mparam.h
mpn/x86_64/k8/mul_basecase.asm [new file with mode: 0644]
mpn/x86_64/k8/mullo_basecase.asm [new file with mode: 0644]
mpn/x86_64/k8/mulmid_basecase.asm [new file with mode: 0644]
mpn/x86_64/k8/redc_1.asm [new file with mode: 0644]
mpn/x86_64/k8/sqr_basecase.asm [new file with mode: 0644]
mpn/x86_64/logops_n.asm
mpn/x86_64/lshift.asm
mpn/x86_64/lshiftc.asm
mpn/x86_64/lshsub_n.asm
mpn/x86_64/missing-call.m4 [new file with mode: 0644]
mpn/x86_64/missing-inline.m4 [new file with mode: 0644]
mpn/x86_64/missing.asm [new file with mode: 0644]
mpn/x86_64/mod_1_1.asm
mpn/x86_64/mod_1_2.asm
mpn/x86_64/mod_1_4.asm
mpn/x86_64/mod_34lsub1.asm
mpn/x86_64/mode1o.asm
mpn/x86_64/mul_1.asm
mpn/x86_64/mul_2.asm
mpn/x86_64/mul_basecase.asm [deleted file]
mpn/x86_64/mullo_basecase.asm [deleted file]
mpn/x86_64/mulmid_basecase.asm [deleted file]
mpn/x86_64/mulx/adx/addmul_1.asm [new file with mode: 0644]
mpn/x86_64/mulx/aorsmul_1.asm [new file with mode: 0644]
mpn/x86_64/mulx/mul_1.asm [new file with mode: 0644]
mpn/x86_64/nano/copyd.asm
mpn/x86_64/nano/copyi.asm
mpn/x86_64/nano/dive_1.asm
mpn/x86_64/nano/gcd_1.asm
mpn/x86_64/nano/gmp-mparam.h
mpn/x86_64/nano/popcount.asm
mpn/x86_64/pentium4/aors_n.asm
mpn/x86_64/pentium4/aorslsh1_n.asm
mpn/x86_64/pentium4/aorslsh2_n.asm
mpn/x86_64/pentium4/aorslshC_n.asm
mpn/x86_64/pentium4/gmp-mparam.h
mpn/x86_64/pentium4/lshift.asm
mpn/x86_64/pentium4/lshiftc.asm
mpn/x86_64/pentium4/mod_34lsub1.asm
mpn/x86_64/pentium4/popcount.asm
mpn/x86_64/pentium4/rsh1aors_n.asm
mpn/x86_64/pentium4/rshift.asm
mpn/x86_64/pentium4/sec_tabselect.asm [new file with mode: 0644]
mpn/x86_64/popham.asm
mpn/x86_64/redc_1.asm [deleted file]
mpn/x86_64/rsh1aors_n.asm
mpn/x86_64/rshift.asm
mpn/x86_64/sec_tabselect.asm [new file with mode: 0644]
mpn/x86_64/sqr_basecase.asm [deleted file]
mpn/x86_64/sqr_diag_addlsh1.asm [new file with mode: 0644]
mpn/x86_64/sublsh1_n.asm
mpn/x86_64/tabselect.asm [deleted file]
mpn/x86_64/x86_64-defs.m4
mpn/z8000/README [deleted file]
mpn/z8000/add_n.s [deleted file]
mpn/z8000/gmp-mparam.h [deleted file]
mpn/z8000/mul_1.s [deleted file]
mpn/z8000/sub_n.s [deleted file]
mpq/Makefile.am
mpq/Makefile.in
mpq/abs.c
mpq/aors.c
mpq/canonicalize.c
mpq/clear.c
mpq/clears.c
mpq/cmp.c
mpq/cmp_si.c
mpq/cmp_ui.c
mpq/div.c
mpq/equal.c
mpq/get_d.c
mpq/get_den.c
mpq/get_num.c
mpq/get_str.c
mpq/init.c
mpq/inits.c
mpq/inp_str.c
mpq/inv.c
mpq/md_2exp.c
mpq/mul.c
mpq/neg.c
mpq/out_str.c
mpq/set.c
mpq/set_d.c
mpq/set_den.c
mpq/set_f.c
mpq/set_num.c
mpq/set_si.c
mpq/set_str.c
mpq/set_ui.c
mpq/set_z.c
mpq/swap.c
mpz/2fac_ui.c
mpz/Makefile.am
mpz/Makefile.in
mpz/abs.c
mpz/add.c
mpz/add_ui.c
mpz/and.c
mpz/aors.h
mpz/aors_ui.h
mpz/aorsmul.c
mpz/aorsmul_i.c
mpz/array_init.c
mpz/bin_ui.c
mpz/bin_uiui.c
mpz/cdiv_q.c
mpz/cdiv_q_ui.c
mpz/cdiv_qr.c
mpz/cdiv_qr_ui.c
mpz/cdiv_r.c
mpz/cdiv_r_ui.c
mpz/cdiv_ui.c
mpz/cfdiv_q_2exp.c
mpz/cfdiv_r_2exp.c
mpz/clear.c
mpz/clears.c
mpz/clrbit.c
mpz/cmp.c
mpz/cmp_d.c
mpz/cmp_si.c
mpz/cmp_ui.c
mpz/cmpabs.c
mpz/cmpabs_d.c
mpz/cmpabs_ui.c
mpz/com.c
mpz/combit.c
mpz/cong.c
mpz/cong_2exp.c
mpz/cong_ui.c
mpz/dive_ui.c
mpz/divegcd.c
mpz/divexact.c
mpz/divis.c
mpz/divis_2exp.c
mpz/divis_ui.c
mpz/dump.c
mpz/export.c
mpz/fac_ui.c
mpz/fdiv_q.c
mpz/fdiv_q_ui.c
mpz/fdiv_qr.c
mpz/fdiv_qr_ui.c
mpz/fdiv_r.c
mpz/fdiv_r_ui.c
mpz/fdiv_ui.c
mpz/fib2_ui.c
mpz/fib_ui.c
mpz/fits_s.h
mpz/fits_sint.c
mpz/fits_slong.c
mpz/fits_sshort.c
mpz/fits_uint.c
mpz/fits_ulong.c
mpz/fits_ushort.c
mpz/gcd.c
mpz/gcd_ui.c
mpz/gcdext.c
mpz/get_d.c
mpz/get_d_2exp.c
mpz/get_si.c
mpz/get_str.c
mpz/get_ui.c
mpz/getlimbn.c
mpz/hamdist.c
mpz/import.c
mpz/init.c
mpz/init2.c
mpz/inits.c
mpz/inp_raw.c
mpz/inp_str.c
mpz/invert.c
mpz/ior.c
mpz/iset.c
mpz/iset_d.c
mpz/iset_si.c
mpz/iset_str.c
mpz/iset_ui.c
mpz/jacobi.c
mpz/kronsz.c
mpz/kronuz.c
mpz/kronzs.c
mpz/kronzu.c
mpz/lcm.c
mpz/lcm_ui.c
mpz/limbs_finish.c [new file with mode: 0644]
mpz/limbs_modify.c [new file with mode: 0644]
mpz/limbs_read.c [new file with mode: 0644]
mpz/limbs_write.c [new file with mode: 0644]
mpz/lucnum2_ui.c
mpz/lucnum_ui.c
mpz/mfac_uiui.c
mpz/millerrabin.c
mpz/mod.c
mpz/mul.c
mpz/mul_2exp.c
mpz/mul_i.h
mpz/mul_si.c
mpz/mul_ui.c
mpz/n_pow_ui.c
mpz/neg.c
mpz/nextprime.c
mpz/oddfac_1.c
mpz/out_raw.c
mpz/out_str.c
mpz/perfpow.c
mpz/perfsqr.c
mpz/popcount.c
mpz/pow_ui.c
mpz/powm.c
mpz/powm_sec.c
mpz/powm_ui.c
mpz/pprime_p.c
mpz/primorial_ui.c
mpz/prodlimbs.c
mpz/random.c
mpz/random2.c
mpz/realloc.c
mpz/realloc2.c
mpz/remove.c
mpz/roinit_n.c [new file with mode: 0644]
mpz/root.c
mpz/rootrem.c
mpz/rrandomb.c
mpz/scan0.c
mpz/scan1.c
mpz/set.c
mpz/set_d.c
mpz/set_f.c
mpz/set_q.c
mpz/set_si.c
mpz/set_str.c
mpz/set_ui.c
mpz/setbit.c
mpz/size.c
mpz/sizeinbase.c
mpz/sqrt.c
mpz/sqrtrem.c
mpz/sub.c
mpz/sub_ui.c
mpz/swap.c
mpz/tdiv_q.c
mpz/tdiv_q_2exp.c
mpz/tdiv_q_ui.c
mpz/tdiv_qr.c
mpz/tdiv_qr_ui.c
mpz/tdiv_r.c
mpz/tdiv_r_2exp.c
mpz/tdiv_r_ui.c
mpz/tdiv_ui.c
mpz/tstbit.c
mpz/ui_pow_ui.c
mpz/ui_sub.c
mpz/urandomb.c
mpz/urandomm.c
mpz/xor.c
nextprime.c
primesieve.c
printf/Makefile.am
printf/Makefile.in
printf/asprintf.c
printf/asprntffuns.c
printf/doprnt.c
printf/doprntf.c
printf/doprnti.c
printf/fprintf.c
printf/obprintf.c
printf/obprntffuns.c
printf/obvprintf.c
printf/printf.c
printf/printffuns.c
printf/repl-vsnprintf.c
printf/snprintf.c
printf/snprntffuns.c
printf/sprintf.c
printf/sprintffuns.c
printf/vasprintf.c
printf/vfprintf.c
printf/vprintf.c
printf/vsnprintf.c
printf/vsprintf.c
rand/Makefile.am
rand/Makefile.in
rand/rand.c
rand/randbui.c
rand/randclr.c
rand/randdef.c
rand/randiset.c
rand/randlc2s.c
rand/randlc2x.c
rand/randmt.c
rand/randmt.h
rand/randmts.c
rand/randmui.c
rand/rands.c
rand/randsd.c
rand/randsdui.c
scanf/Makefile.am
scanf/Makefile.in
scanf/doscan.c
scanf/fscanf.c
scanf/fscanffuns.c
scanf/scanf.c
scanf/sscanf.c
scanf/sscanffuns.c
scanf/vfscanf.c
scanf/vscanf.c
scanf/vsscanf.c
tal-debug.c
tal-notreent.c
tal-reent.c
tests/Makefile.am
tests/Makefile.in
tests/amd64call.asm
tests/amd64check.c
tests/arm32call.asm
tests/arm32check.c
tests/cxx/Makefile.am
tests/cxx/Makefile.in
tests/cxx/clocale.c
tests/cxx/t-assign.cc
tests/cxx/t-binary.cc
tests/cxx/t-cast.cc
tests/cxx/t-constr.cc
tests/cxx/t-cxx11.cc
tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc
tests/cxx/t-headers.cc
tests/cxx/t-iostream.cc
tests/cxx/t-istream.cc
tests/cxx/t-locale.cc
tests/cxx/t-misc.cc
tests/cxx/t-mix.cc
tests/cxx/t-ops.cc
tests/cxx/t-ops2.cc
tests/cxx/t-ops3.cc
tests/cxx/t-ostream.cc
tests/cxx/t-prec.cc
tests/cxx/t-rand.cc
tests/cxx/t-ternary.cc
tests/cxx/t-unary.cc
tests/devel/Makefile.am
tests/devel/Makefile.in
tests/devel/README
tests/devel/anymul_1.c
tests/devel/aors_n.c
tests/devel/copy.c
tests/devel/divmod_1.c
tests/devel/divrem.c
tests/devel/logops_n.c
tests/devel/shift.c
tests/devel/try.c
tests/devel/tst-addsub.c
tests/memory.c
tests/misc.c
tests/misc/Makefile.am
tests/misc/Makefile.in
tests/misc/t-locale.c
tests/misc/t-printf.c
tests/misc/t-scanf.c
tests/mpf/Makefile.am
tests/mpf/Makefile.in
tests/mpf/reuse.c
tests/mpf/t-add.c
tests/mpf/t-cmp_d.c
tests/mpf/t-cmp_si.c
tests/mpf/t-conv.c
tests/mpf/t-div.c
tests/mpf/t-dm2exp.c
tests/mpf/t-eq.c
tests/mpf/t-fits.c
tests/mpf/t-get_d.c
tests/mpf/t-get_d_2exp.c
tests/mpf/t-get_si.c
tests/mpf/t-get_ui.c
tests/mpf/t-gsprec.c
tests/mpf/t-inp_str.c
tests/mpf/t-int_p.c
tests/mpf/t-mul_ui.c
tests/mpf/t-muldiv.c
tests/mpf/t-set.c
tests/mpf/t-set_q.c
tests/mpf/t-set_si.c
tests/mpf/t-set_ui.c
tests/mpf/t-sqrt.c
tests/mpf/t-sqrt_ui.c
tests/mpf/t-sub.c
tests/mpf/t-trunc.c
tests/mpf/t-ui_div.c
tests/mpn/Makefile.am
tests/mpn/Makefile.in
tests/mpn/logic.c
tests/mpn/t-aors_1.c
tests/mpn/t-asmtype.c
tests/mpn/t-bdiv.c
tests/mpn/t-broot.c
tests/mpn/t-brootinv.c
tests/mpn/t-div.c
tests/mpn/t-divrem_1.c
tests/mpn/t-fat.c
tests/mpn/t-get_d.c
tests/mpn/t-hgcd.c
tests/mpn/t-hgcd_appr.c
tests/mpn/t-instrument.c
tests/mpn/t-invert.c
tests/mpn/t-iord_u.c
tests/mpn/t-matrix22.c
tests/mpn/t-minvert.c [new file with mode: 0644]
tests/mpn/t-mod_1.c
tests/mpn/t-mp_bases.c
tests/mpn/t-mul.c
tests/mpn/t-mullo.c
tests/mpn/t-mulmid.c
tests/mpn/t-mulmod_bnm1.c
tests/mpn/t-perfsqr.c
tests/mpn/t-scan.c
tests/mpn/t-sizeinbase.c [new file with mode: 0644]
tests/mpn/t-sqrmod_bnm1.c
tests/mpn/t-toom6-sqr.c
tests/mpn/t-toom8-sqr.c
tests/mpn/toom-shared.h
tests/mpn/toom-sqr-shared.h
tests/mpq/Makefile.am
tests/mpq/Makefile.in
tests/mpq/io.c
tests/mpq/reuse.c
tests/mpq/t-aors.c
tests/mpq/t-cmp.c
tests/mpq/t-cmp_si.c
tests/mpq/t-cmp_ui.c
tests/mpq/t-equal.c
tests/mpq/t-get_d.c
tests/mpq/t-get_str.c
tests/mpq/t-inp_str.c
tests/mpq/t-inv.c
tests/mpq/t-md_2exp.c
tests/mpq/t-set_f.c
tests/mpq/t-set_str.c
tests/mpz/Makefile.am
tests/mpz/Makefile.in
tests/mpz/bit.c
tests/mpz/convert.c
tests/mpz/dive.c
tests/mpz/dive_ui.c
tests/mpz/io.c
tests/mpz/logic.c
tests/mpz/reuse.c
tests/mpz/t-addsub.c
tests/mpz/t-aorsmul.c
tests/mpz/t-bin.c
tests/mpz/t-cdiv_ui.c
tests/mpz/t-cmp.c
tests/mpz/t-cmp_d.c
tests/mpz/t-cmp_si.c
tests/mpz/t-cong.c
tests/mpz/t-cong_2exp.c
tests/mpz/t-div_2exp.c
tests/mpz/t-divis.c
tests/mpz/t-divis_2exp.c
tests/mpz/t-export.c
tests/mpz/t-fac_ui.c
tests/mpz/t-fdiv.c
tests/mpz/t-fdiv_ui.c
tests/mpz/t-fib_ui.c
tests/mpz/t-fits.c
tests/mpz/t-gcd.c
tests/mpz/t-gcd_ui.c
tests/mpz/t-get_d.c
tests/mpz/t-get_d_2exp.c
tests/mpz/t-get_si.c
tests/mpz/t-hamdist.c
tests/mpz/t-import.c
tests/mpz/t-inp_str.c
tests/mpz/t-invert.c
tests/mpz/t-io_raw.c
tests/mpz/t-jac.c
tests/mpz/t-lcm.c
tests/mpz/t-limbs.c [new file with mode: 0644]
tests/mpz/t-lucnum_ui.c
tests/mpz/t-mfac_uiui.c
tests/mpz/t-mul.c
tests/mpz/t-mul_i.c
tests/mpz/t-nextprime.c
tests/mpz/t-oddeven.c
tests/mpz/t-perfpow.c
tests/mpz/t-perfsqr.c
tests/mpz/t-popcount.c
tests/mpz/t-pow.c
tests/mpz/t-powm.c
tests/mpz/t-powm_ui.c
tests/mpz/t-pprime_p.c
tests/mpz/t-primorial_ui.c
tests/mpz/t-remove.c
tests/mpz/t-root.c
tests/mpz/t-scan.c
tests/mpz/t-set_d.c
tests/mpz/t-set_f.c
tests/mpz/t-set_si.c
tests/mpz/t-set_str.c
tests/mpz/t-sizeinbase.c
tests/mpz/t-sqrtrem.c
tests/mpz/t-tdiv.c
tests/mpz/t-tdiv_ui.c
tests/rand/Makefile.am
tests/rand/Makefile.in
tests/rand/findlc.c
tests/rand/gen.c
tests/rand/gmpstat.h
tests/rand/spect.c
tests/rand/stat.c
tests/rand/statlib.c
tests/rand/t-iset.c
tests/rand/t-lc2exp.c
tests/rand/t-mt.c
tests/rand/t-rand.c
tests/rand/t-urbui.c
tests/rand/t-urmui.c
tests/rand/t-urndmm.c
tests/rand/zdiv_round.c
tests/refmpf.c
tests/refmpn.c
tests/refmpq.c
tests/refmpz.c
tests/spinner.c
tests/t-bswap.c
tests/t-constants.c
tests/t-count_zeros.c
tests/t-gmpmax.c
tests/t-hightomask.c
tests/t-modlinv.c
tests/t-parity.c
tests/t-popc.c
tests/t-sub.c
tests/tests.h
tests/trace.c
tests/x86call.asm
tests/x86check.c
tune/Makefile.am
tune/Makefile.in
tune/README
tune/alpha.asm
tune/common.c
tune/div_qr_1_tune.c [new file with mode: 0644]
tune/div_qr_1n_pi1_1.c [new file with mode: 0644]
tune/div_qr_1n_pi1_2.c [new file with mode: 0644]
tune/divrem1div.c
tune/divrem1inv.c
tune/divrem2div.c
tune/divrem2inv.c
tune/freq.c
tune/gcdext_double.c
tune/gcdext_single.c
tune/gcdextod.c
tune/gcdextos.c
tune/hgcd_appr_lehmer.c
tune/hgcd_lehmer.c
tune/hgcd_reduce_1.c
tune/hgcd_reduce_2.c
tune/hppa.asm
tune/hppa2.asm
tune/hppa2w.asm
tune/ia64.asm
tune/jacbase1.c
tune/jacbase2.c
tune/jacbase3.c
tune/jacbase4.c
tune/many.pl
tune/mod_1_1-1.c
tune/mod_1_1-2.c
tune/mod_1_div.c
tune/mod_1_inv.c
tune/modlinv.c
tune/noop.c
tune/pentium.asm
tune/powerpc.asm
tune/powerpc64.asm
tune/powm_mod.c
tune/powm_redc.c
tune/pre_divrem_1.c
tune/set_strb.c
tune/set_strp.c
tune/set_strs.c
tune/sparcv9.asm
tune/speed-ext.c
tune/speed.c
tune/speed.h
tune/time.c
tune/tune-gcd-p.c
tune/tuneup.c
tune/x86_64.asm
version.c
ylwrap

index 6328dc95d7af88ccec7170d0e410d458767b066d..473d74f590420e0f9091dfce47a468c3b8c7a484 100644 (file)
--- a/.gdbinit
+++ b/.gdbinit
@@ -1,19 +1,30 @@
 # Copyright 1999 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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 pz
diff --git a/AUTHORS b/AUTHORS
index e403b8316de1549f939a1811575af7282f98aef6..fbe298d61bcf6e9d747059923fce593bb9ced948 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,6 +1,6 @@
 Authors of GNU MP (in chronological order of initial contribution)
 
-Torbjörn Granlund      Main author
+Torbjörn Granlund     Main author
 
 John Amanatides                Original version of mpz/pprime_p.c
 
@@ -30,7 +30,7 @@ Pedro Gimeno          Mersenne Twister random generator, other random number
 
 Jason Moxham           Previous versions of mpz/fac_ui.c and gen-fac_ui.c
 
-Niels Möller           gen-jacobitab.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,
@@ -40,6 +40,7 @@ Niels M
                        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,
+                       sec_invert.c,
                        toom_eval_dgr3_pm1.c, toom_eval_dgr3_pm2.c,
                        toom_eval_pm1.c, toom_eval_pm2.c, toom_eval_pm2exp.c,
                        divexact.c, mod_1_1.c, div_qr_2.c,
@@ -77,3 +78,23 @@ David Harvey         mpn/generic/add_err1_n.c, add_err2_n.c,
 Martin Boij            mpn/generic/perfpow.c
 
 Marc Glisse            gmpxx.h improvements
+
+David Miller           mpn/sparc32/ultrasparct1/{addmul_1,mul_1,submul_1}.asm
+                       mpn/sparc64/ultrasparct3/{mul_1,addmul_1,submul_1}.asm
+                       mpn/sparc64/ultrasparct3/{add_n,sub_n}.asm
+                       mpn/sparc64/ultrasparct3/{popcount,hamdist}.asm
+                       mpn/sparc64/ultrasparct3/cnd_aors_n.asm
+                       mpn/sparc64/{rshift,lshift,lshiftc}.asm
+                       mpn/sparc64/tabselect.asm
+
+Mark Sofroniou         mpn/generic/mul_fft.c type cleanup.
+
+Ulrich Weigand         Changes to support powerpc64le:
+                       configure.ac, mpn/powerpc64/{elf,aix,darwin}.m4,
+                       mpn/powerpc32/{darwin,elf}.m4,
+                       mpn/powerpc64/mode64/{dive_1,divrem_1,divrem_2}.asm,
+                       mpn/powerpc64/mode64/{gcd_1,invert_limb,mode1o}.asm,
+                       mpn/powerpc64/mode64/{mod_1_1,mod_1_4}.asm,
+                       mpn/powerpc64/mode64/p7/gcd_1.asm,
+                       mpn/powerpc64/p6/{lshift,lshiftc,rshift}.asm,
+                       mpn/powerpc64/vmx/popcount.asm.
diff --git a/COPYING.LESSERv3 b/COPYING.LESSERv3
new file mode 100644 (file)
index 0000000..fc8a5de
--- /dev/null
@@ -0,0 +1,165 @@
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+  This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+  0. Additional Definitions. 
+
+  As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+  "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+  An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+  A "Combined Work" is a work produced by combining or linking an
+Application with the Library.  The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+  The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+  The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+  1. Exception to Section 3 of the GNU GPL.
+
+  You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+  2. Conveying Modified Versions.
+
+  If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+   a) under this License, provided that you make a good faith effort to
+   ensure that, in the event an Application does not supply the
+   function or data, the facility still operates, and performs
+   whatever part of its purpose remains meaningful, or
+
+   b) under the GNU GPL, with none of the additional permissions of
+   this License applicable to that copy.
+
+  3. Object Code Incorporating Material from Library Header Files.
+
+  The object code form of an Application may incorporate material from
+a header file that is part of the Library.  You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+   a) Give prominent notice with each copy of the object code that the
+   Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the object code with a copy of the GNU GPL and this license
+   document.
+
+  4. Combined Works.
+
+  You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+   a) Give prominent notice with each copy of the Combined Work that
+   the Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the Combined Work with a copy of the GNU GPL and this license
+   document.
+
+   c) For a Combined Work that displays copyright notices during
+   execution, include the copyright notice for the Library among
+   these notices, as well as a reference directing the user to the
+   copies of the GNU GPL and this license document.
+
+   d) Do one of the following:
+
+       0) Convey the Minimal Corresponding Source under the terms of this
+       License, and the Corresponding Application Code in a form
+       suitable for, and under terms that permit, the user to
+       recombine or relink the Application with a modified version of
+       the Linked Version to produce a modified Combined Work, in the
+       manner specified by section 6 of the GNU GPL for conveying
+       Corresponding Source.
+
+       1) Use a suitable shared library mechanism for linking with the
+       Library.  A suitable mechanism is one that (a) uses at run time
+       a copy of the Library already present on the user's computer
+       system, and (b) will operate properly with a modified version
+       of the Library that is interface-compatible with the Linked
+       Version. 
+
+   e) Provide Installation Information, but only if you would otherwise
+   be required to provide such information under section 6 of the
+   GNU GPL, and only to the extent that such information is
+   necessary to install and execute a modified version of the
+   Combined Work produced by recombining or relinking the
+   Application with a modified version of the Linked Version. (If
+   you use option 4d0, the Installation Information must accompany
+   the Minimal Corresponding Source and Corresponding Application
+   Code. If you use option 4d1, you must provide the Installation
+   Information in the manner specified by section 6 of the GNU GPL
+   for conveying Corresponding Source.)
+
+  5. Combined Libraries.
+
+  You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+   a) Accompany the combined library with a copy of the same work based
+   on the Library, uncombined with any other library facilities,
+   conveyed under the terms of this License.
+
+   b) Give prominent notice with the combined library that part of it
+   is a work based on the Library, and explaining where to find the
+   accompanying uncombined form of the same work.
+
+  6. Revised Versions of the GNU Lesser General Public License.
+
+  The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+  Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+  If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/COPYING.LIB b/COPYING.LIB
deleted file mode 100644 (file)
index fc8a5de..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-                  GNU LESSER GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
-  This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
-  0. Additional Definitions. 
-
-  As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
-  "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
-  An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
-  A "Combined Work" is a work produced by combining or linking an
-Application with the Library.  The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
-  The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
-  The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
-  1. Exception to Section 3 of the GNU GPL.
-
-  You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
-  2. Conveying Modified Versions.
-
-  If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
-   a) under this License, provided that you make a good faith effort to
-   ensure that, in the event an Application does not supply the
-   function or data, the facility still operates, and performs
-   whatever part of its purpose remains meaningful, or
-
-   b) under the GNU GPL, with none of the additional permissions of
-   this License applicable to that copy.
-
-  3. Object Code Incorporating Material from Library Header Files.
-
-  The object code form of an Application may incorporate material from
-a header file that is part of the Library.  You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
-   a) Give prominent notice with each copy of the object code that the
-   Library is used in it and that the Library and its use are
-   covered by this License.
-
-   b) Accompany the object code with a copy of the GNU GPL and this license
-   document.
-
-  4. Combined Works.
-
-  You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
-   a) Give prominent notice with each copy of the Combined Work that
-   the Library is used in it and that the Library and its use are
-   covered by this License.
-
-   b) Accompany the Combined Work with a copy of the GNU GPL and this license
-   document.
-
-   c) For a Combined Work that displays copyright notices during
-   execution, include the copyright notice for the Library among
-   these notices, as well as a reference directing the user to the
-   copies of the GNU GPL and this license document.
-
-   d) Do one of the following:
-
-       0) Convey the Minimal Corresponding Source under the terms of this
-       License, and the Corresponding Application Code in a form
-       suitable for, and under terms that permit, the user to
-       recombine or relink the Application with a modified version of
-       the Linked Version to produce a modified Combined Work, in the
-       manner specified by section 6 of the GNU GPL for conveying
-       Corresponding Source.
-
-       1) Use a suitable shared library mechanism for linking with the
-       Library.  A suitable mechanism is one that (a) uses at run time
-       a copy of the Library already present on the user's computer
-       system, and (b) will operate properly with a modified version
-       of the Library that is interface-compatible with the Linked
-       Version. 
-
-   e) Provide Installation Information, but only if you would otherwise
-   be required to provide such information under section 6 of the
-   GNU GPL, and only to the extent that such information is
-   necessary to install and execute a modified version of the
-   Combined Work produced by recombining or relinking the
-   Application with a modified version of the Linked Version. (If
-   you use option 4d0, the Installation Information must accompany
-   the Minimal Corresponding Source and Corresponding Application
-   Code. If you use option 4d1, you must provide the Installation
-   Information in the manner specified by section 6 of the GNU GPL
-   for conveying Corresponding Source.)
-
-  5. Combined Libraries.
-
-  You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
-   a) Accompany the combined library with a copy of the same work based
-   on the Library, uncombined with any other library facilities,
-   conveyed under the terms of this License.
-
-   b) Give prominent notice with the combined library that part of it
-   is a work based on the Library, and explaining where to find the
-   accompanying uncombined form of the same work.
-
-  6. Revised Versions of the GNU Lesser General Public License.
-
-  The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
-  Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
-  If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/COPYINGv2 b/COPYINGv2
new file mode 100644 (file)
index 0000000..d159169
--- /dev/null
+++ b/COPYINGv2
@@ -0,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of 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.
+
+    This program 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 a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/COPYINGv3 b/COPYINGv3
new file mode 100644 (file)
index 0000000..2a00065
--- /dev/null
+++ b/COPYINGv3
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program 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 a copy of the GNU General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<https://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<https://www.gnu.org/philosophy/why-not-lgpl.html>.
index 47a0df3ea9266b6f53cc0bcca9cc3b0f3f4aa4e2..540c025c51d60c90ee4fb1f64b246042e3b9278a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
-2013-09-29  Torbjorn Granlund  <tege@gmplib.org>
+2014-03-24  Torbjorn Granlund  <tege@gmplib.org>
 
-       * Version 5.1.3 released.
+       * Version 6.0.0 released.
+
+       * mpn: Update countless gmp-mparam.h files.
+
+2014-03-22  Torbjorn Granlund  <tege@gmplib.org>
 
        * Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*): Bump version info.
        * gmp-h.in: Bump version.
 
-2013-09-27  Niels Möller  <nisse@lysator.liu.se>
+2014-03-17  Torbjorn Granlund  <tege@gmplib.org>
+
+       * configure.ac: Remove clipper, i960, ns32k, pyr, a29k, z8000.
+       * mpn/clipper: Remove directory and all its files.
+       * mpn/i960: Likewise.
+       * mpn/ns32k: Likewise.
+       * mpn/pyr: Likewise.
+       * mpn/a29k: Likewise.
+       * mpn/z8000: Likewise.
+       * 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.
+       * mpn/x86_64/bd2/gmp-mparam.h: New file.
+
+2014-03-06  Niels Möller  <nisse@lysator.liu.se>
+
+       * tests/mpz/t-pprime_p.c (check_composites): New function.
+       (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
+       asserts.
+
+2014-02-28  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/fat/fat.c (fake_cpuid): Handle id 7, make bold claims.
+
+2014-02-27  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/fat/fat_entry.asm: Zero ecx for the benefit of new BMI2
+       feature test.
+
+       * mpn/x86_64/fat/fat.c (__gmpn_cpuvec_init): Run CPUVEC_SETUP_coreihwl
+       conditionally on BMI2 availability.
+
+       * config.guess: Revert "coreihwl" to "coreisbr" if cpuid indicates that
+       BMI2 is missing.
+       (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.
+       Hopefully no longer needed.
+
+       * mpn/s390_64/gmp-mparam.h (DIV_QR_1_NORM_THRESHOLD): Up to 1.
+       * mpn/s390_64/z10/gmp-mparam.h (DIV_QR_1_NORM_THRESHOLD): Up to 1.
+
+       * tune/tuneup.c (tune_div_qr_1): Ensure DIV_QR_1_NORM_THRESHOLD,
+       DIV_QR_1_UNNORM_THRESHOLD >= 1.
+
+2014-02-16 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+       * mpn/generic/div_qr_1.c: Disallow DIV_QR_1_NORM_THRESHOLD==0.
+
+2014-02-15  Torbjorn Granlund  <tege@gmplib.org>
+
+       * tests/mpn/t-div.c: Fix typo.
+
+2014-02-15 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+       * 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>
+
+       * doc/gmp.texi (Low-level Functions): Update docs for
+       mpn_sec_powm, to specify that left-over exponent bits must be
+       zero.
+
+2014-02-11  Niels Möller  <nisse@lysator.liu.se>
+
+       * Makefile.am (EXTRA_DIST): Distribute COPYING.LESSERv3,
+       COPYINGv2, and COPYINGv3.
+
+       * doc/gmp.texi (Low-level Functions): Updated mpn_sec_powm docs.
+
+       * mpn/generic/sec_powm.c (mpn_sec_powm): Replaced exponent limb
+       count argument by bit count. Don't leak high exponent bits, and
+       drop the requirement that the most significant exponent limb is
+       non-zero.
+       (mpn_sec_powm_itch): Analogous interface change.
+       * gmp-h.in: Updated prototypes.
+       * mpz/powm_sec.c (mpz_powm_sec): Update mpn_sec_powm* calls.
+       * 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
+       parameters nbits = 1, winsize = 2. Decrement tabulated values, to
+       better match the > comparison when the table is used.
+
+       * mpn/generic/sec_powm.c (win_size): Comment why we always get
+       win_size(eb) <= eb. Make the table const.
+       (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
+       function.
+
+       * mpn/generic/sec_div.c: Simplified code for the normalized case.
+
+       * tests/mpn/t-div.c (main): Test mpn_sec_div_qr and mpn_sec_div_r
+       with normalized d.
+
+2014-02-04  Niels Möller  <nisse@lysator.liu.se>
+
+       * 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.
+
+2014-01-29  Niels Möller  <nisse@lysator.liu.se>
+
+       * README: Don't refer to specific COPYING* files, instead refer to
+       manual for details.
+
+       * COPYING.LIB: Renamed, to...
+       * COPYING.LESSERv3: ... new name.
+       * COPYING: Renamed, to...
+       * COPYINGv3: ... new name.
+       * COPYINGv2: New file, GPLv2.
+
+       * doc/gmp.texi (Copying): Document dual licensing.
+
+2014-01-27  Torbjorn Granlund  <tege@gmplib.org>
+
+       * Update library files license to use LGPL3+ and GPL2+.
+
+2014-01-27 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+       * tests/mpn/t-aors_1.c: Check sec_aors_1 red zones (not smart).
+
+       * mpn/generic/sec_aors_1.c: Mark the 2nd argument as const.
+       * gmp-h.in (mpn_sec_add_1, mpn_sec_sub_1): Likewise.
+
+2014-01-24  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/fat/fat.c (fake_cpuid_table): Use proper steamroller and
+       excavator values.
+
+       * config.guess: Amend last AMD change.
+
+       * mpn/s390_64/lshift.asm: Align loop.
+       * mpn/s390_64/rshift.asm: Likewise.
+       * mpn/s390_64/lshiftc.asm: Likewise.
+       * mpn/s390_64: Add z10 cycle numbers.
+
+2014-01-23 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+       * 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.
+
+2014-01-20  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/fat/fat.c (__gmpn_cpuvec_init): Fix duplicate entries for
+       AMD "jaguar".
+
+       * demos/expr: Get rid of varargs code and references.
+
+2014-01-19  Torbjorn Granlund  <tege@gmplib.org>
+
+       * config.guess: Add new AMD CPUs (piledriver, steamroller, excavator,
+       jaguar).
+       * config.sub: Corresponding updates.
+       * configure.ac: Likewise.
+       * acinclude.m4 (X86_64_PATTERN): Likewise.
+       * mpn/x86_64/fat/fat.c: Likewise.
+
+       * Rename mpn_sec_minvert => mpn_sec_invert, many files affected.
+       * mpn/generic/sec_invert.c: New name for sec_minvert.c.
+
+       * doc/gmp.texi: Undocument mpz_array_init.
+
+       * acinclude.m4 (GMP_C_STDARG): Comment out.
+       * configure.ac: Suppress GMP_C_STDARG invocation.
+
+       * Get rid of varargs code and references, many file affected.
+
+       * Use mpq_t in favour of MP_RAT, many mpq files affected.
+
+       * Get rid of BYTES_PER_MP_LIMB, most files affected.
+
+       * mpz/iset.c: Avoid overflow in allocation computation.
+       * mpz/mul.c: Likewise.
+       * mpf/init.c: Likewise.
+       * mpf/init2.c: Likewise.
+       * mpf/iset.c: Likewise.
+       * mpf/iset_d.c: Likewise.
+       * mpf/iset_si.c: Likewise.
+       * mpf/iset_str.c: Likewise.
+       * mpf/iset_ui.c: Likewise.
+
+       * mpz/array_init.c: Avoid two overflow scenarios in allocation
+       computation.
+
+       * mpn/s390_64/z10/gmp-mparam.h: New file.
+
+       * mpz/clears.c: Call __gmp_free_func ourselves instead of via
+       mpz_clears.
+       * mpf/clears.c: Analogous change.
+       * mpq/clears.c: Analogous change.
+
+       * 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.
+
+       * tests/mpn/t-minvert.c (main): Pass smallest allowed bit_size
+       argument to mpn_sec_minvert.
+
+2014-01-18  Marc Glisse  <marc.glisse@inria.fr>
+
+       * doc/gmp.texi (C++ Interface Limitations): Warn against C++11 auto.
+
+2014-01-18 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+       * tests/t-parity.c: Use 1UL to generate unsigned constants.
+       * tests/t-constants.c: Disable a non portable (unneeded) check.
+
+2014-01-18  Niels Möller  <nisse@lysator.liu.se>
+
+       * mpn/generic/sec_aors_1.c (mpn_sec_add_1, mpn_sec_sub_1): New
+       file.
+
+       * mpn/generic/sec_minvert.c (mpn_sec_add_1_itch, mpn_sec_add_1):
+       Deleted static definitions.
+       (mpn_cnd_swap): Use volatile.
+
+       * configure.ac (gmp_mpn_functions): sec_add_1 and sec_sub_1.
+       (GMP_MULFUNC_CHOICES): Set up for sec_aors_1.
+
+2014-01-16  Niels Möller  <nisse@lysator.liu.se>
+
+       * tune/common.c (speed_mpn_sec_minvert): New function.
+       * tune/speed.h: Declare it.
+       (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++.
+
+2014-01-11  Torbjorn Granlund  <tege@gmplib.org>
+
+       * doc/gmp.texi (Notes for Particular Systems): Add items about old
+       NetBSD and current FreeBSD m4 problems.  Add item about FreeBSD's
+       broken limits.h.
+
+2014-01-05 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+       * gmp-impl.h: Declare all _itch functions using ATTRIBUTE_CONST.
+
+2014-01-05  Torbjorn Granlund  <tege@gmplib.org>
+
+       * configure.ac (alpha): Set extra_functions conditionally.
+
+       * gmp-h.in (mpn_sec_minvert): Remove formal parameters.
+
+       * doc/gmp.texi: Improve doc for several functions.
+
+       * mpn/generic/sec_tabselect.c: Declare input arg using 'const'.
+       * gmp-h.in: Analogous change.
+
+       * gmp-h.in: Declare all itch functions using __GMP_ATTRIBUTE_PURE.
+       * gmp-impl.h: Likewise.
+
+2014-01-05 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+       * tests/mpn/t-minvert.c: Always compare with mpz_invert results,
+       add red zone to scratch.
+       * tests/mpn/t-sizeinbase.c: New test.
+       * tests/mpn/Makefile.am (check_PROGRAMS): Added t-sizeinbase.c .
+       * tests/mpn/t-div.c: Use mpn_sec_div_*_itch().
+
+       * mpn/generic/pow_1.c: Micro-optimisation.
+
+2014-01-04  Torbjorn Granlund  <tege@gmplib.org>
+
+       * acinclude.m4 (GMP_PROG_M4): Avoid hex output, since case varies.
+
+2014-01-03  Torbjorn Granlund  <tege@gmplib.org>
+
+       * config.guess: Support newer haswell, broadwell, silvermont.
+       * mpn/x86_64/fat/fat.c (__gmpn_cpuvec_init): Likewise.
+
+       * acinclude.m4 (GMP_PROG_M4): Check that eval's radix argument work.
+
+       * mpz/invert.c: Rely on gcdext for all operands, removing faulty
+       special case.
+       * tests/mpz/t-invert.c: Enforce correct behaviour for |mod| = 1.
+
+2014-01-02  Niels Möller  <nisse@lysator.liu.se>
+
+       * doc/gmp.texi (Low-level Functions): Document mpn_sizeinbase.
+
+       Enable previously unused mpn_sizeinbase function.
+       * configure.ac (gmp_mpn_functions): Added sizeinbase.
+       * gmp-h.in (mpn_sizeinbase): New prototype.
+
+2014-01-02  Marc Glisse  <marc.glisse@inria.fr>
+
+       * gmp-impl.h: Always include <limits.h>.
+       * tests/mpn/t-get_d.c: Remove comment about <limits.h>
+
+       * gmp-h.in (__GMP_USHRT_MAX): Use the promoted type.
+       * gmp-impl.h (USHRT_HIGHBIT, SHRT_MIN, SHRT_MAX): Likewise.
+       * tests/t-constants.c: Adapt printf strings.
+       * tests/t-gmpmax.c: Likewise.
+
+       * tests/mpn/t-hgcd_appr.c (hgcd_appr_valid_p): Add parentheses.
+
+2014-01-01  Torbjorn Granlund  <tege@gmplib.org>
+
+       * doc/gmp.texi (Low-level Functions for cryptography): Update interface
+       for mpn_sec_div_qr and fix typos in mpn_sec_minvert text.
+
+       * mpn/generic/sec_div.c: Rewrite to make mpn_sec_div_qr return high
+       quotient limb.
+       * gmp-h.in (mpn_sec_div_qr): Update declaration.
+       * tests/mpn/t-div.c: Adapt.
+
+2013-12-31  Niels Möller  <nisse@lysator.liu.se>
+
+       * doc/gmp.texi (Low-level Functions for cryptography): Document
+       mpn_sec_minvert.
+
+2013-12-30  Marc Glisse  <marc.glisse@inria.fr>
+
+       * doc/gmp.texi (C++ interface internals): Break long line.
+
+2013-12-30  Torbjorn Granlund  <tege@gmplib.org>
+
+       * doc/gmp.texi (Low-level Functions for cryptography): New section.
+
+2013-12-29  Niels Möller  <nisse@lysator.liu.se>
+
+       * tests/mpn/Makefile.am (check_PROGRAMS): Added t-minvert.
+       * tests/mpn/t-minvert.c: New file.
+
+       * configure.ac (gmp_mpn_functions): Added sec_minvert.
+       * gmp-h.in (mpn_sec_minvert, mpn_sec_minvert_itch): New
+       declarations.
+       * mpn/generic/sec_minvert.c (mpn_sec_minvert)
+       (mpn_sec_minvert_itch): New functions.
+       (mpn_sec_add_1, mpn_cnd_neg, mpn_cnd_swap, mpn_sec_eq_ui): New
+       helper functions.
+
+2013-12-28  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/generic/sec_powm.c: Fix an ASSERT.
+
+       * gmp-h.in (mpn_sec_mul, mpn_sec_mul_itch): New declarations.
+       * gmp-h.in (mpn_sec_sqr, mpn_sec_sqr_itch): Likewise.
+       * mpn/generic/sec_mul.c: New file.
+       * mpn/generic/sec_sqr.c: New file.
+
+       * gmp-h.in (mpn_sec_powm, mpn_sec_powm_itch): New declarations.
+       * gmp-h.in (mpn_sec_div_qr, mpn_sec_div_qr_itch): Likewise.
+       * gmp-h.in (mpn_sec_div_r, mpn_sec_div_r_itch): Likewise.
+       * gmp-impl: Remove declarations of above functions.
+
+       * configure.ac (gmp_mpn_functions): Add sec_mul and sec_sqr.
+
+2013-12-26 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+       * Update many file's encoding to UTF-8.
+       * doc/tasks.html: Update <meta content> accordingly.
+       * doc/projects.html: Likewise.
+
+2013-12-26  Torbjorn Granlund  <tege@gmplib.org>
+
+       * configure.ac: Rename mpn_blah_sec to mpn_sec_blah.
+       * gmp-impl.h: Corresponding changes.
+       * mpn/asm-defs.m4: Corresponding changes.
+       * tune/Makefile.am: Corresponding changes.
+       * tune/common.c: Corresponding changes.
+       * tune/speed.c: Corresponding changes.
+       * tune/speed.h: Corresponding changes.
+       * tune/tuneup.c: Corresponding changes.
+       * mpz/powm_sec.c: Update calls.
+       * tests/mpn/t-div.c: Likewise.
+
+       * mpn/generic/sec_powm.c: New name for mpn/generic/powm_sec.c.
+       * mpn/generic/sec_div.c: New name for mpn/generic/sb_div_sec.c.
+       * mpn/generic/sec_pi1_div.c: New name for mpn/generic/sbpi1_div_sec.c.
+       * mpn/generic/sec_tabselect.c: New name for mpn/generic/tabselect.c.
+
+       * mpn/alpha/sec_tabselect.asm: New name for tabselect.asm.
+       * mpn/arm/neon/sec_tabselect.asm: New name for tabselect.asm.
+       * mpn/arm/sec_tabselect.asm: New name for tabselect.asm.
+       * mpn/ia64/sec_tabselect.asm: New name for tabselect.asm
+       * mpn/powerpc32/sec_tabselect.asm: New name for tabselect.asm
+       * mpn/powerpc64/sec_tabselect.asm: New name for tabselect.asm
+       * mpn/sparc64/sec_tabselect.asm: New name for tabselect.asm
+       * mpn/x86/mmx/sec_tabselect.asm: New name for tabselect.asm
+       * mpn/x86/sec_tabselect.asm: New name for tabselect.asm
+       * mpn/x86_64/bd1/sec_tabselect.asm: New name for tabselect.asm
+       * mpn/x86_64/core2/sec_tabselect.asm: New name for tabselect.asm
+       * mpn/x86_64/coreinhm/sec_tabselect.asm: New name for tabselect.asm
+       * mpn/x86_64/coreisbr/sec_tabselect.asm: New name for tabselect.asm
+       * mpn/x86_64/fastsse/sec_tabselect.asm: New name for tabselect.asm
+       * mpn/x86_64/k10/sec_tabselect.asm: New name for tabselect.asm
+       * mpn/x86_64/pentium4/sec_tabselect.asm: New name for tabselect.asm
+       * mpn/x86_64/sec_tabselect.asm: New name for tabselect.asm
+
+2013-12-25  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpz/powm_sec.c: Handle 0^e mod m specially.
+       * mpn/generic/powm_sec.c: ASSERT that the base is non-zero.
+
+2013-12-23  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/generic/powm_sec.c (redcify): Use passed scratch instead of
+       locally allocated.
+       (mpn_powm_sec_itch): Accommodate mpn_sb_div_r_sec's scratch needs.
+
+2013-12-20  Mark Sofroniou  <marks@wolfram.com>
+
+       * mpn/generic/mul_fft.c: Major overhaul of types.
+
+2013-12-18  Torbjorn Granlund  <tege@gmplib.org>
+
+       * doc/gmp.texi (Low-level Functions): Rewrite mpn_set_str docs.
+
+2013-12-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       * mpn/powerpc32/darwin.m4: Allow (and ignore) optional
+       'toc' parameter to PROLOGUE_cpu.
+       * mpn/powerpc32/elf.m4: Likewise.
+
+2013-12-09  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       * configure.ac: Check for ELFv2 ABI on PowerPC.
+       * mpn/powerpc64/elf.m4: Set assembler ABI version for ELFv2
+       and use appropriate PROLOGUE_cpu/EPILOGUE_cpu sequences.
+       Support optional 'toc' parameter to PROLOGUE_cpu.
+       * mpn/powerpc64/aix.m4: Allow (and ignore) optional
+       'toc' parameter to PROLOGUE_cpu.
+       * mpn/powerpc64/darwin.m4: Likewise.
+
+       * mpn/powerpc64/mode64/dive_1.asm (mpn_divexact_1): Add 'toc'
+       parameter to PROLOGUE.
+       * mpn/powerpc64/mode64/divrem_1.asm (mpn_divrem_1): Likewise.
+       * mpn/powerpc64/mode64/divrem_2.asm (mpn_divrem_2): Likewise.
+       * mpn/powerpc64/mode64/gcd_1.asm (mpn_gcd_1): Likewise.
+       * mpn/powerpc64/mode64/invert_limb.asm (mpn_invert_limb): Likewise.
+       * mpn/powerpc64/mode64/mod_1_1.asm (mpn_mod_1_1p_cps): Likewise.
+       * mpn/powerpc64/mode64/mod_1_4.asm (mpn_mod_1s_4p_cps): Likewise.
+       * mpn/powerpc64/mode64/mode1o.asm (mpn_modexact_1c_odd): Likewise.
+       * mpn/powerpc64/mode64/p7/gcd_1.asm (mpn_gcd_1): Likewise.
+       * mpn/powerpc64/p6/lshift.asm (mpn_lshift): Likewise.
+       * mpn/powerpc64/p6/lshiftc.asm (mpn_lshiftc): Likewise.
+       * mpn/powerpc64/p6/rshift.asm (mpn_rshift): Likewise.
+       * mpn/powerpc64/vmx/popcount.asm (mpn_popcount): Likewise.
+
+2013-12-07  Niels Möller  <nisse@lysator.liu.se>
+
+       * configfsf.sub: Updated to version 2013-10-01, from gnulib.
+       * configfsf.guess: Updated to version 2013-11-29, from gnulib.
+
+2013-12-03  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/generic/div_qr_1.c: Make constant args asm inlines become limbs.
+       * mpn/generic/div_qr_1n_pi1.c: Likewise.
+       * mpn/generic/div_qr_2.c: Likewise.
+       * mpn/generic/div_qr_2.c: Likewise.
+       * mpn/generic/mod_1_1.c: Likewise.
+       * mpn/generic/mod_1_2.c: Likewise.
+       * mpn/generic/mod_1_3.c: Likewise.
+       * mpn/generic/mod_1_4.c: Likewise.
+       * mpn/generic/mulmid_basecase.c: Likewise.
+       * mpn/generic/mulmod_bnm1.c: Likewise.
+       * mpn/generic/sqrmod_bnm1.c: Likewise.
+       * mpn/sparc64/divrem_1.c: Likewise.
+       * mpn/sparc64/mod_1_4.c: Likewise.
+
+       * mpn/generic/toom_interpolate_7pts.c (BINVERT_15): Fix typo.
+
+2013-11-11  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/dos64.m4 (CALL): Provide to override default.
+
+2013-11-08  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/x86_64-defs.m4 (CALL): Swap PIC test and macro defn.
+
+       * mpn/generic/div_qr_2.c: Test HAVE_HOST_CPU_FAMILY_x86, not i386.
+
+       * doc/gmp.texi: Update many URLs.
+
+2013-11-04  Torbjorn Granlund  <tege@gmplib.org>
+
+       * configure.ac: Set symbol OPENBSD for x86-openbsd hosts.
+       * mpn/x86_64/fat/fat_entry.asm (PRETEND_PIC): New name for
+       PIC_OR_DARWIN.
+       (PRETEND_PIC): Set also for OPENBSD.
+
+2013-10-29  Torbjorn Granlund  <tege@gmplib.org>
+
+       * printf/doprnt.c (__gmp_doprnt): Use memcpy instead of strcpy.
+
+2013-10-24  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/generic/div_qr_1u_pi2.c: New file.
+       * mpn/generic/div_qr_1n_pi2.c: New file.
+
+2013-10-24  Niels Möller  <nisse@lysator.liu.se>
+
+       * mpn/x86_64/div_qr_1n_pi1.asm: Bugfixes, for case n == 1 and
+       in-place operation.
+       * mpn/x86_64/k8/div_qr_1n_pi1.asm: Likewise.
+
+       * mpn/generic/div_qr_1n_pi1.c (mpn_div_qr_1n_pi1): Bug fixes,
+       off-by-one MPN_INCR_U, and support for in-place operation.
+
+2013-10-24  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86/fat/fat.c (fake_cpuid_table): Add Haswell.
+
+2013-10-23  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/x86_64-defs.m4 (oplist): New define, data from `regnum'.
+       (regnum): Use x86_lookup, feed oplist.
+
+2013-10-22  Niels Möller  <nisse@lysator.liu.se>
+
+       * tests/devel/try.c: Support mpn_div_qr_1n_pi1.
+
+       * mpn/x86_64/k8/div_qr_1n_pi1.asm: Moved the below k10 file here.
+       Applied tweak from Torbjörn to get it to run well on k8.
+
+       * mpn/x86_64/k10/div_qr_1n_pi1.asm: New file (renamed above).
+       Differs from generic x86_64 version by using cmov.
+
+       * mpn/x86_64/div_qr_1n_pi1.asm: Reordered arguments to second mul.
+       Deleted misleading cycle annotations.
+
+2013-10-21  Niels Möller  <nisse@lysator.liu.se>
+
+       * configure.ac: Add HAVE_NATIVE_mpn_div_qr_1n_pi1 to config.in.
+
+       * mpn/generic/div_qr_1n_pi1.c (mpn_div_qr_1n_pi1): Fix typos
+       affecting ASSERT.
+
+2013-10-20  Niels Möller  <nisse@lysator.liu.se>
+
+       * mpn/x86_64/div_qr_1n_pi1.asm: New file.
+
+       * tune/div_qr_1_tune.c (__gmpn_div_qr_1n_pi1): Check
+       div_qr_1n_pi1_method only when !HAVE_NATIVE_mpn_div_qr_1n_pi1.
+
+       * mpn/asm-defs.m4 (define_mpn): Add div_qr_1n_pi1.
+
+       * tune/common.c (speed_mpn_div_qr_1): New function, replacing...
+       (speed_mpn_div_qr_1n, speed_mpn_div_qr_1u): ... deleted functions
+       (speed_mpn_div_qr_1n_pi1, speed_mpn_div_qr_1n_pi1_1)
+       (speed_mpn_div_qr_1n_pi1_2): New functions.
+       * gmp-impl.h [TUNE_PROGRAM_BUILD]: Declare div_qr_1-related tuning
+       variables.
+       * tune/tuneup.c (speed_mpn_div_qr_1_tune, tune_div_qr_1): New
+       functions.
+       (div_qr_1n_pi1_method, div_qr_1_norm_threshold)
+       (div_qr_1_unnorm_threshold): New globals.
+       * tune/speed.c (routine): Replaced mpn_div_qr_1n and mpn_div_qr_1u
+       by mpn_div_qr_1, requiring ".r" parameter. Added mpn_div_qr_1n_pi1
+       and variants.
+       * tune/speed.h (SPEED_ROUTINE_MPN_DIV_QR_1): Use the "r" parameter
+       as divisor.
+       * tune/div_qr_1n_pi1_2.c: New file.
+       * tune/div_qr_1n_pi1_1.c: New file.
+       * tune/div_qr_1_tune.c: New file.
+       * tune/Makefile.am (libspeed_la_SOURCES): Added div_qr_1n_pi1_1.c,
+       div_qr_1n_pi1_2.c, and div_qr_1_tune.c.
+
+       * tune/speed.c (routine): Added mpn_div_qr_1n and mpn_div_qr_1u.
+       * tune/speed.h (SPEED_ROUTINE_MPN_DIV_QR_1): New macro.
+       (speed_mpn_div_qr_1n, speed_mpn_div_qr_1u): Declare.
+       * tune/common.c (speed_mpn_div_qr_1n, speed_mpn_div_qr_1u): New
+       functions.
+
+       * gmp-impl.h (mpn_div_qr_1n_pi1): Declare function.
+       * gmp-h.in (mpn_div_qr_1): Declare function.
+       * configure.ac (gmp_mpn_functions): Added div_qr_1 and
+       div_qr_1n_pi1.
+       * mpn/generic/div_qr_1.c (mpn_div_qr_1): New file and function.
+       * mpn/generic/div_qr_1n_pi1.c (mpn_div_qr_1n_pi1): New file and
+       function.
+       * tests/mpn/t-div.c (main): Test mpn_div_qr_1.
+
+2013-10-17  Torbjorn Granlund  <tege@gmplib.org>
+
+       * configure.ac (alpha): Pass -mieee via gcc_cflags_maybe.
+
+2013-10-16  Torbjorn Granlund  <tege@gmplib.org>
+
+       * config.guess: Let AMD64 cpuid bit override pessimistic cpu guesses.
+
+       * mpn/alpha/unicos.m4 (DATASTART): Accept optional align parameter.
+       * mpn/alpha/divrem_2.asm: Use provided gp mechanisms.
+       * mpn/alpha/default.m4 (PROLOGUE): Provide "..ng" post-gp label.
+       * mpn/alpha/invert_limb.asm: Align table to 8-byte boundary.  Make code
+       work if table is not fully aligned.  Properly test for BWX.
+
+2013-10-15  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/alpha/default.m4 (DATASTART): Use RODATA instead of DATA;
+       accept optional align parameter.
+       * mpn/alpha/invert_limb.asm: Align table.
+       * mpn/alpha/ev5/diveby3.asm: Likewise.
+
+2013-10-11  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86/k7/mod_1_1.asm: Use 'subl' form to avoid ambiguity.
+       * mpn/x86/k7/mod_1_4.asm: Likewise.
+
+       * configure.ac (X86_64_PATTERN): Append "cc" to cclist_64 and
+       cclist_x32.
+
+2013-10-08  Torbjorn Granlund  <tege@gmplib.org>
+           Marc Glisse  <marc.glisse@inria.fr>
+
+       * tests/mpf/reuse.c (main): Compare addresses instead of names.
+       Use larger numbers for exponents.
+
+2013-10-08  Marc Glisse  <marc.glisse@inria.fr>
+
+       * doc/mdate-sh, doc/texinfo.tex, install-sh, missing, ylwrap: Remove.
+       * .bootstrap: Use autoreconf (and in particular automake -a).
+
+       * gmp-h.in: Remove __need_size_t. Include <stddef.h>, not <cstddef>.
+
+       * tests/mpf/reuse.c (main): Use small numbers as exponents.
+
+2013-10-05  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/atom/aorsmul_1.asm: Slight tweak.
+
+       * doc/gmp.texi (ABI and ISA): Document x32.
+
+       * mpn/sparc64/ultrasparct3/dive_1.asm: Use our register names.
+
+2013-09-24  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/atom/redc_1.asm: New file.
+
+2013-09-23  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/bobcat/redc_1.asm: Make the code for 1 <= n <= 3 work.
+
+2013-09-22  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/coreisbr/redc_1.asm: Slightly tweak basecase code.
+
+       * mpn/x86_64/core2/redc_1.asm: New file.
+
+       * mpn/x86_64/bobcat/redc_1.asm: New file.
+
+2013-09-21  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/coreinhm/redc_1.asm: New file.
+
+2013-09-21  Marc Glisse  <marc.glisse@inria.fr>
+
+       * tests/mpn/t-mulmid.c: Cast arguments of printf to int to match %d.
+       * tests/rand/t-urbui.c: Use 1UL for unsigned constant.
+       * mpn/generic/get_str.c: Avoid temporarily pointing outside an array.
+
+2013-09-20  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/coreisbr/redc_1.asm: New file.
+
+       * mpn/x86_64/k8/redc_1.asm: Complete rewrite.
+
+       * mpn/x86_64/coreisbr/mullo_basecase.asm: Postpone pushes, short-
+       circuit a branch.
+       * mpn/x86_64/coreihwl/mullo_basecase.asm: Short-circuit a branch.
+
+       * mpn/x86_64/core2/mullo_basecase.asm: New file.
+
+2013-09-19  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/fastsse/copyi-palignr.asm: Allocate more stack under DOS.
+
+2013-09-18  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/core2/mul_basecase.asm: New file.
+       * mpn/x86_64/core2/sqr_basecase.asm: New file.
+
+       * mpn/x86_64/coreihwl/mullo_basecase.asm: New file.
+       * mpn/x86_64/coreisbr/mullo_basecase.asm: New file.
+
+2013-09-16  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/fastsse/copyi-palignr.asm: Preserve xmm6-xmm8 under DOS.
+
+2013-09-15  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/tabselect.asm: Use R8 for bit testing.
+
+       * mpn/x86_64/coreihwl/mul_basecase.asm: Replace mul_1 code.
+
+       * mpn/x86_64/coreisbr/aorsmul_1.asm: Rewrite.
+
+2013-09-12  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/ia64/gcd_1.asm: Use dep for combining table base and low bits.
+
+       * mpn/x86_64/fastsse/com-palignr.asm: Implement temp fix to properly
+       handle overlap.
+
+2013-09-10  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/fastsse/copyi-palignr.asm: Rewrite rp != up (mod 16) code
+       to make it handle any allowed overlap.
+
+2013-09-09  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/atom/com.asm: New file, grabbing fastsse code.
+
+       * mpn/x86_64/bd1/copyi.asm: New file, grabbing fastsse code.
+       * mpn/x86_64/bd1/copyd.asm: Likewise.
+       * mpn/x86_64/bd1/com.asm: Likewise.
+
+       * mpn/x86_64/fastavx/copyi.asm: New file.
+       * mpn/x86_64/fastavx/copyd.asm: New file.
+
+2013-09-05  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/coreihwl/aorsmul_1.asm: Streamline.
+
+2013-09-04  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/coreihwl/sqr_basecase.asm: Implement larger "corner".
+       Misc tuning.
+
+2013-09-03  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/coreihwl/redc_1.asm: New file.
+
+       * mpn/x86_64/x86_64-defs.m4 (mulx): Handle negative offsets.
+
+2013-08-31  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/coreisbr/sqr_basecase.asm: New file.
+
+       * mpn/x86_64/sqr_diag_addlsh1.asm: New file.
+
+2013-08-30  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/fat/mul_basecase.c: New file.
+       * mpn/x86_64/fat/sqr_basecase.c: New file.
+       * mpn/x86_64/fat/mullo_basecase.c: New file.
+       * mpn/x86_64/fat/redc_1.c: New file.
+
+2013-08-29  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/k8/mul_basecase.asm: Move top-level basecase file to k8
+       subdir.
+       * mpn/x86_64/k8/sqr_basecase.asm: Likewise.
+       * mpn/x86_64/k8/redc_1.asm: Likewise.
+       * mpn/x86_64/k8/mullo_basecase.asm: Likewise.
+       * mpn/x86_64/k8/mulmid_basecase.asm: Likewise.
+
+       * mpn/ia64/aors_n.asm: Clean up some bundlings.
+
+       * mpn/x86_64/fat/fat.c (__gmpn_cpuvec_init): Support Haswell.
+       (fake_cpuid_table): Likewise.
+
+       * configure.ac (x86): Remove any mulx paths.  Let bwl path = hwl path.
+       (fat_path): Add coreihwl.
+
+       * mpn/x86_64/coreihwl/aorsmul_1.asm: Move from `mulx' directory, use
+       mulx() macro.
+       * mpn/x86_64/coreihwl/mul_1.asm: Likewise.
+       * mpn/x86_64/coreihwl/mul_2.asm: Likewise.
+       * mpn/x86_64/coreihwl/mul_basecase.asm: Likewise.
+       * mpn/x86_64/coreihwl/sqr_basecase.asm: Likewise.
+
+       * mpn/x86_64/x86_64-defs.m4 (mulx): New macro.
+       (regnum, regnumh, ix): Supporting macros.
+
+2013-08-28  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/coreisbr/divrem_1.asm: New file.
+
+2013-08-23  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/fastsse/com-palignr.asm: New file, closely based on
+       copyi-palignr.asm.
+
+       * mpn/x86_64/fastsse/copyi.asm Use "test R8(reg)" instead of "bt".
+       * mpn/x86_64/fastsse/copyd-palignr.asm: Likewise.
+       * mpn/x86_64/fastsse/copyi-palignr.asm: Likewise.
+       * mpn/x86_64/fastsse/lshift-movdqu2.asm: Likewise.
+       * mpn/x86_64/fastsse/lshiftc-movdqu2.asm: Likewise.
+       * mpn/x86_64/fastsse/rshift-movdqu2.asm: Likewise.
+       * mpn/x86_64/fastsse/tabselect.asm: Likewise.
+
+       * mpn/sparc64/ultrasparct3/sqr_diag_addlsh1.asm: New file.
+
+       * mpn/alpha/aorslsh2_n.asm: New file.
+       * mpn/alpha/aorslsh1_n.asm: Rewrite.
+       * mpn/alpha/ev6/aorslsh1_n.asm: New file.
+
+2013-08-21  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/alpha/sqr_diag_addlsh1.asm: New file.
+       * mpn/alpha/sqr_diagonal.asm: Remove.
+       * mpn/alpha/ev6/sqr_diagonal.asm: Remove.
+
+2013-08-20  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/powerpc32/sqr_diag_addlsh1.asm: New file.
+       * mpn/powerpc32/sqr_diagonal.asm: Remove.
+
+2013-08-15  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/coreihwl/mulx/sqr_basecase.asm: New file.
+
+2013-08-05  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/coreisbr/aors_n.asm: Complete rewrite.
+
+2013-08-04  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/coreihwl/mulx/mul_basecase.asm: New file.
+
+       * mpn/x86_64/bd1/mul_2.asm: New file.
+
+       * mpn/x86_64/coreihwl/gmp-mparam.h: New file.
+
+2013-08-03  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/coreihwl/mulx/mul_2.asm: New file.
+       * mpn/x86_64/coreihwl/mulx/addmul_2.asm: New file.
+
+       * mpn/x86_64/coreinhm/aorsmul_1.asm: New file.
+
+       * mpn/x86_64/coreisbr/mul_basecase.asm: Save some O(n) and O(1) cycles.
+
+       * mpn/x86_64/coreisbr/mul_2.asm: New file.
+
+2013-08-02  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/coreisbr/addmul_2.asm: Complete rewrite.
+
+2013-08-01  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/bd1/mul_basecase.asm: New file.
+
+       * mpn/x86_64/coreisbr/mul_basecase.asm: New file.
+
+       * mpn/x86_64/coreihwl/aorsmul_1.asm: New file.
+
+2013-07-31  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/atom/mul_2.asm: New file.
+       * mpn/x86_64/atom/addmul_2.asm: New file.
+       * mpn/x86_64/atom/mul_1.asm: New file.
+       * mpn/x86_64/atom/aorsmul_1.asm: New file.
+
+       * mpn/x86_64/coreihwl/mul_1.asm: New file.
+
+       * configure.ac (x86): Add Haswell-specific path.
+
+       * configure.in (fat_functions): Add cnd_add_n, cnd_sub_n..
+       * gmp-impl.h (struct cpuvec_t): Add fields for new fat functions.
+       * gmp-impl.h: Adjust corresponding declarations.
+
+       * mpn/x86_64/x86_64-defs.m4 (CPUVEC_FUNCS_LIST): Add new fat functions.
+       * mpn/x86/x86-defs.m4 (CPUVEC_FUNCS_LIST): Likewise.
+       * mpn/x86_64/fat/fat.c (__gmpn_cpuvec): Likewise.
+       * mpn/x86/fat/fat.c (__gmpn_cpuvec): Likewise.
+
+2013-07-30  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/coreisbr/popcount.asm: New file.
+
+2013-07-23  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/bobcat/aors_n.asm: New file.
+
+       * mpn/x86_64/pentium4/aorslshC_n.asm: Remove a spurious emms insn.
+
+       * mpn/x86_64/bd1/aorrlsh1_n.asm: New file.
+       * mpn/x86_64/bd1/sublsh1_n.asm: New file.
+
+2013-07-22  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/powerpc64/mode64/mod_1_1.asm: Handle little-endian mode.
+       * mpn/powerpc64/mode64/mod_1_4.asm: Likewise.
+
+2013-07-16  Torbjorn Granlund  <tege@gmplib.org>
+
+       * doc/gmp.texi: Declare countless of function arguments as 'const'.
+
+2013-07-15  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/core2/aors_n.asm: Rewrite.
+
+       * mpn/generic/sb_div_sec.c: Compute inverse as floor(B^2/(dh+1)), per
+       Niels' suggestion.
+       * mpn/generic/sbpi1_div_sec.c: Remove inverse rounding-up code.
+
+2013-07-14  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/powerpc64/mode64/divrem_1.asm: Remove explicit nop after CALL.
+       * mpn/powerpc64/mode64/divrem_2.asm: Likewise.
+       * mpn/powerpc64/mode64/mod_1_1.asm:  Likewise.
+       * mpn/powerpc64/mode64/mod_1_4.asm:  Likewise.
+
+2013-07-13  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86/atom/cnd_add_n.asm: New file.
+       * mpn/x86/atom/cnd_sub_n.asm: New file.o
+
+2013-07-12  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/generic/sbpi1_div_sec.c: Partial rewrite.
+
+2013-07-11  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/cnd_aors_n.asm: Tweak for better speed on K8, bobcat, bd1,
+       NHM, Atom.
+
+2013-07-05  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/powerpc64/p7/copyi.asm: Handle n = 0.
+       * mpn/powerpc64/p7/copyd.asm: Likewise.
+
+2013-07-04  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/powerpc64/mode64/p7/aormul_2.asm: New file.
+
+       * mpn/powerpc64/darwin.m4 (EXTRA_REGISTER): New define.
+       * mpn/powerpc64/aix.m4: New define (actually undefine).
+       * mpn/powerpc64/elf.m4: Likewise.
+
+2013-07-03  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/powerpc64/com.asm: Rewrite.
+
+       * mpn/powerpc64/p7/copyi.asm: New file.
+       * mpn/powerpc64/p7/copyd.asm: New file.
+
+2013-07-02  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/powerpc64/mode64/gcd_1.asm: New file.
+       * mpn/powerpc64/mode64/p7/gcd_1.asm: New file.
+
+2013-07-01  Torbjorn Granlund  <tege@gmplib.org>
+
+       * configure.ac: Comment out AC_PROG_F77.
+
+       * mpn/powerpc64/mode64/rsh1add_n.asm: Remove.
+       * mpn/powerpc64/mode64/rsh1sub_n.asm: Remove.
+       * mpn/powerpc64/mode64/rsh1aors_n.asm: New file, code not based on
+       removed files.
+
+2013-06-28  Marc Glisse  <marc.glisse@inria.fr>
+
+       * cxx/ismpf.cc: Use GMP_DECIMAL_POINT.
+       * cxx/osmpf.cc: Likewise.
+       * tests/cxx/t-locale.cc: Likewise.
+
+2013-06-28  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/powerpc64/mode64/p7/aorsorrlshC_n.asm: New file.
+       * mpn/powerpc64/mode64/p7/aorsorrlsh1_n.asm: New file.
+       * mpn/powerpc64/mode64/p7/aorsorrlsh2_n.asm: New file.
+
+       * mpn/powerpc64/mode64/aorsorrlshC_n.asm: Use alias regname.
+
+2013-06-27  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/powerpc64/mode64/p7/aors_n.asm: New file.
+
+2013-06-22  Torbjorn Granlund  <tege@gmplib.org>
+
+       * aorslshC_n.asm, aorslsh2_n.asm, aorslsh1_n.asm: Remove.
+       * aorsorrlshC_n.asm, aorsorrlsh1_n.asm, aorsorrlsh2_n.asm: New files.
+
+2013-06-19  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/powerpc64/p6/lshift.asm: Rewrite switching-into-loop code.
+       * mpn/powerpc64/p6/rshift.asm: Likewise.
+       * mpn/powerpc64/p6/lshiftc.asm: Likewise.
+
+2013-06-17  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/powerpc64/p6/lshift.asm: Fix typo in label reference.
+       For 32-bit mode, zero extend `n' argument and split retval.
+       * mpn/powerpc64/p6/rshift.asm: Likewise.
+       * mpn/powerpc64/p6/lshiftc.asm: Likewise.
+
+2013-06-10  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/generic/mu_div_q.c: Remove obsolete comment.
+
+2013-06-09  Marc Glisse  <marc.glisse@inria.fr>
+
+       * mpn/generic/get_d.c (mpn_get_d): Avoid signed overflow.
+       * mpz/kronzs.c (mpz_kronecker_si): Use ABS_CAST.
+
+2013-05-31  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/generic/mu_div_q.c: Call mpn_mu_divappr_q for entire division,
+       never just for tail.  (This fixes performance issues at the expense of
+       memory needs.)
+
+2013-05-26  Torbjorn Granlund  <tege@gmplib.org>
+
+       * configure.ac (*sparc*-*-*): Major overhaul.
+
+2013-05-22  Torbjorn Granlund  <tege@gmplib.org>
+
+       * doc/gmp.texi (Reporting Bugs): Ask for configure's output.
+
+       * mpn/ia64/divrem_2.asm: Don't clobber f16-f18.
+
+2013-05-20  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/arm/udiv.asm: Change spacing to work around binutils bug.
+
+2013-05-16  Torbjorn Granlund  <tege@gmplib.org>
+
+       * Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*): Bump version info.
+
+       * tests/misc.c (tests_hardware_getround, tests_hardware_setround):
+       Avoid assembly dependency unless WANT_ASSEMBLY.
+
+       * configure.ac (WANT_ASSEMBLY): Conditionally define.
+
+2013-05-14  Torbjorn Granlund  <tege@gmplib.org>
+
+       * configure.ac (arm1156): Don't fall back to plain v6 compiler option.
+
+2013-05-11  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/coreisbr/mul_1.asm: Handle n = 1 for DOS64.  Streamline.
+       * mpn/x86_64/coreisbr/aorsmul_1.asm: Streamline.
+
+2013-05-10  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/coreisbr/aorsmul_1.asm: Fix, then enable DOS64 support.
+       * mpn/x86_64/coreisbr/mul_1.asm: Enable DOS64 support.
+
+       * mpn/x86/p6/mmx/gmp-mparam.h: Set down SQR_TOOM2_THRESHOLD to parent
+       directory value.
+
+2013-05-09  Torbjorn Granlund  <tege@gmplib.org>
+
+       * configure.ac (--enable-fake-cpuid): New option.
+       * mpn/x86_64/fat/fat.c (WANT_FAKE_CPUID): Remove defaulting.
+       * mpn/x86/fat/fat.c (WANT_FAKE_CPUID): Likewise.
+
+       * mpn/x86_64/bd1/mul_1.asm: Fix typo.
+
+2013-05-07  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/fat/fat.c (fake_cpuid): Handle 0x80000001 request.
+       (fake_cpuid_available): Remove unused function.
+
+       * mpn/generic/mod_1_1.c: Cast constant udiv_rnnd_preinv arguments.
+       * mpn/generic/mod_1_2.c: Likewise.
+       * mpn/generic/mod_1_3.c: Likewise.
+       * mpn/generic/mod_1_4.c: Likewise.
+       * mpn/generic/divrem_2.c: Likewise.
+
+2013-05-06  Torbjorn Granlund  <tege@gmplib.org>
+
+       * config.guess (power*): Handle all ppc970 variants.
+
+2013-05-03  David S. Miller  <davem@davemloft.net>
+
+       * tune/common.c (speed_mpn_addlsh1_n, speed_mpn_sublsh1_n,
+       speed_mpn_rsblsh1_n, speed_mpn_addlsh2_n, speed_mpn_sublsh2_n,
+       speed_mpn_rsblsh2_n): Don't define if these routines are macros.
+       * tune/speed.c (routine): Likewise don't table if they are macros.
+
+       * mpn/sparc64/ultrasparct3/addmul_1.asm: Add T4 and T3 timings.
+       * mpn/sparc64/ultrasparct3/aormul_4.asm: Likewise.
+       * mpn/sparc64/ultrasparct3/aorslsh_n.asm: Likewise.
+       * mpn/sparc64/ultrasparct3/cnd_aors_n.asm: Likewise.
+       * mpn/sparc64/ultrasparct3/submul_1.asm: Likewise.
+
+2013-05-03  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/sparc64/ultrasparct3/aorslsh_n.asm: Invoke INITCY where it has
+       effect.
+
+       * gmp-impl.h: Amend last change.
+       * tests/devel/try.c (choice_array): Don't try to table addlsh1_n etc if
+       a macro.
+
+2013-05-02  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/arm/copyd.asm: Suppress dead pointer update.
+       * mpn/arm/copyi.asm: Likewise.
+       * mpn/arm/neon/logops_n.asm: Likewise.
+       * mpn/arm/neon/tabselect.asm: Likewise.
+       * mpn/arm/rshift.asm: Likewise.
+       * mpn/arm/tabselect.asm: Likewise.
+       * mpn/arm/v6/dive_1.asm: Likewise
+       * mpn/arm/v7a/cora15/neon/copyi.asm: Likewise.
+
+       * mpn/arm/v7a/cora15/neon/com.asm: New file.
+
+2013-05-01  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/sparc64/ultrasparct3/aormul_4.asm: New file.
+
+       * configure.ac (GMP_MULFUNC_CHOICES): Support mul_3 + addmul_3 and
+       mul_4 + addmul_4.
+
+       * mpn/sparc64/ultrasparct3/aormul_2.asm: Optimise lead-in code.
+
+       * mpn/sparc64/ultrasparct3/missing.m4 (addxccc): Allow g2 as input.
+       (umulxhi): Save and restore o7 to allow it as in/out parameter.
+
+2013-04-29  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/arm/v7a/cora15/cnd_aors_n.asm: New file, was mis-named.
+
+       * mpn/sparc64/ultrasparct3/addmul_1.asm: Rewrite.
+
+       * mpn/sparc64/ultrasparct3/submul_1.asm: Rewrite.
+
+       * mpn/sparc64/ultrasparct3/cnd_aors_n.asm: New file.
+
+       * gmp-impl.h: 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.
+
+       * mpn/sparc64/ultrasparct3/aorslsh_n.asm: New file.
+
+       * configure.ac (sparc-*-*): Recognise t5 along with t3 and t4.
+       Remove sparc64/ultrasparct1 from path_64 for T3, T3, and T5.
+
+2013-04-27  Mike Frysinger  <vapier@gentoo.org>
 
-       * NEWS: Mention the ia64 mpn_divrem_2 bugfix.
+       * configure.ac (arm*-*-*): Set up path also for plainest CPU variants.
 
-2013-07-16  Torbjorn Granlund  <tege@gmplib.org>
+2013-04-27  Torbjorn Granlund  <tege@gmplib.org>
 
-       * doc/gmp.texi: Declare countless of function arguments as 'const'.
+       * mpn/arm/v6/popham.asm: New file.
 
-2013-07-15  Torbjorn Granlund  <tege@gmplib.org>
+       * mpn/arm/v7a/cora15/cnd-aors_n.asm: New file.
 
-       * mpn/generic/sb_div_sec.c: Compute inverse as floor(B^2/(dh+1)), per
-       Niels' suggestion.
-       * mpn/generic/sbpi1_div_sec.c: Remove inverse rounding-up code.
+2013-04-25  Torbjorn Granlund  <tege@gmplib.org>
 
-2013-07-12  Torbjorn Granlund  <tege@gmplib.org>
+       * mpn/arm/mod_34lsub1.asm: Clear carry smarter.
 
-       * mpn/generic/sbpi1_div_sec.c: Partial rewrite.
+       * mpn/arm/v7a/cora15/logops_n.asm: Conditionally suppress conditionally
+       used code.
 
-2013-06-19  Torbjorn Granlund  <tege@gmplib.org>
+       * mpn/arm/v7a/cora15/submul_1.asm: New file.
 
-       * mpn/powerpc64/p6/lshift.asm: Rewrite switching-into-loop code.
-       * mpn/powerpc64/p6/rshift.asm: Likewise.
-       * mpn/powerpc64/p6/lshiftc.asm: Likewise.
+2013-04-24  Torbjorn Granlund  <tege@gmplib.org>
 
-2013-06-17  Torbjorn Granlund  <tege@gmplib.org>
+       * mpn/arm/v7a/cora15/com.asm: New file.
 
-       * mpn/powerpc64/p6/lshift.asm: Fix typo in label reference.
-       For 32-bit mode, zero extend `n' argument and split retval.
-       * mpn/powerpc64/p6/rshift.asm: Likewise.
-       * mpn/powerpc64/p6/lshiftc.asm: Likewise.
+       * mpn/arm/v7a/cora15/logops_n.asm: New file.
 
-2013-06-09  Marc Glisse  <marc.glisse@inria.fr>
+2013-04-19  Torbjorn Granlund  <tege@gmplib.org>
 
-       * mpn/generic/get_d.c (mpn_get_d): Avoid signed overflow.
-       * mpz/kronzs.c (mpz_kronecker_si): Use ABS_CAST.
+       * mpn/arm/v7a/cora15/aors_n.asm: New file.
 
-2013-05-22  Torbjorn Granlund  <tege@gmplib.org>
+       * mpn/arm/v7a/cora15/addmul_1.asm: Rewrite.
 
-       * doc/gmp.texi (Reporting Bugs): Ask for configure's output.
+2013-04-18  Torbjorn Granlund  <tege@gmplib.org>
 
-       * mpn/ia64/divrem_2.asm: Don't clobber f16-f18.
+       * mpn/alpha/tabselect.asm: New file.
 
-2013-05-20  Torbjorn Granlund  <tege@gmplib.org>
+2013-04-17  Torbjorn Granlund  <tege@gmplib.org>
 
-       * Version 5.1.2 released.
+       * mpn/powerpc32/tabselect.asm: New file.
 
-       * mpn/arm/udiv.asm: Change spacing to work around binutils bug.
+       * longlong.h (arm64 count_trailing_zeros): New.
 
-2013-05-16  Torbjorn Granlund  <tege@gmplib.org>
+       * mpn/arm64/invert_limb.asm: New file.
 
-       * Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*): Bump version info.
-       * gmp-h.in: Bump version.
+       * mpn/generic/dive_1.c: Rewrite to use Hensel division also for
+       size = 1.
 
-       * tests/misc.c (tests_hardware_getround, tests_hardware_setround):
-       Avoid assembly dependency unless WANT_ASSEMBLY.
+       * mpn/generic/mod_1_1.c (add_mssaaaa): Provide VIS3 variant.
 
-       * configure.ac (WANT_ASSEMBLY): Conditionally define.
+       * configure.ac: Remove "missing" from extra_functions_64 for coreibwl.
 
-2013-05-14  Torbjorn Granlund  <tege@gmplib.org>
+       * mpn/sparc64/ultrasparct3/mul_1.asm: Decrease loop alignment.
+       * mpn/sparc64/ultrasparct3/aormul_2.asm: Likewise.
 
-       * configure.ac (arm1156): Don't fall back to plain v6 compiler option.
+2013-04-16  Torbjorn Granlund  <tege@gmplib.org>
 
-2013-05-10  Torbjorn Granlund  <tege@gmplib.org>
+       * mpn/alpha/invert_limb.asm: Generate table.
+       * mpn/powerpc64/mode64/invert_limb.asm: Likewise.
+       * mpn/s390_64/invert_limb.asm: Likewise.
+       * mpn/sparc64/ultrasparct3/invert_limb.asm: Likewise.
+       * mpn/x86_64/invert_limb_table.asm: Likewise.
 
-       * mpn/x86/p6/mmx/gmp-mparam.h: Set down SQR_TOOM2_THRESHOLD to parent
-       directory value.
+2013-04-15  David S. Miller  <davem@davemloft.net>
 
-2013-05-09  Torbjorn Granlund  <tege@gmplib.org>
+       * mpn/sparc32/sparc-defs.m4 (LEA64): New macro.
+       * mpn/sparc64/gcd_1.asm: Use it.
+       * mpn/sparc64/ultrasparct3/dive_1.asm: Likewise.
+       * mpn/sparc64/ultrasparct3/invert_limb.asm: Likewise.
+       * mpn/sparc64/ultrasparct3/mode1o.asm: Likewise.
 
-       * mpn/x86_64/bd1/mul_1.asm: Fix typo.
+       * mpn/sparc64/gcd_1.asm: Use RODATA, TYPE, and SIZE.
 
-2013-04-29  Torbjorn Granlund  <tege@gmplib.org>
+2013-04-15  Torbjorn Granlund  <tege@gmplib.org>
 
-       * configure.ac (sparc-*-*): Recognise t5 along with t3 and t4.
-       Remove sparc64/ultrasparct1 from path_64 for T3, T3, and T5.
+       * mpn/sparc64/ultrasparct3/invert_limb.asm: Avoid addend for GOT entry,
+       it is not portable.
 
-2013-04-27  Mike Frysinger  <vapier@gentoo.org>
+       * mpn/sparc64/tabselect.asm: New file.
 
-       * configure.ac (arm*-*-*): Set up path also for plainest CPU variants.
+       * mpn/x86/mmx/tabselect.asm: New file.
+       * configure.ac (x86): Add x86/mmx to path for relevant CPUs.
+
+       * mpn/sparc64/gcd_1.asm: Use rdpc for PIC.
+       * mpn/sparc64/ultrasparct3/mode1o.asm: Use rdpc for PIC.
+       * mpn/sparc64/ultrasparct3/dive_1.asm: Use rdpc for PIC.
+       * mpn/sparc64/ultrasparct3/invert_limb.asm: Handle PIC, use rdpc.
+
+       * Revert remaining parts of recent sparc LEA changes.
+
+2013-04-14  David S. Miller  <davem@davemloft.net>
+
+       * mpn/sparc32/v9/sqr_diagonal.asm: Revert LEA and INT32 changes.
+       * mpn/sparc64/gcd_1.asm: Likewise.
+
+2013-04-13  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/bd1/tabselect.asm: New file.
+       * mpn/x86_64/coreisbr/tabselect.asm: New file.
+       * mpn/x86_64/k10/tabselect.asm: New file.
+       * mpn/x86_64/coreinhm/tabselect.asm: New file.
+       * mpn/x86_64/core2/tabselect.asm: New file.
+       * mpn/x86_64/pentium4/tabselect.asm: New file.
+
+       * mpn/x86_64/fastsse/tabselect.asm: New file.
+       * mpn/arm/neon/tabselect.asm: Rewrite.
+       * mpn/arm/tabselect.asm: Rewrite.
+       * mpn/powerpc64/tabselect.asm: Rewrite.
+       * mpn/x86_64/tabselect.asm: Rewrite.
+
+       * tune/speed.h (SPEED_ROUTINE_MPN_TABSELECT): Implement special code,
+       making .r argument be table width.
+
+2013-04-11  David S. Miller  <davem@davemloft.net>
+
+       * mpn/sparc32/sparc-defs.m4 (LEA): Remove unused local label.
+       (LEA_LEAF): Likewise.
+
+2013-04-11  Niels Möller  <nisse@lysator.liu.se>
+
+       * mpn/arm/v6/submul_1.asm: New file, using the corresponding
+       addmul_1 loop + complement trick.
+
+2013-04-10  David S. Miller  <davem@davemloft.net>
+
+       * acinclude.m4 (GMP_ASM_SPARC_GOTDATA,
+       GMP_ASM_SPARC_SHARED_THUNKS): New feature tests.
+       * configure.ac: Call GMP_ASM_SPARC_GOTDATA and
+       GMP_ASM_SPARC_SHARED_THUNKS on sparc.
+       * mpn/sparc32/sparc-defs.m4 (LEA, LEA_LEAF, LEA_THUNK): New macros.
+       * mpn/sparc32/udiv.asm: Convert over to LEA, LEA_LEAF, and LEA_THUNK.
+       * mpn/sparc32/v8/addmul_1.asm: Likewise.
+       * mpn/sparc32/v8/mul_1.asm: Likewise.
+       * mpn/sparc32/v8/supersparc/udiv.asm: Likewise.
+       * mpn/sparc32/v8/udiv.asm: Likewise.
+       * mpn/sparc64/gcd_1.asm: Likewise.
+       * mpn/sparc64/ultrasparct3/dive_1.asm: Likewise.
+       * mpn/sparc64/ultrasparct3/invert_limb.asm: Likewise.
+       * mpn/sparc64/ultrasparct3/mode1o.asm: Likewise.
+       * mpn/sparc32/v9/sqr_diagonal.asm: Likewise and use INT32.
+
+2013-04-09  Torbjorn Granlund  <tege@gmplib.org>
+
+       * longlong.h (sparc64): Test __VIS__ instead of __sparc_vis3.
+
+       * config.guess (sparc*): Invoke set_cc_for_build to get $dummy.
+
+2013-04-08  Torbjorn Granlund  <tege@gmplib.org>
+
+       * config.guess: Rework tmp file names, make sure to remove tmp files.
+
+       * mpn/arm/dive_1.asm: Rewrite count-trailing-zeros code, using private
+       table.
+
+       * mpn/arm: Canonicalise arm assembly to use old style "mov ... lsl" for
+       shift ops.
+
+2013-04-07  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/sparc64/ultrasparct3/mod_34lsub1.asm: New file.
+
+       * longlong.h (sparc64): Define umul_ppmm, add_ssaaaa, and
+       count_leading_zeros conditionally under the symbol __sparc_vis3.
+
+       * mpn/arm/dive_1.asm: New file.
+       * mpn/arm/v6/dive_1.asm: New file.
+
+       * mpn/arm/v6t2/mode1o.asm:  Make trivial change to avoid v6t2...
+       * mpn/arm/v6/mode1o.asm: ...instruction, move file accordingly.
+
+       * mpn/powerpc64/mode64/invert_limb.asm: Put all multiplies low-limb first.
+
+2013-04-04  David S. Miller  <davem@davemloft.net>
+
+       * mpn/sparc64/ultrasparct3/add_n.asm: Rewrite.
+       * mpn/sparc64/ultrasparct3/sub_n.asm: Rewrite.
+
+       * mpn/sparc64/ultrasparct3/invert_limb.asm: Align table.
+
+2013-04-04  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/sparc32/sparc-defs.m4: Provide dummy lzcnt.
+
+       * tests/mpn/logic.c: Seed using RANDS, then use mpz_rrandomb.
+
+       * tests/mpn/t-div.c (random_word): Remove.  Let callers invoke urandom.
+
+       * mpn/sparc64/ultrasparct3/mul_1.asm: Rewrite.
+
+       * mpn/sparc64/ultrasparct3/bdiv_dbm1c.asm: New file.
+       * mpn/sparc64/ultrasparct3/dive_1.asm: New file.
+       * mpn/sparc64/ultrasparct3/invert_limb.asm: New file.
+       * mpn/sparc64/ultrasparct3/mod_1_4.asm: New file.
+       * mpn/sparc64/ultrasparct3/mode1o.asm: New file.
+
+2013-04-03  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/sparc64/ultrasparct3/aormul_2.asm: Reschedule for better speed.
+
+2013-04-02  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/sparc64/ultrasparct3/missing.m4: Misc tweaks.
+        (lzcnt): New.
+       * mpn/sparc64/ultrasparct3/missing.asm (__gmpn_lzcnt): New function.
+
+       * mpn/sparc32/sparc-defs.m4: Put FAKE_T3 stuff here...
+       * mpn/sparc64/ultrasparct3/aormul_2.asm: ...moved from here.
+
+       * mpn/sparc64/ultrasparc1234/lshift.asm: Remove.
+       * mpn/sparc64/ultrasparc1234/rshift.asm: Remove.
+
+2013-04-01  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/sparc64/ultrasparct3/missing.m4 (umulxhi): Don't clobber retaddr,
+       allowing use in functions that does not do save/restore.
+
+       * mpn/sparc64/gcd_1.asm: Tweak for tighter loop.
+
+2013-03-31  David S. Miller  <davem@davemloft.net>
+
+       * mpn/sparc64/lshift.asm: New file.
+       * mpn/sparc64/rshift.asm: New file.
+       * mpn/sparc64/lshiftc.asm: New file.
+
+2013-03-31  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/sparc64/ultrasparct1/lshift.asm: Remove.
+       * mpn/sparc64/ultrasparct1/rshift.asm: Remove.
+       * mpn/sparc64/ultrasparct1/lshiftc.asm: Remove.
+
+2013-03-29  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/sparc64/ultrasparct3/aormul_2.asm: Always do mulx before umulxhi.
+
+2013-03-28  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/sparc64/mod_1_4.c (mpn_mod_1s_4p): Make precomputed arg 'const'.
+       (mpn_mod_1s_4p_cps): Update from generic code.
+
+2013-03-27  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/generic/trialdiv.c: Make variables 'const' to match tables.
+
+       * mpn/generic/mod_1_1.c (mpn_mod_1_1p): Make precomputed arg 'const'.
+       * mpn/generic/mod_1_2.c (mpn_mod_1s_2p): Likewise.
+       * mpn/generic/mod_1_3.c (mpn_mod_1s_3p): Likewise.
+       * mpn/generic/mod_1_4.c (mpn_mod_1s_4p): Likewise.
+       * gmp-impl.h: Update prototypes.
+
+       * mpn/x86_64/mulx/aorsmul_1.asm: New file.
+       * mpn/x86_64/mulx/addmul_1.asm: Remove.
+
+2013-03-26  Niels Möller  <nisse@lysator.liu.se>
+
+       Make mpn_cnd_add_n and mpn_cnd_sub_n public.
+       * doc/gmp.texi (Low-level Functions): Document mpn_cnd_add_n and
+       mpn_cnd_sub_n.
+       * gmp-h.in (mpn_cnd_add_n, mpn_cnd_sub_n): Moved prototypes
+       here...
+       * gmp-impl.h: ... from here.
+
+2013-03-26  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86/pentium4/sse2/cnd_add_n.asm: New file.
+       * mpn/x86/pentium4/sse2/cnd_sub_n.asm: New file.
+       * mpn/x86/cnd_aors_n.asm: New file.
+
+2013-03-25  David S. Miller  <davem@davemloft.net>
+
+       * mpn/sparc64/ultrasparct3/hamdist.asm: New file.
+       * mpn/sparc64/ultrasparct3/popcount.asm: New file.
+
+2013-03-25  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/ia64/aorsorrlshC_n.asm: Generalised from aorslshC_n.asm.
+       * mpn/ia64/aorsorrlsh1_n.asm: Generalised from aorslsh1_n.asm.
+       * mpn/ia64/aorsorrlsh2_n.asm: Generalised from aorslsh2_n.asm.
+
+2013-03-24  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/arm/v7a/cora15/neon/aorsorrlshC_n.asm: New file.
+       * mpn/arm/v7a/cora15/neon/aorsorrlsh2_n.asm: New file.
+       * mpn/arm/v7a/cora15/neon/aorsorrlsh1_n.asm: New file.
+       * mpn/arm/v7a/cora15/neon/rsh1aors_n.asm: New file.
+
+       * configure.ac (GMP_MULFUNC_CHOICES): Support add+sub+rsb lsh files.
+
+       * tests/refmpn.c (refmpn_addlsh_nc, refmpn_sublsh_nc): Remove silly
+       assert of mp_limb being non-negative.
+
+2013-03-21  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/arm/neon/lshiftc.asm: New file.
+
+       * mpn/arm/v6/sqr_basecase.asm: Trim 'sqr_diag_addlsh1' loop.
+
+       * gen-trialdivtab.c: Output just raw data, remove actual variables.
+       * mpn/generic/trialdiv.c: Put variables from gen-trialdivtab.c here,
+       and make them 'const'.
+
+2013-03-20  Torbjorn Granlund  <tege@gmplib.org>
+
+       * config.guess: Rework arm CPU recognition.
+       * config.sub: Corresponding updates.
+       * configure.ac: Likewise.
+
+       * mpn/x86_64/mulx/adx/addmul_1.asm: Let FAKE_MULXADX be off by default.
+
+       * mpn/arm/v7a/cora15/neon/copyi.asm: Move from "..".
+       * mpn/arm/v7a/cora15/neon/copyd.asm: Likewise.
+
+       * config.guess: Tack on "neon" for appropriate arm CPUs.
+       * configure.ac (arm*-*-*): Recognise neon suffix for a8, a9, and a15.
+
+2013-03-19 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+       * mpf/fits_u.h: Accept numbers truncating to zero before checking the
+       sign.
+       * tests/mpf/t-fits.c: Check new edges.
 
 2013-03-19  Torbjorn Granlund  <tege@gmplib.org>
 
        * tests/arm32check.c: Get printing of clobbered register right.
 
+       * mpn/arm/neon/popcount.asm: New file.
+       * mpn/arm/neon/hamdist.asm: New file.
+
        * tests/Makefile.am (EXTRA_libtests_la_SOURCES): Add arm32call.asm and
        arm32check.c.
 
        * mpn/arm/arm-defs.m4 (LEA): Rewrite to properly handle repeated use.
        (EPILOGUE_cpu): Define.
 
+       * mpn/arm/v6/addmul_3.asm: Make code work for PIC.
+
+       * tests/x86call.asm: Modernise asm syntax.
+       * tests/amd64call.asm: Likewise.
+
        * mpn/x86/darwin.m4 (m4append): Move definition from here...
        * mpn/asm-defs.m4: ...to here.
 
+2013-03-18 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+       * doc/gmp.texi (--enable-fat): No quote in concept index.
+
+       * mpf/swap.c: Reduce the number of variables.
+
 2012-03-17  Marc Glisse  <marc.glisse@inria.fr>
 
        * tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc: New file.
        * tests/cxx/Makefile.am: Add new file. Reorder the tests.
 
+2013-03-17  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/generic/mul_fft.c: Use TMP_BALLOC*, but combine several areas.
+
+       * mpz/powm_ui.c (mod): Use TMP_BALLOC in mu code.
+
+       * mpn/arm/v6/addmul_3.asm: New file.
+
+       * mpn/arm/v7a/cora15/copyd.asm: Tweak.
+
+       * mpn/arm64/copyi.asm: New file.
+       * mpn/arm64/copyd.asm: New file.
+
+2013-03-16  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/arm/v6/addmul_2.asm: Tweak for better A9 performance.
+
+2013-03-14  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/ia64/cnd_aors_n.asm: New file.
+
+       * mpn/arm64/cnd_aors_n.asm: New file.
+
+       * mpn/arm64/aors_n.asm (ADDSUB): Remove unused definition.
+
+       * mpn/ia64/aors_n.asm: Remove a redundant ASM_START.
+
+       * mpn/arm/cnd_aors_n.asm: Avoid ARM conditional insn execution.
+
+       * mpn/x86_64/missing.asm: Move from mulx/adx since we cannot currently
+       prune missing.asm from path.
+       * mpn/x86_64/mulx/adx/missing-call.m4: Likewise.
+       * mpn/x86_64/mulx/adx/missing-inline.m4: Likewise.
+       * mpn/x86_64/mulx/adx/addmul_1.asm: Update hardwired path.
+
+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>
+
+       New names mpn_cnd_add_n and mpn_cnd_sub_n.
+       * mpn/generic/cnd_add_n.c (mpn_cnd_add_n): Renamed file and
+       function, from addcnd.c:mpn_addcnd_n.
+       * mpn/generic/cnd_sub_n.c (mpn_cnd_sub_n): Renamed, from
+       subcnd.c:mpn_subcnd_n.
+       * mpn/arm/cnd_aors_n.asm: Renamed file, from aorscnd.asm, and
+       renamed functions.
+       * mpn/x86_64/cnd_aors_n.asm: Analogous renaming.
+       * mpn/powerpc64/mode64/cnd_aors_n.asm: Analogous renaming.
+       * gmp-impl.h (mpn_cnd_add_n, mpn_cnd_add_n): Updated prototypes
+       with new names.
+       * configure.ac: Updated for new names.
+       * tests/refmpn.c (refmpn_cnd_add_n): Renamed, from refmpn_addcnd_n.
+       (refmpn_cnd_sub_n): Renamed, from refmpn_subcnd_n.
+       * tests/tests.h (refmpn_cnd_add_n, refmpn_cnd_sub_n): Updated
+       prototypes with new names.
+       * tune/common.c (speed_mpn_cnd_add_n): Renamed, from
+       speed_mpn_addcnd_n, call mpn_cnd_add_n.
+       (speed_mpn_cnd_sub_n): Renamed, from speed_mpn_subcnd_n, call
+       mpn_cnd_sub_n.
+       * tune/speed.h (speed_mpn_cnd_add_n, speed_mpn_cnd_sub_n): Updated
+       prototypes with new names.
+       * tune/speed.c (routine): Updated list with new names.
+       * tests/devel/try.c: Updated for new mpn_cnd_* names.
+       * mpn/generic/sbpi1_div_sec.c: Likewise.
+       * mpn/generic/powm_sec.c: Likewise.
+
+2013-03-12  Torbjorn Granlund  <tege@gmplib.org>
+
+       * configure.ac: Add "missing" to extra_functions_64 for coreibwl.
+
+       * mpn/x86_64/mulx/adx/addmul_1.asm: Simplify.  Make FAKE_MULXADX the
+       default awaiting proper qemu behaviour.
+
 2013-03-11  Torbjorn Granlund  <tege@gmplib.org>
 
-       * tests/mpz/t-powm_ui.c: Test larger arguments.
+       * mpn/x86_64/aorscnd_n.asm: Read 32 bits for 'n' arguments on DOS64.
+
+       * tests/mpz/t-powm_ui.c: Test larger arguments.  General cleanup.
 
        * mpz/powm_ui.c (mod): Adhere to mpn_mu_div_qr's overlap requirements.
 
-2013-02-25  Niels Möller  <nisse@lysator.liu.se>
+2013-03-10  Niels Möller  <nisse@lysator.liu.se>
+
+       * mpn/generic/sbpi1_div_sec.c: Update calls of mpn_addcnd_n and
+       mpn_subcnd_n.
+       * mpn/generic/powm_sec.c (MPN_REDC_1_SEC, MPN_REDC_2_SEC)
+       (mpn_powm_sec): Update calls of mpn_subcnd_n.
+
+       * tests/tests.h (refmpn_addcnd_n, refmpn_subcnd_n): Update
+       declarations.
+       * tests/refmpn.c (refmpn_addcnd_n, refmpn_subcnd_n): Similar
+       reorder of arguments.
+       * tests/devel/try.c (call): Pass condition first, for
+       TYPE_ADDCND_N and TYPE_SUBCND_N.
+
+       * tune/common.c (speed_mpn_addcnd_n, speed_mpn_subcnd_n): Update
+       to pass condition as first argument.
+
+       * gmp-impl.h (mpn_addcnd_n, mpn_subcnd_n): Updated declarations.
+
+       * mpn/generic/addcnd_n.c (mpn_addcnd_n): Reordered arguments, make
+       condition the first argument.
+       * mpn/generic/subcnd_n.c (mpn_subcnd_n): Likewise.
+       * mpn/arm/aorscnd_n.asm: Likewise.
+       * mpn/x86_64/aorscnd_n.asm: Likewise.
+       * mpn/powerpc64/mode64/aorscnd_n.asm: Likewise.
+
+2013-03-10  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/mulx/adx/missing.asm: Simulate some mulx/adx insns.
+       * mpn/x86_64/mulx/adx/missing-call.m4: Call variant.
+       * mpn/x86_64/mulx/adx/missing-inline.m4: Inline variant.
+
+       * mpn/sparc64/ultrasparct3/missing.asm: Simulate some v9-2011 insns.
+       * mpn/sparc64/ultrasparct3/missing.m4: Inline or invoke missing.asm for
+       v9-2011 insn.
+
+       * configure.ac: Strip `haswell' from paths for now.
+
+       * mpn/x86_64/mulx/addmul_1.asm: New.
+       * mpn/x86_64/mulx/mul_1.asm: Rewrite file from `haswell' subdir.
+       * mpn/x86_64/mulx/adx/addmul_1.asm: Likewise.
+       * mpn/x86_64/haswell: Remove.
+
+       * mpn/arm/v7a/cora15/mul_1.asm: New file.
+       * mpn/arm/v7a/cora15/addmul_1.asm: New file.
+
+2013-03-09 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+       * tests/mpz/t-cong_2exp.c: Improve coverage.
+
+2013-03-09  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/sparc64/ultrasparc1234/add_n.asm: Use g5 instead of g4.
+       * mpn/sparc64/ultrasparc1234/sub_n.asm: Likewise.
+
+       * mpn/sparc64/ultrasparct3/aormul_2.asm: Fix a typo.
+
+2013-03-07  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/arm/v7a/cora9/gmp-mparam.h: New file.
+
+       * configure.ac (GMP_MULFUNC_CHOICES): Support mul_2 + addmul_2.
+
+       * mpn/sparc64/ultrasparct3/aormul_2.asm: New file.
+
+       * mpn/sparc64/ultrasparct3/submul_1.asm: Optimise out two carry
+       propagating adds.
+
+2013-03-06  David Miller  <davem@davemloft.net>
+
+       * config.guess: Recognize UltraSparc T4 under Linux.
+       * configure.ac: Add sparc64/ultrasparct3 to path_64 when T3 or T4.
+       Append -xarch=v8plusd or -xarch=v9d to command line, as needed.
+       * mpn/sparc64/ultrasparct3/mul_1.asm: New file.
+       * mpn/sparc64/ultrasparct3/addmul_1.asm: New file.
+       * mpn/sparc64/ultrasparct3/submul_1.asm: New file.
+       * mpn/sparc64/ultrasparct3/add_n.asm: New file.
+       * mpn/sparc64/ultrasparct3/sub_n.asm: New file.
+
+       * mpn/sparc32/ultrasparct1/mul_1.asm: Unroll main loop one time, add
+       T2/T3/T4 timings.
+       * mpn/sparc32/ultrasparct1/addmul_1.asm: Likewise.
+       * mpn/sparc32/ultrasparct1/submul_1.asm: Likewise.
+
+2013-03-04  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/arm/neon/lorrshift.asm: New file.
+
+2013-03-03  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/arm/v7a/cora15/copyd.asm: New file.
+       * mpn/arm/v7a/cora15/copyi.asm: New file.
+
+       * mpn/arm64/logops_n.asm: New file.
+       * mpn/arm64/gcd_1.asm: New file.
+       * mpn/arm64/aorsmul_1.asm: New file.
+       * mpn/arm64/addmul_1.asm: Remove.
+       * mpn/arm64/aors_n.asm: Complete rewrite.
+
+       * mpn/arm/tabselect.asm: New file.
+       * mpn/arm/neon/tabselect.asm: New file.
+
+       * mpn/arm/copyi.asm: Software pipeline.
+       * mpn/arm/copyd.asm: Likewise.
+
+       * config.guess: Rework tmp file handling to resemble configfsf.guess's.
+
+2013-03-03  Niels Möller  <nisse@lysator.liu.se>
+
+       * doc/gmp.texi (Integer Special Functions): Document
+       mpz_limbs_read, mpz_limbs_write, mpz_limbs_modify,
+       mpz_limbs_finish, mpz_roinit_n and MPZ_ROINIT_N.
+
+       * mpz/roinit_n.c (mpz_roinit_n): Normalize the input.
+
+2013-02-27  Niels Möller  <nisse@lysator.liu.se>
+
+       * 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
+       compiler supports c99.
+
+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.
        the mini-gmp allocation functions, including uses of mpz_get_str
        for various test failure messages.
 
-2013-02-20  Niels Möller  <nisse@lysator.liu.se>
+       * 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.
+       * mpz/limbs_write.c (mpz_limbs_write): New file and function.
+       * mpz/roinit_n.c (mpz_roinit_n): New file and function.
+       * gmp-h.in: Declare new functions.
+       (MPZ_ROINIT_N): New macro.
+       * mpz/Makefile.am (libmpz_la_SOURCES): Added new files.
+       * Makefile.am (MPZ_OBJECTS): Added new object files.
+
+       * tests/mpz/t-limbs.c: New testcase.
+       * tests/mpz/Makefile.am (check_PROGRAMS): Added t-limbs.
+
+2013-02-22  Torbjorn Granlund  <tege@gmplib.org>
+
+       * configure.ac: Fix typo in adx/mulx path stripping code.
+       * config.sub: Match coreibwl.
+
+2013-02-20  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpq/t-get_d.c (check_random): Rewrote to make test less
        dependent on float operations. Fixes problem with m68k-linux and
        extended float precision.
 
+2013-02-20  Torbjorn Granlund  <tege@gmplib.org>
+
+       * mpn/x86_64/haswell/mulx/adx/addmul_1.asm: New file.
+
+       * configure.ac: Support coreibwl.  Use proper name for ADX extension.
+       * acinclude.m4 (GMP_ASM_X86_ADX): Rename from GMP_ASM_X86_ADOX.
+
+       * 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.
+
 2013-02-17  Marc Glisse  <marc.glisse@inria.fr>
 
        * cxx/osdoprnti.cc: Use <stdarg.h> and <string.h> rather than <cstdarg>
        * tests/cxx/t-ops2.cc: Comment about more tests. Use <math.h> rather
        than <cmath> and using namespace. Don't include <iostream>.
 
+       * gmpxx.h (__GMPXX_BITS_TO_LIMBS, __GMPQ_NUM_DBL_LIMBS,
+       __GMPQ_DEN_DBL_LIMBS, __GMPXX_TMPQ_D): New macros.
+       (__gmp_binary_plus, __gmp_binary_minus, __gmp_binary_multiplies,
+       __gmp_binary_divides, __gmp_binary_equal, __gmp_binary_less,
+       __gmp_cmp_function): Use __GMPXX_TMPQ_D.
+       * tests/cxx/t-ops2.cc: Test __GMPXX_TMPQ_D on DBL_MIN, DBL_MAX.
+
+       * gmpxx.h (__gmp_binary_multiplies, __gmp_binary_divides): Use
+       __GMPXX_CONSTANT_TRUE.
+
 2013-02-16  Marc Glisse  <marc.glisse@inria.fr>
 
        * gmpxx.h: Include <algorithm>.
 
 2013-02-16  Torbjorn Granlund  <tege@gmplib.org>
 
+       * mpn/Makefile.am (TARG_DIST): Add arm64.
+
        * mpn/x86_64/x86_64-defs.m4 (PROTECT): Emit '.hidden' instead of
        '.protected" to please Sun's assembler, but also for semantic reasons.
 
+2013-02-15  Torbjorn Granlund  <tege@gmplib.org>
+
+       * configure.ac (arm64*-*-*): Match this.
+
+       * mpn/arm64/aors_n.asm: New file.
+       * mpn/arm64/addmul_1.asm: New file.
+       * mpn/arm64/mul_1.asm: New file.
+
+2013-02-15  Marc Glisse  <marc.glisse@inria.fr>
+
+       * gmpxx.h (__GMPXX_DEFINE_ARITHMETIC_CONSTRUCTORS,
+       __GMPXX_DEFINE_ARITHMETIC_ASSIGNMENTS): New macros.
+       (mpz_class, mpq_class, mpf_class) [init_ui, init_si, init_d,
+       assign_ui, assign_si, assign_d]: New functions.
+       (__gmp_expr::__gmp_expr, __gmp_expr::operator=): Replace with macros.
+       (__GMPXX_CONSTANT_TRUE): New macro.
+
+2013-02-15 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+       * gmp-impl.h (NEG_CAST, ABS_CAST): Use __GMP_CAST.
+       * mpz/fits_s.h: Use NEG_CAST.
+
+2013-02-14  Marc Glisse  <marc.glisse@inria.fr>
+
+       * gmpxx.h (__gmp_binary_greater): Forward to __gmp_binary_less.
+       (__gmp_binary_equal): Forward to itself after swapping operands.
+
+2013-02-14 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+       * mp_dv_tab.c (__gmp_digit_value_tab): Remove a line of unused values.
+       * mpf/set_str.c: Update offset accordingly.
+       * mpz/inp_str.c: Likewise.
+       * mpz/set_str.c: Likewise.
+
+       * gmp-h.in (mpq_cmp_ui): Optimise comparison with 1/1.
+       * tests/mpq/t-cmp_ui.c: Test special comparisons: 0/1, 1/1.
+
+       * mpz/clrbit.c: Reorganise branches.
+       * mpz/setbit.c: Likewise.
+       * mpz/combit.c: Same micro-optimisations as in set/clr.
+
+       * mpz/aors_ui.h: No realloc if size was zero.
+       * mpz/ior.c: Use macros: MPZ_REALLOC and MPN_INCR_U.
+
+       * gmp-impl.h (NEG_CAST): New macro, used by ABS_CAST.
+       * mpq/cmp_si.c: Use NEG_CAST.
+       * mpz/cmp_si.c: Reorganise branches.
+
+2013-02-13  Torbjorn Granlund  <tege@gmplib.org>
+
+       * acinclude.m4 (GMP_ASM_X86_MULX, GMP_ASM_X86_ADOX): New feature tests.
+       * configure.ac: Use new feature tests.
+
+       * mpn/x86_64/haswell/mulx/mul_1.asm: File moved to cope with older
+       assemblers.
+       * configure.ac: Update haswell path to include "mulx".
+
+2013-02-12  Torbjorn Granlund  <tege@gmplib.org>
+
+       * configure.ac: Recognise haswell.
+       * config.guess: Recognise haswell.
+       * config.sub: Match haswell.
+
+       * mpn/x86_64/haswell/mul_1.asm: New file, mainly for testing HNI.
+
+2013-02-12 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+       * 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.
+       * mpz/primorial_ui.c: Use MPZ_NEWALLOC.
+
+       * mpz/import.c: Use BITS_TO_LIMBS and MPZ_NEWALLOC.
+       * mpz/inp_raw.c: Likewise.
+       * mpz/rrandomb.c: Likewise.
+       * mpz/urandomb.c: Likewise.
+       * mpn/generic/random2.c: Likewise.
+
+       * mpn/generic/brootinv.c: Micro-optimisation.
+
+       * mpf/set_str.c: Don't chech base==0 when base is strictly positive.
+
 2013-02-10  Torbjorn Granlund  <tege@gmplib.org>
 
        * Version 5.1.1 released.
        * tune/speed.h (SPEED_ROUTINE_MPN_MUL): Use operands from struct s.
        * tune/README: Document new parameter syntax mpn_mul.<#> .
 
-2013-02-06  Niels Möller  <nisse@lysator.liu.se>
+2013-02-06  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpz/t-jac.c (check_large_quotients): Rewrote. Now uses a
        more efficient method for generating the test inputs.
 
        * Makefile.am (check-mini-gmp): Fix typo in last change.
 
-2013-01-22  Niels Möller  <nisse@lysator.liu.se>
+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/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>
+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.
 
        * tests/mpz/t-remove.c: Test removal of 1.
 
-2013-01-18  Niels Möller  <nisse@lysator.liu.se>
+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.
        * 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>
+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.
        From Mike Frysinger:
        * configure.ac: Add x32 ABI for x86_64.
 
-2013-01-14  Niels Möller  <nisse@lysator.liu.se>
+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-10  Torbjorn Granlund  <tege@gmplib.org>
 
-       * mini-gmp/tests/t-import.c (main): Don't drop off functon end.
+       * 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.
 
        * mini-gmp/mini-gmp.c (mpz_export): Support op=0 countp=NULL.
 
-2013-01-08  Niels Möller  <nisse@lysator.liu.se>
+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/README: Document base limitation for conversions.
        * mini-gmp/mini-gmp.c (mpz_set_str): Remove goto.
-       (mpz_import, mpz_export): Correctly use order/endianess.
+       (mpz_import, mpz_export): Correctly use order/endianness.
 
 2013-01-05  Torbjorn Granlund  <tege@gmplib.org>
 
        * mpz/neg.c: Likewise.
        * mpz/com.c: Reduce branches.
 
-2012-12-05  Niels Möller  <nisse@lysator.liu.se>
+2012-12-05  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/brootinv.c (mpn_brootinv): Make valgrind happier, at
        the cost of a redundant MPN_ZERO.
        * 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>
+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.
 
        * mpz/powm_ui.c: Rewrite.
 
-2012-11-01  Niels Möller  <nisse@lysator.liu.se>
+2012-11-01  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/brootinv.c (mpn_brootinv): Input size in limbs
        rather than bits. Use single-precision iterations for the first
        * mpz/combit.c (mpz_combit): Rewrite, optimizing for the common
        case.
 
-2012-10-31  Niels Möller  <nisse@lysator.liu.se>
+2012-10-31  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpn/Makefile.am (check_PROGRAMS): Added t-brootinv.
        * tests/mpn/t-brootinv.c: New file
 
        * tests/mpn/t-broot.c: Add a forgotten TMP_MARK.
 
-2012-10-28  Niels Möller  <nisse@lysator.liu.se>
+2012-10-28  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/broot.c (mpn_broot): New file and function.
        * configure.in (gmp_mpn_functions): Add broot.
 
        * mpn/powerpc64/aix.m4 (ASM_START): Claim machine type "any".
 
-2012-06-03  Niels Möller  <nisse@lysator.liu.se>
+2012-06-03  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/gcdext.c (mpn_gcdext): Deleted code for handling
        impossible case u1 == 0, Simplified test for unlikely case u0 == 0.
 
        * mpn/arm/v5/mod_1_1.asm: New file.
 
-2012-05-28  Niels Möller  <nisse@lysator.liu.se>
+2012-05-28  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/gcdext.c (compute_v): Simplified carry handling a
        bit, reduced stated scratch need from 2n+1 to 2n. Also comment and
 
        * mpn/x86_64/fastsse/lshift.asm: Simplify to very basic form.
 
-2012-04-11  Niels Möller  <nisse@lysator.liu.se>
+2012-04-11  Niels Möller  <nisse@lysator.liu.se>
 
        * Makefile.am (check-mini-gmp): Pass -I../.. in EXTRA_CFLAGS, to
        locate gmp.h.
 
 2012-04-02 Marco Bodrato <bodrato@mail.dm.unipi.it>
 
-       * mpz/oddfac_1.c: Initalize size for ASSERT.
+       * mpz/oddfac_1.c: Initialize size for ASSERT.
 
 2012-04-02  Torbjorn Granlund  <tege@gmplib.org>
 
 
        * gmpxx.h (std::numeric_limits): New partial specialization.
 
-2012-02-29  Niels Möller  <nisse@lysator.liu.se>
+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.
        (clean-local, distclean-local): New automake targets. Depend on
        clean-mini-gmp.
 
-2012-02-28  Niels Möller  <nisse@lysator.liu.se>
+2012-02-28  Niels Möller  <nisse@lysator.liu.se>
 
        * Makefile.am (check-mini-gmp): New target, for running the
        mini-gmp testsuite.
 
        * 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.
+       spotted by Torbjörn.
        (mpz_and, mpz_ior, mpz_xor): Likewise.
        (mpz_cmp): Fixed comparison of negative numbers.
 
 
        * mpz/oddfac_1.c (mpz_oddfac_1): Use umul_ppmm when size = 2.
 
-2012-02-26  Niels Möller  <nisse@lysator.liu.se>
+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
        * mpq/set_d.c: Likewise.
        * mpq/set_f.c: Likewise.
 
-2012-02-24  Niels Möller  <nisse@lysator.liu.se>
+2012-02-24  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/x86_64/core2/aorsmul_1.asm: Added mpn_addmul_1c and
        mpn_submul_1c entry points.
        becomes tmp=c*d, e=a*b, e-=tmp.
        * tests/cxx/t-binary.cc: More variable reuse tests.
 
-2012-02-15  Niels Möller  <nisse@lysator.liu.se>
+2012-02-15  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/tuneup.c (mul_toom43_to_toom54_threshold): New global.
        (tune_mul): Added tuning of MUL_TOOM43_TO_TOOM54_THRESHOLD.
        (MUL_TOOM43_TO_TOOM54_THRESHOLD): New threshold. Default value and
        tuning setup.
 
-2012-02-14  Niels Möller  <nisse@lysator.liu.se>
+2012-02-14  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/toom54_mul.c: New file, originally contributed by
        Marco.
        * tests/mpn/t-toom54.c: New file.
        * tests/mpn/Makefile.am (check_PROGRAMS): Added t-toom54.
 
-2012-02-13  Niels Möller  <nisse@lysator.liu.se>
+2012-02-13  Niels Möller  <nisse@lysator.liu.se>
 
        * configure.in: Display summary of options.
 
        (Multiplication Algorithms): Add Toom[68]'n'half, (too) shortly.
        * gmp-impl.h (ASSERT_ALWAYS): Consider failures UNLIKELY.
 
-2012-02-10  Niels Möller  <nisse@lysator.liu.se>
+2012-02-10  Niels Möller  <nisse@lysator.liu.se>
 
-       * tests/mpz/t-gcd.c (gcdext_valid_p): Enforce sligthly stricter
+       * tests/mpz/t-gcd.c (gcdext_valid_p): Enforce slightly stricter
        bound for cofactors.
 
        * mpn/generic/gcdext_lehmer.c (mpn_gcdext_hook): Corrected
        * mpn/powerpc32/divrem_2.asm: Fix off-by-one condition in invert_limb
        code.
 
-2012-02-08  Niels Möller  <nisse@lysator.liu.se>
+2012-02-08  Niels Möller  <nisse@lysator.liu.se>
 
        * doc/gmp.texi (mpz_gcdext): Clarified corner cases in cofactor
        canonicalization.
 
-2012-02-07  Niels Möller  <nisse@lysator.liu.se>
+2012-02-07  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/gcdext.c (mpn_gcdext): Fixed assert, related to the
        special case A = (2k+1) G, B = 2 G. Fix copied from gmp-5.0 repo.
 
-2012-02-06  Niels Möller  <nisse@lysator.liu.se>
+2012-02-06  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd_matrix.c (hgcd_matrix_update_q): Fixed carry
        handling bug. Fix copied from gmp-5.0 repo, where the function is
 
        * gmpxx.h: Remove check for g++ older than 2.91.
 
-2012-02-01  Niels Möller  <nisse@lysator.liu.se>
+2012-02-01  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/mul.c: Added diagram on where toom functions can be
        called.
        * mpn/minithres/gmp-mparam.h: Correct minimum for FAC_DSC_.
        * tune/tuneup.c (tune_fac_ui): Likewise.
 
-2012-01-15  Niels Möller  <nisse@lysator.liu.se>
+2012-01-15  Niels Möller  <nisse@lysator.liu.se>
 
        * mpz/scan0.c (mpz_scan0): Use ~(mp_bitcnt_t) 0, rather than
        ULONG_MAX, when returning "infinity".
 
        * mpz/fac_ui.c: Rewrite.
 
-2011-12-06  Niels Möller  <nisse@lysator.liu.se>
+2011-12-06  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd.c (mpn_hgcd): Use hgcd_reduce for first
        recursive call.
        (SPEED_ROUTINE_MPN_COPY): Just invoke SPEED_ROUTINE_MPN_COPY_CALL.
        (SPEED_ROUTINE_MPN_TABSELECT): New macro.
 
-2011-11-17  Niels Möller  <nisse@lysator.liu.se>
+2011-11-17  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/tuneup.c (tune_hgcd_appr): Increase stop_since_change.
 
 
        * mpn/powerpc64/mode64/aorscnd_n.asm: New file.
 
-2011-11-15  Niels Möller  <nisse@lysator.liu.se>
+2011-11-15  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/speed.h (speed_mpn_hgcd_appr_lehmer): New prototype.
        (mpn_hgcd_lehmer_itch): Likewise.
        * mpn/generic/powm_sec.c (win_size): Define only when
        TUNE_PROGRAM_BUILD is not set.
 
-2011-11-13  Niels Möller  <nisse@lysator.liu.se>
+2011-11-13  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/tuneup.c (tune_hgcd_appr): Use default min_size.
        (tune_hgcd_reduce): Increase max_size and step_factor, to 7000
 
        * mpn/powerpc64/mode64/sqr_diag_addlsh1.asm: Remove.
 
-2011-11-11  Niels Möller  <nisse@lysator.liu.se>
+2011-11-11  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/hgcd_reduce_2.c: New file.
        * tune/hgcd_reduce_1.c: New file.
 
        * mpn/s390_64/logops_n.asm: Fix rp=up code.  Remove a leftover insn.
 
-2011-10-26  Niels Möller  <nisse@lysator.liu.se>
+2011-10-26  Niels Möller  <nisse@lysator.liu.se>
 
        * gmp-impl.h (mpn_hgcd_reduce, mpn_hgcd_reduce_itch): Added
        prototypes.
 
        * mpn/s390_64/copyd.asm: New file.
 
-2011-10-10  Niels Möller  <nisse@lysator.liu.se>
+2011-10-10  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd_appr.c: Deleted debugging code.
 
        From Marco Trudel:
        * tests/mpz/t-scan.c (check_ref): Fix loop end bound.
 
-2011-10-10  Niels Möller  <nisse@lysator.liu.se>
+2011-10-10  Niels Möller  <nisse@lysator.liu.se>
 
        * gmp-impl.h: (HGCD_APPR_THRESHOLD): New threshold.
 
        (s390x count_leading_zeros): Disable until we support z10 specifically.
        (s390x add_ssaaaa): Remove algsi/slgsi until we support z10.
 
-2011-10-09  Niels Möller  <nisse@lysator.liu.se>
+2011-10-09  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd_matrix.c (mpn_hgcd_matrix_adjust): Declare
        matrix argument const.
 
-2011-10-08  Niels Möller  <nisse@lysator.liu.se>
+2011-10-08  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpn/t-hgcd_appr.c (hgcd_appr_valid_p): Adjusted the
        allowed margin of non-minimality for hgcd_appr.
        * longlong.h (s390): Add 32-bit zarch umul_ppmm and udiv_qrnnd.
        (s390): Overhaul 32-bit and 64-bit code.
 
-2011-10-07  Niels Möller  <nisse@lysator.liu.se>
+2011-10-07  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/speed.h (speed_mpn_hgcd_appr): New prototype.
        (SPEED_ROUTINE_MPN_HGCD_APPR_CALL): New macro.
        * mpn/s390_32/esame/addmul_1.asm: New file.
        * mpn/s390_32/esame/bdiv_dbm1c.asm: New file.
 
-2011-10-03  Niels Möller  <nisse@lysator.liu.se>
+2011-10-03  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpn/Makefile.am (check_PROGRAMS): Added t-mulmid.
        * tests/mpn/t-mulmid.c: New file.
        (MULMID_TOOM42_THRESHOLD): New threshold.
        (mpn_toom42_mulmid_itch): New macro.
 
-2011-10-03  Niels Möller  <nisse@lysator.liu.se>
+2011-10-03  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/tune-gcd-p.c (main): Fixed broken loop conditions.
 
 
        * configure.in: Surround tr ranges with [] for portability.
 
-2011-05-25  Niels Möller  <nisse@lysator.liu.se>
+2011-05-25  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/tune-gcd-p.c (search): New function to search for minimum.
        (main): Replaced slow linear search.
 
-2011-05-24  Niels Möller  <nisse@lysator.liu.se>
+2011-05-24  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/Makefile.am (EXTRA_PROGRAMS): Added tune-gcd-p. Also added
        related automake variables.
        * mpn/generic/gcd.c: Deleted the corresponding code, including
        main function.
 
-2011-05-23  Niels Möller  <nisse@lysator.liu.se>
+2011-05-23  Niels Möller  <nisse@lysator.liu.se>
 
-       * mpz/jacobi.c (mpz_jacobi): Simplied by swapping operands when
+       * mpz/jacobi.c (mpz_jacobi): Simplified by swapping operands when
        needed, to get asize >= bsize. Use the reciprocity law generalized
        to work when one operand is even.
 
-2011-05-22  Niels Möller  <nisse@lysator.liu.se>
+2011-05-22  Niels Möller  <nisse@lysator.liu.se>
 
        * mpz/jacobi.c (mpz_jacobi): Another bugfix for the asize == 1
        case. Sometimes, powers of two in b were taken into account twice.
 
-2011-05-21  Niels Möller  <nisse@lysator.liu.se>
+2011-05-21  Niels Möller  <nisse@lysator.liu.se>
 
        * mpz/jacobi.c (mpz_jacobi): The handling of asize == 1 was
        broken. Rewrote it.
        (check_data): Added some test cases related to the asize == 1 case
        in mpz_jacobi.
 
-2011-05-20  Niels Möller  <nisse@lysator.liu.se>
+2011-05-20  Niels Möller  <nisse@lysator.liu.se>
 
        * gmp-impl.h: Jacobi-related prototypes.
 
 
        * mpn/generic/hgcd.c (hgcd_hook): Avoid using NULL.
 
-2011-05-19  Niels Möller  <nisse@lysator.liu.se>
+2011-05-19  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/hgcd_lehmer.c (__gmpn_hgcd_itch): Don't rename symbols for
        the functions moved to hgcd_matrix.c.
        (mpn_gcdext_hook): Added some ASSERTs.
        * mpn/generic/jacobi_lehmer.c (mpn_jacobi_lehmer): Likewise.
 
-2011-05-17  Niels Möller  <nisse@lysator.liu.se>
+2011-05-17  Niels Möller  <nisse@lysator.liu.se>
 
        * doc/gmp.texi (mpn_gcd, mpn_gcdext): Document input requirements:
        Must have un >= vn > 0, and V normalized.
        * tests/cxx/t-iostream.cc: New file.
        * tests/cxx/Makefile.am: Added t-iostream.
 
-2011-05-10  Niels Möller  <nisse@lysator.liu.se>
+2011-05-10  Niels Möller  <nisse@lysator.liu.se>
 
        * doc/gmp.texi (mpz_gcd): Document that gcd(0,0) = 0.
        (mpz_gcdext): Document range for cofactors.
 
-2011-05-09  Niels Möller  <nisse@lysator.liu.se>
+2011-05-09  Niels Möller  <nisse@lysator.liu.se>
 
        * mpz/gcdext.c (mpz_gcdext): Increased sp allocation to bsize+1 limbs.
        * doc/gmp.texi (mpn_gcdext): Fixed documentation of allocation
        * mpn/x86_64/fat/fat_entry.asm (PIC_OR_DARWIN): New symbol.  Use it to
        work around Darwin problems.
 
-2011-05-04  Niels Möller  <nisse@lysator.liu.se>
+2011-05-04  Niels Möller  <nisse@lysator.liu.se>
 
        * mpz/gcdext.c (mpz_gcdext): Reduced temporary allocations. Use
        mpz_divexact when computing the second cofactor.
 2011-05-03  David Harvey  <dmharvey@cims.nyu.edu>
 
        * configure.in: make invert_limb_table work correctly with
-       --disable-assembly (from Niels Moller)
+       --disable-assembly (from Niels Möller)
 
 2011-05-02  Marc Glisse  <marc.glisse@inria.fr>
 
        * configfsf.guess: Update to version of 2011-02-02.
        * configfsf.sub: Update to version of 2011-03-23.
 
-2011-05-02  Niels Möller  <nisse@lysator.liu.se>
+2011-05-02  Niels Möller  <nisse@lysator.liu.se>
 
        * mpz/gcdext.c (mpz_gcdext): Don't allocate extra limbs at the end
        of mpn_gcdext parameters.
 
        * doc/gmp.texi (mpn_gcdext): Updated doc.
 
-2011-05-01  Niels Möller  <nisse@lysator.liu.se>
+2011-05-01  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/div_qr_2u_pi1.c (mpn_div_qr_2u_pi1): Fixed ASSERT.
 
        * acinclude.m4 (GMP_ASM_RODATA): Make 'foo' larger to avoid clang
        problems.
 
-2011-04-12  Niels Möller  <nisse@lysator.liu.se>
+2011-04-12  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/x86_64/invert_limb.asm [PIC]: Declare mpn_invert_limb_table
        as .protected.
 
        * mpn/asm-defs.m4 (define_mpn): Use deflit.
 
-2011-04-10  Niels Möller  <nisse@lysator.liu.se>
+2011-04-10  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/asm-defs.m4 (define_mpn): Added invert_limb_table.
 
        file. Extracted approximation table from invert_limb.asm, renamed
        and made global.
 
-2011-03-30  Niels Möller  <nisse@lysator.liu.se>
+2011-03-30  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/x86_64/div_qr_2u_pi1.asm: New file.
 
 
        * mpn/asm-defs.m4: Renamed div_qr_2-functions to new names.
 
-2011-03-29  Niels Möller  <nisse@lysator.liu.se>
+2011-03-29  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/x86_64/div_qr_2_pi1_norm.asm: Updated to use a separate rp
        argument.
        (mpn_div_qr_2): Likewise.
        * mpn/generic/div_qr_2_pi1_norm.c (mpn_div_qr_2_pi1_norm): Likewise.
 
-2011-03-29  Niels Möller  <nisse@lysator.liu.se>
+2011-03-29  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/x86/k7/invert_limb.asm: Use mov rather than push and pop.
        Earlier load of divisor from stack.
        * mpn/x86/k7/invert_limb.asm: Protect movzwl register parameters from
        being interpreted as m4 macro parameters.
 
-2011-03-22  Niels Möller  <nisse@lysator.liu.se>
+2011-03-22  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/x86_64/div_qr_2_pi1_norm.asm: Copied optimized inner loop
        from divrem_2.asm.
        Make powerpc add_sssaaaa work for 32-bit case, and use less strict
        constraints.
 
-2011-03-21  Niels Möller  <nisse@lysator.liu.se>
+2011-03-21  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/tuneup.c (div_qr_2_pi2_threshold): New global variable.
        (tune_div_qr_2): New function.
 
        * gmp-impl.h (DIV_QR_2_PI2_THRESHOLD): Setup for tuning.
 
-       New 4/2 division loop, based on Torbjörn's work:
+       New 4/2 division loop, based on Torbjörn's work:
        * mpn/generic/div_qr_2.c (add_sssaaaa, add_csaac): New macros.
        (udiv_qr_4by2): New macro.
        (invert_4by2): New function.
        (__gmp_binary_greater_equal): Remove, use !__gmp_binary_less.
        * tests/cxx/t-ops2.cc: Typo.
 
-2011-03-20  Niels Möller  <nisse@lysator.liu.se>
+2011-03-20  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/common.c (speed_mpn_div_qr_2_norm): New function.
        (speed_mpn_div_qr_2_unnorm): New function.
        * mpz/fac_ui.c (mpz_fac_ui): Use MPZ_REALLOC for standard, conditional
        reallocation.
 
-2011-03-19  Niels Möller  <nisse@lysator.liu.se>
+2011-03-19  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/divrem_2.c (mpn_divrem_2): Fixed comment and assert
        regarding q and n overlap.
        * mpn/x86_64/coreinhm/aorrlsh_n.asm: Likewise.
        * mpn/x86_64/coreisbr/aorrlsh2_n.asm: Likewise.
 
-2011-03-03  Niels Möller  <nisse@lysator.liu.se>
+2011-03-03  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/mod_1_1.c (add_mssaaaa): For x86 and x86_64, treat m
        as in output operand only. Added sparc32 implementation. Also
 
        * tune/tuneup.c (tune_mod_1): Record result of MOD_1_1P_METHOD
        measurement for use by mpn_mod_1_tune. And omit measurement if
-       mpn_mod_1_1p is native assebly code.
+       mpn_mod_1_1p is native assembly code.
 
        * mpn/generic/mod_1.c (mpn_mod_1_1p) [TUNE_PROGRAM_BUILD]: Macro
        to check mod_1_1p_method and call the right function.
        * mpn/x86_64/coreinhm/aorrlsh_n.asm: New file.
        * mpn/x86_64/coreisbr/aorrlsh_n.asm: New file.
 
-2011-03-01  Niels Möller  <nisse@lysator.liu.se>
+2011-03-01  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/x86_64/mod_1_1.asm (mpn_mod_1_1p_cps): Eliminated a neg and
        two mov instructions.
        (udiv_rnnd_preinv): Likewise.
        * mpn/generic/mod_1_1.c (mpn_mod_1_1p): Likewise.
 
-2011-02-28  Niels Möller  <nisse@lysator.liu.se>
+2011-02-28  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/mod_1_1.c (add_mssaaaa): Typo fix, define
        add_mssaaaa, not add_sssaaaa.
 
        * mpn/x86/atom/sse2/mul_1.asm: New code.
 
-2011-02-27  Niels Möller  <nisse@lysator.liu.se>
+2011-02-27  Niels Möller  <nisse@lysator.liu.se>
 
        * gmp-impl.h (udiv_rnnd_preinv): New macro.
 
        * mpn/x86/p6/sse2/mod_1_1.asm: New file.
        * mpn/x86/p6/sse2/mod_1_4.asm: Fix typo in MULFUNC_PROLOGUE.
 
-2011-02-24  Niels Möller  <nisse@lysator.liu.se>
+2011-02-24  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/x86/k7/mod_1_1.asm (mpn_mod_1_1p): Rewrite using the same
        algorithm as the x86_64 version.
 
        * mpn/x86/atom/logops_n.asm: New file (same loop as aors_n).
 
-2011-02-23  Niels Möller  <nisse@lysator.liu.se>
+2011-02-23  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/x86_64/mod_1_1.asm (mpn_mod_1_1p): Shaved off one
        instruction and one register in the inner loop. Rearranged
        * mpn/x86_64/nano/gmp-mparam.h (SHLD_SLOW, SHRD_SLOW): Define.
        * mpn/x86_64/atom/gmp-mparam.h (SHLD_SLOW, SHRD_SLOW): Define.
 
-2011-02-22  Niels Möller  <nisse@lysator.liu.se>
+2011-02-22  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/x86_64/mod_1_1.asm (mpn_mod_1_1p): Rewrite.
 
        * mpn/x86/atom/mode1o.asm: New file, grabbing another asm file.
        * mpn/x86/atom/mul_1.asm: Claim mul_1c.
 
-2011-02-02  Niels Möller  <nisse@lysator.liu.se>
+2011-02-02  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/speed.h (SPEED_ROUTINE_MPN_HGCD_CALL): Fixed one
        speed_operand_dst call.
        * mpn/x86_64/pentium4/aorslshC_n.asm: Likewise.
        * mpn/x86/k7/gcd_1.asm: Likewise.
 
-2010-08-20  Niels Möller  <nisse@lysator.liu.se>
+2010-08-20  Niels Möller  <nisse@lysator.liu.se>
 
        Suggested by Ozkan Sezer:
        * configure.in: If $M4 is already set in the environment, don't
 
        * mpn/x86_64/divrem_2.asm: Tune.
 
-2010-06-19  Niels Möller  <nisse@lysator.liu.se>
+2010-06-19  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/speed.h (SPEED_ROUTINE_MPN_MOD_1_1): Pass normalized
        divisor to the benchmarked function.
 
        * mpn/x86/k7/invert_limb.asm: Moved from mpn/x86/invert_limb.asm.
 
-2010-06-15  Niels Möller  <nisse@lysator.liu.se>
+2010-06-15  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpn/Makefile.am (check_PROGRAMS): Added t-mod_1.
        * tests/mpn/t-mod_1.c: New file.
 
        * mpn/x86_64/pentium4/gmp-mparam.h: Disable mpn_addlsh_n, mpn_rsblsh_n.
 
-2010-05-12  Niels Möller  <nisse@lysator.liu.se>
+2010-05-12  Niels Möller  <nisse@lysator.liu.se>
 
        * mpz/jacobi.c (mpz_jacobi): Fixed off-by-one error in use of
        scratch space.
 
        * mpn/x86_64/pentium4/lshiftc.asm: New file.
 
-2010-05-11  Niels Möller  <nisse@lysator.liu.se>
+2010-05-11  Niels Möller  <nisse@lysator.liu.se>
 
        * mpz/jacobi.c (mpz_jacobi): Deleted old implementation.
        Reorganized new implementation, to handle small inputs efficiently.
        * mpn/generic/mod_1_1.c: Undo last change.
        * mpn/x86_64/mod_1_1.asm: Likewise.
 
-2010-05-03  Niels Möller  <nisse@lysator.liu.se>
+2010-05-03  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/jacobi_lehmer.c (jacobi_hook): New function.
        (mpn_jacobi_subdiv_step): Deleted function.
        * configure.in (powerpc64): Support CPU specific mode-less subdirs.
 
        * mpn/powerpc64/aix.m4 (PROLOGUE_cpu): Use "named csect" making
-       requested aignment actually honoured.
+       requested alignment actually honoured.
 
-2010-04-30  Niels Möller  <nisse@lysator.liu.se>
+2010-04-30  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/jacobi_lehmer.c (mpn_jacobi_2): Fixed handling of
        the case bl == 1. Fixed missing application of reciprocity.
 
-2010-04-29  Niels Möller  <nisse@lysator.liu.se>
+2010-04-29  Niels Möller  <nisse@lysator.liu.se>
 
        * configure.in (gmp_mpn_functions): Deleted gcdext_subdiv_step.
 
        * mpn/powerpc64/darwin.m4: Likewise.
        * mpn/powerpc64/elf.m4: Likewise.
 
-2010-04-28  Niels Möller  <nisse@lysator.liu.se>
+2010-04-28  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpz/t-jac.c (check_data): Added some more test cases.
 
 
        * mpn/powerpc64/mode64/p6/mul_basecase.asm: New file.
 
-2010-04-23  Niels Möller  <nisse@lysator.liu.se>
+2010-04-23  Niels Möller  <nisse@lysator.liu.se>
 
        * gmp-impl.h (MPN_GCD_LEHMER_N_ITCH): Deleted.
        (mpn_gcd_lehmer_n): Deleted declaration.
        * mpn/powerpc64/mode64/aorslshC_n.asm: Swap ldx operands as a temporary
        workaround for POWER6 pipeline glitch.
 
-2010-04-19  Niels Möller  <nisse@lysator.liu.se>
+2010-04-19  Niels Möller  <nisse@lysator.liu.se>
 
        * mpz/jacobi.c (mpz_jacobi): New implementation using
        mpn_jacobi_lehmer. Currently #if:ed out.
 
        * configure.in (gmp_mpn_functions): Added jacobi_lehmer.
 
-2010-04-14  Niels Möller  <nisse@lysator.liu.se>
+2010-04-14  Niels Möller  <nisse@lysator.liu.se>
 
        * configure.in (gmp_mpn_functions): Added
        matrix22_mul1_inverse_vector.
        * mpn/powerpc64/mode64/addmul_1.asm: Remove.
        * mpn/powerpc64/mode64/submul_1.asm: Remove.
 
-2010-03-11  Niels Möller  <nisse@lysator.liu.se>
+2010-03-11  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/gcd_lehmer.c (gcd_2): Use sub_ddmmss.
 
 
        * doc/gmp.texi (Language Bindings): Update Python site, add Ruby.
 
-2010-03-10  Niels Möller  <nisse@lysator.liu.se>
+2010-03-10  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/tuneup.c (tune_jacobi_base): Consider mpn_jacobi_base_4.
        * tune/speed.c (routine): Added mpn_jacobi_base_4.
        * mpn/generic/jacbase.c (mpn_jacobi_base): New function, for
        JACOBI_BASE_METHOD 4.
 
-2010-03-09  Niels Möller  <nisse@lysator.liu.se>
+2010-03-09  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpz/t-jac.c (check_large_quotients): Also generate inputs
        with large quotients and a large gcd.
 
        * mpn/x86_64/core2/divrem_1.asm: New file.
 
-2010-02-26  Niels Möller  <nisse@lysator.liu.se>
+2010-02-26  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/speed.c (routine): Added udiv_qrnnd_preinv3.
 
        * tune/common.c (speed_udiv_qrnnd_preinv3): New function.
        * tune/speed.h: Added prototype for it.
 
-2010-02-26  Niels Möller  <nisse@lysator.liu.se>
+2010-02-26  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpz/t-jac.c (check_large_quotients): New test. Currently
        disabled, since it's quite slow.
 
        * mpn/pa64/aors_n.asm: Fix typo in last change.
 
-2010-02-25  Niels Möller  <nisse@lysator.liu.se>
+2010-02-25  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpz/t-jac.c (ref_jacobi): New reference implementation,
        using factorization and legendre symbols computed by powm.
 
        * mpn/generic/sqrtrem.c: Use CNST_LIMB.
 
-2010-02-20  Niels Möller  <nisse@lysator.liu.se>
+2010-02-20  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/speed.h (mpn_gcd_accel): Deleted prototype.
        (mpn_hgcd_lehmer): New prototype.
        around hgcd_step.
        (mpn_hgcd_itch): Substitute n for MPN_HGCD_LEHMER_ITCH (n).
 
-2010-02-19  Niels Möller  <nisse@lysator.liu.se>
+2010-02-19  Niels Möller  <nisse@lysator.liu.se>
 
        * Makefile.am (mpn/jacobitab.h): Added the rules needed to
        generate this file.
        * mpn/generic/powm.c: Honour SQR_BASECASE_THRESHOLD in innerloop
        expansions.
 
-2010-02-16  Niels Möller  <nisse@lysator.liu.se>
+2010-02-16  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/time.c (cgt_works_p): Added rudimentary sanity check for
        clock_gettime working.
 
-2010-02-15  Niels Möller  <nisse@lysator.liu.se>
+2010-02-15  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/time.c (speed_time_init): Make use of cycle counter
        configurable, via the speed_option_cycles_broken flag.
        counter on linux. Needs to be replaced by something more
        selective.
 
-2010-02-11  Niels Möller  <nisse@lysator.liu.se>
+2010-02-11  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/time.c (speed_time_init): Fix speed_time_string when using
        clock_gettime.
        * tune/common.c: Whitespace cleanup.
        (speed_mpn_matrix22_mul): Rewrite.
 
-2010-01-21  Niels Möller  <nisse@lysator.liu.se>
+2010-01-21  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/nussbaumer_mul.c (mpn_nussbaumer_mul): Take
        advantage of new mpn_mulmod_bnm1 interface, to reduce allocation.
        * perfpow.c (mpn_perfect_power_p): Call mpn_divexact instead of
        mpn_bdiv_q (with too little scratch space!).
 
-       From Niels Möller:
+       From Niels Möller:
        * tests/mpn/t-div.c (check_one): Get rid of the poorly managed variable
        tn.
 
        * mpn/generic/div_q.c: Use SB division for small quotients as well as
        small divisors.  Fix typo in itch call.
 
-2010-01-06  Niels Möller  <nisse@lysator.liu.se>
+2010-01-06  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpn/t-div.c (check_one): Checking based on multiplication,
        refmpn_mul, rather than refmpn_tdiv_qr.
        * mpn/generic/toom22_mul.c (TOOM22_MUL_REC): New name for
        TOOM22_MUL_MN_REC.
 
-2009-12-26  Niels Möller  <nisse@lysator.liu.se>
+2009-12-26  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpn/t-toom32.c (MIN_AN, MIN_BN, MAX_BN): Relax
        requirements a bit.
        (mpn_toom8_sqr_itch): Rename to mpn_toom8_mul_n_itch and redefine.
        * mpn/generic/mul_n.c: Use renamed _itch macros.
 
-2009-12-25  Niels Möller  <nisse@lysator.liu.se>
+2009-12-25  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpn/t-toom32.c (MIN_AN, MIN_BN, MAX_BN): Tightened requirements.
        * gmp-impl.h (mpn_toom32_mul_itch): Updated. Less scratch needed
 
        * mpn/generic/mu_div_q.c (mpn_mu_div_q_itch): New function.
 
-2009-12-22  Niels Möller  <nisse@lysator.liu.se>
+2009-12-22  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/sbpi1_div_q.c: Use udiv_qr_3by2.  Intended to change
        nothing after preprocessing.
        * mpn/generic/bdiv_qr.c (mpn_bdiv_qr): Simplify, don't allocate.
        (mpn_bdiv_qr_itch): Conditionalise on MU_BDIV_QR_THRESHOLD.
 
-2009-12-18  Niels Möller  <nisse@lysator.liu.se>
+2009-12-18  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpn/t-bdiv.c: Add red-zones.
 
        * configure.in: Add corresponding HAVE_NATIVEs.
        * mpn/x86_64/rsh1aors_n.asm: Add _nc entry point.
 
-2009-12-18  Niels Möller  <nisse@lysator.liu.se>
+2009-12-18  Niels Möller  <nisse@lysator.liu.se>
 
        * mpz/divexact.c: Rewrite to use mpn_divexact.
 
 
        * gmp-impl.h: Renew default values for all THRESHOLDs.
 
-2009-12-17  Niels Möller  <nisse@lysator.liu.se>
+2009-12-17  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/divexact.c (mpn_divexact): Don't require that the
        dividend is normalized. Use MPN_DIVREM_OR_PREINV_DIVREM_1. When
        non-WANT_REDC_2 INNERLOOP expansion code.
        * mpn/generic/powm_sec.c: Use mp_bitcnt_t for bit counts.
 
-2009-12-16  Niels Möller  <nisse@lysator.liu.se>
+2009-12-16  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpz/t-gcd.c (main): Added test case to exercise the
        unlikely u0 == u1 case in mpn_gcdext_lehmer_n.
 
        * mpn/generic/gcdext_subdiv_step.c: Get an ASSERT right.
 
-2009-12-15  Niels Möller  <nisse@lysator.liu.se>
+2009-12-15  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/sbpi1_div_qr.c (mpn_sbpi1_div_qr): A very small step
        towards nail support.
        * gmp-impl.h (mpn_ni_invertappr): Added prototype and name-mangling.
        * mpn/generic/mulmod_bnm1.c: Comment representation of class [0].
 
-2009-12-14  Niels Möller  <nisse@lysator.liu.se>
+2009-12-14  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/sbpi1_divappr_q.c (mpn_sbpi1_divappr_q): Use
        udiv_qr_3by2.
        * mpn/generic/invert.c: Improved comments.
        (mpn_bc_invertappr): Conditionally re-enable mpn_dcpi1_divappr_q.
 
-2009-12-14  Niels Möller  <nisse@lysator.liu.se>
+2009-12-14  Niels Möller  <nisse@lysator.liu.se>
 
        * gmp-impl.h (udiv_qr_3by2): Fix typo in argument list.
 
-2009-12-13  Niels Möller  <nisse@lysator.liu.se>
+2009-12-13  Niels Möller  <nisse@lysator.liu.se>
 
        * gmp-impl.h (udiv_qr_3by2): New macro.
        * mpn/generic/sbpi1_div_qr.c (mpn_sbpi1_div_qr): Use udiv_qr_3by2.
 
        * mpz/powm.c: Rework buffer handling.
 
-2009-12-13  Niels Möller  <nisse@lysator.liu.se>
+2009-12-13  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpn/toom-shared.h (main): Use refmpn_mul_basecase to check
        results (slow!). Iteration counts of all toom tests reduced
 
        * mpn/*/gmp-mparam.h: Regenerate many of these files.
 
-2009-12-10  Niels Möller  <nisse@lysator.liu.se>
+2009-12-10  Niels Möller  <nisse@lysator.liu.se>
 
        * gmp-impl.h (mpn_divexact): Removed scratch pointer from
        prototype.
 
        * mpn/generic/mulmod_bnm1.c (mpn_bc_mulmod_bnm1,
        mpn_bc_mulmod_bnp1): Added a parameter for scratch area, possibly
-       same as result area (as suggested by Niels Möller).
+       same as result area (as suggested by Niels Möller).
        (mpn_mulmod_bnm1): Calls changed accordingly.
 
-2009-12-08  Niels Möller  <nisse@lysator.liu.se>
+2009-12-08  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/gcdext_1.c (mpn_gcdext_1) [GCDEXT_1_USE_BINARY]: Use
        table lookup for count_trailing_zeros. Binary algorithm still
 
        * mpn/generic/gcdext.c: Add a TMP_FREE.
 
-2009-12-03  Niels Möller  <nisse@lysator.liu.se>
+2009-12-03  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/gcdext_1.c (mpn_gcdext_1) [GCDEXT_1_USE_BINARY]:
        Added various masking tricks.
        (refmpn_rsblsh1_n): Use generic refmpn_rsblsh_n.
        * tests/tests.h: Declare new functions.
 
-2009-12-03  Niels Möller  <nisse@lysator.liu.se>
+2009-12-03  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/gcdext_subdiv_step.c (mpn_gcdext_subdiv_step):
        Select the right cofactor in the cases A == B or A == 2B.
        Select the right cofactor in the case ap[0] == bp[0].
        * mpn/generic/gcdext.c (mpn_gcdext): Analogous changes.
 
-2009-12-02  Niels Möller  <nisse@lysator.liu.se>
+2009-12-02  Niels Möller  <nisse@lysator.liu.se>
 
        * gmp-h.in (mpn_gcdext_1): Updated prototype.
        * mpn/generic/gcdext_lehmer.c (mpn_gcdext_lehmer_n): Updated for
 
        * tune/speed.h (SPEED_ROUTINE_REDC_N): Set min size properly.
 
-2009-12-01  Niels Möller  <nisse@lysator.liu.se>
+2009-12-01  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/speed.c (routine): Added mpn_toom42_mul and mpn_redc_n.
        * tune/speed.h (SPEED_ROUTINE_MPN_TOOM42_MUL): New macro.
 
        * tune/speed.c (routine): Add entry related to mpn_mulmod_bnm1.
 
-2009-11-19  Niels Möller  <nisse@lysator.liu.se>
+2009-11-19  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/toom_eval_dgr3_pm2.c (mpn_toom_eval_dgr3_pm2)
        [HAVE_NATIVE_mpn_add_n_sub_n]: Fixed typo in mpn_add_n_sub_n call
        * mpn/asm-defs.m4 (define_mpn): Add addlsh_n.
        * gmp-impl.h (mpn_addlsh_n): Added prototype and name-mangling.
 
-2009-11-19  Niels Möller  <nisse@lysator.liu.se>
+2009-11-19  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/toom_eval_pm2.c (mpn_toom_eval_pm2): New file.
        * mpn/generic/toom53_mul.c (mpn_toom53_mul): Use mpn_toom_eval_pm2.
          SQR_KARATSUBA_THRESHOLD => SQR_TOOM2_THRESHOLD,
        and associated names analogously.
 
-2009-10-31  Niels Möller  <nisse@lysator.liu.se>
+2009-10-31  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/toom_interpolate_7pts.c: Changed evaluation points,
        replacing -1/2 by -2.
 
        * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Add toom2* and toom3* files.
 
-2009-10-30  Niels Möller  <nisse@lysator.liu.se>
+2009-10-30  Niels Möller  <nisse@lysator.liu.se>
 
        * configure.in (gmp_mpn_functions): Added toom_eval_dgr3_pm2.
        * gmp-impl.h: Added prototype for mpn_toom_eval_dgr3_pm2.
        * mpn/generic/toom_eval_dgr3_pm2.c: New file.
 
-2009-10-29  Niels Möller  <nisse@lysator.liu.se>
+2009-10-29  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/toom43_mul.c (mpn_toom43_mul): Use
        mpn_toom_eval_dgr3_pm1.
        * mpn/generic/mul_fft.c (mpn_mul_fft): Make it return high limb.
        (mpn_mul_fft_internal): Likewise.
 
-       * mpn/generic/mulmod_bnm1.c: New file, by Niels Möller.
+       * mpn/generic/mulmod_bnm1.c: New file, by Niels Möller.
        * configure.in (gmp_mpn_functions): Add mulmod_bnm1.
        * gmp-impl.h: Add related declarations.
        * tune/tuneup.c: Tune MULMOD_BNM1_THRESHOLD.
        * tune/speed.h: Likewise.
        * tests/devel/try.c: Test new mul/sqr functions, remove old tests.
 
-2009-10-29  Niels Möller  <nisse@lysator.liu.se>
+2009-10-29  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/speed.c: Added support for mpn_toom4_sqr,
 
        declarations.
        (mpn_toom2_sqr_itch): Add margin for recursive calls.
 
-2009-10-28  Niels Möller  <nisse@lysator.liu.se>
+2009-10-28  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/mul_n.c (mpn_kara_mul_n): Deleted old Karatsuba
        implementation.
        (gmp_pi1_t, gmp_pi2_t): New types.
        (invert_pi1): New macro for computing 2/1 and 3/2 inverses.
 
-2009-10-23  Niels Möller  <nisse@lysator.liu.se>
+2009-10-23  Niels Möller  <nisse@lysator.liu.se>
 
        * gmp-impl.h (mpn_toom62_mul_itch): New function.
 
        * mpn/generic/get_d.c: Fix code handling denorms for 64-bit machines.
        * tests/mpf/t-get_d.c (test_denorms): New function.
 
-2009-10-23  Niels Möller  <nisse@lysator.liu.se>
+2009-10-23  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/toom52_mul.c (mpn_toom52_mul): Use supplied scratch
        space, not TMP_ALLOC. Interface change, now requires input sizes
 
        * mpn/x86_64/sqr_basecase.asm: Tune for speed and a 7% size decrease.
 
-2009-10-22  Niels Möller  <nisse@lysator.liu.se>
+2009-10-22  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpn/t-toom44.c: New test program.
        * tests/mpn/t-toom33.c: New test program.
        * tests/refmpn.c (refmpn_mullow_n): New function.
        * tests/tests.h: Declare it.
 
-2009-10-21  Niels Möller  <nisse@lysator.liu.se>
+2009-10-21  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpn/toom-shared.h (main): Check for writes outside of the
        product or scratch area.
        space, not TMP_ALLOC. Interface change, now requires input sizes
        such that s + t >= 5.
 
-2009-10-20  Niels Möller  <nisse@lysator.liu.se>
+2009-10-20  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpn/toom-shared.h (MIN_BLOCK): New constant, which can be
        overridden by users. Needed by t-toom42 and t-toom43.
        * tests/mpn/toom-shared.h: New file. Test framework for Toom
        functions.
 
-2009-10-14  Niels Möller  <nisse@lysator.liu.se>
+2009-10-14  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd.c (mpn_hgcd_itch): Thanks to the new
        mpn_matrix22_mul_strassen, the scratch need is reduced by 16%.
        TOOM22_MUL_N_REC.  Unconditionally call the generic mpn_mul_n.
        * mpn/generic/toom32_mul.c: Analogous changes.
 
-2009-09-28  Niels Möller  <nisse@lysator.liu.se>
+2009-09-28  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/x86_64/invert_limb.asm: Rewrite. Exploit cancellation in the
        Newton iteration.
 
-2009-09-27  Niels Möller  <nisse@lysator.liu.se>
+2009-09-27  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/x86/invert_limb.asm: Reduce register usage. Eliminated $1
        arguments to add, sub and shift.
 
-2009-09-25  Niels Möller  <nisse@lysator.liu.se>
+2009-09-25  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/x86/invert_limb.asm: New file.
 
        * mpf/set_str.c: Likewise.
        * mpz/set_str.c: Likewise.
 
-2009-07-03  Niels Möller  <nisse@lysator.liu.se>
+2009-07-03  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/gcd_1.c (mpn_gcd_1): Use masking tricks to reduce
        the number of branches in the loop.
        * dumbmp.c (isprime): Replace with slightly less inefficient code.
        (mpz_tdiv_r): New function.
 
-2009-06-11  Niels Möller  <nisse@lysator.liu.se>
+2009-06-11  Niels Möller  <nisse@lysator.liu.se>
 
        Support for mpn_toom32_mul in speed:
        * tune/speed.c (routine): Added mpn_toom32_mul.
        * mpn/x86/p6/mod_1.asm: Likewise.
        * mpn/x86/pentium/mod_1.asm: Likewise.
 
-2009-06-08  Niels Möller  <nisse@lysator.liu.se>
+2009-06-08  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/toom4_sqr.c (mpn_toom4_sqr): Reorganized, to reduce
        the need for scratch space, and get rid of TMP_ALLOC. Also use
        FFT_TABLE2_SIZE if they are defined.
        (struct nk): Use bit field.
 
-2009-06-05  Niels Möller  <nisse@lysator.liu.se>
+2009-06-05  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/toom44_mul.c (mpn_toom44_mult): Use
        mpn_toom_eval_dgr3_pm1.
        * tests/mpz/t-nextprime.c: New test file.
        * tests/mpz/Makefile.am (check_PROGRAMS): Add t-nextprime.
 
-       From Niels Möller:
+       From Niels Möller:
        * mpz/nextprime.c: Handle large prime gaps by limiting incr.
 
 2009-01-04  Torbjorn Granlund  <tege@gmplib.org>
 
        * mpn/x86/fat/diveby3.c: New file.
 
-2008-12-30  Niels Möller  <nisse@lysator.liu.se>
+2008-12-30  Niels Möller  <nisse@lysator.liu.se>
 
        * doc/gmp.texi (Greatest Common Divisor Algorithms): Updated
        section on GCD algorithms.
 
        * mpn/x86/k7/mod_34lsub1.asm: Use movzb for masking low 8 bits.
 
-2008-10-31  Niels Möller  <nisse@lysator.liu.se>
+2008-10-31  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd2.c (div1): New function (taken from old gcdext
        implementation)
 
        * gmp-h.in (mpn_gcdext_1): Remove bogus __GMP_ATTRIBUTE_PURE.
 
-2008-10-27  Niels Möller  <nisse@lysator.liu.se>
+2008-10-27  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/common.c (speed_mpn_hgcd): Call mpn_hgcd_matrix_init once
        for each call to mpn_hgcd.
 
        * mpz/nextprime.c: Move declarations to function beginning.
 
-2008-10-23  Niels Möller  <nisse@lysator.liu.se>
+2008-10-23  Niels Möller  <nisse@lysator.liu.se>
 
        * gmp-impl.h (DECL_gcdext_1): Deleted.
 
 
 2008-10-21  Torbjorn Granlund  <tege@gmplib.org>
 
-       With Neils Möller:
+       With Neils Möller:
        * mpz/nextprime.c: Rewrite.
 
        * tests/devel/try.c (main): Use strtol for 's' and 'S' optargs.
 
        * configure.in: Set up specific path for x86_64/atom.
 
-2008-10-21  Niels Möller  <nisse@lysator.liu.se>
+2008-10-21  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/Makefile.am (nodist_EXTRA_libmpn_la_SOURCES): Removed
        qstack.c.
        * mpn/x86_64/mul_basecase.asm: Use lea directly for loading entry point
        addresses.
 
-2008-10-09  Niels Möller  <nisse@lysator.liu.se>
+2008-10-09  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/x86/k7/gmp-mparam.h: Updated GCD-related values.
 
 
        * mpn/minithres/gmp-mparam.h: Update FFT values.
 
-2008-10-02  Niels Möller  <nisse@lysator.liu.se>
+2008-10-02  Niels Möller  <nisse@lysator.liu.se>
 
        * hgcd.c (mpn_hgcd_matrix_mul): Fixed normalization bug.
 
 
        * tune/common.c: Corresponding changes.
 
-2008-09-22  Niels Möller  <nisse@lysator.liu.se>
+2008-09-22  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/gcdext.c (hgcd_mul_matrix_vector): New function,
        replaces addmul2_n. Needs less copying.
        modification in place still need to copy one of the inputs.
        (mpn_hgcd_mul_matrix1_inverse_vector): Likewise.
 
-2008-09-22  Niels Möller <nisse@lysator.liu.se>  <nisse@king.swox.se>
+2008-09-22  Niels Möller <nisse@lysator.liu.se>  <nisse@king.swox.se>
 
        * mpn/generic/hgcd.c (hgcd_matrix_mul_1): Use mpn_addaddmul_1msb0.
        * mpn/generic/hgcd2.c (mpn_hgcd_mul_matrix1_vector): Likewise.
        (DIVEXACT_BY3_METHOD): Don't default to 0 if
        HAVE_NATIVE_mpn_divexact_by3c.
 
-2008-09-18  Niels Möller  <nisse@lysator.liu.se>
+2008-09-18  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/gcd.c (main): Added code for tuning of CHOOSE_P.
 
        * mpn/generic/hgcd.c (mpn_hgcd_matrix_mul): Assert that inputs are
        normalized.
 
-2008-09-17  Niels Möller <nisse@lysator.liu.se>  <nisse@king.swox.se>
+2008-09-17  Niels Möller <nisse@lysator.liu.se>  <nisse@king.swox.se>
 
        * mpn/generic/gcdext.c (mpn_gcdext): p = n/5 caused a
        slowdown for large inputs. As a compromise, use p = n/2 for the
        Choose function depending on DIVEXACT_BY3_METHOD.
        * gmp-impl.h (DIVEXACT_BY3_METHOD): Provide default.
 
-2008-09-16  Niels Möller  <nisse@lysator.liu.se>
+2008-09-16  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd.c (mpn_hgcd_addmul2_n): Moved function to
        gcdext.c, where it is used.
        Deleted rn argument.
        (mpn_gcdext): Updated calls to addmul2_n, and added assertions.
 
-       * gmp-impl.h (MPN_HGCD_MATRIX_INIT_ITCH): Increased storage by four limbs.
+       * gmp-impl.h (MPN_HGCD_MATRIX_INIT_ITCH): Increased storage by 4 limbs.
        (MPN_HGCD_LEHMER_ITCH): Reduced storage by one limb.
        (MPN_GCD_SUBDIV_STEP_ITCH): Likewise.
        (MPN_GCD_LEHMER_N_ITCH): Likewise.
 
        * mpn/generic/hgcd.c (mpn_hgcd_matrix_init): Use two extra limbs.
        (hgcd_step): Use overlapping arguments to mpn_tdiv_qr.
-       (mpn_hgcd_matrix_mul): Deleted normalization code. Tigher bounds
+       (mpn_hgcd_matrix_mul): Deleted normalization code. Tighter bounds
        for the element size of the product. Needs two extra limbs of
        storage for the elements.
        (mpn_hgcd_itch): Updated storage calculation.
 
        * mpn/generic/gcd.c (mpn_gcd): Use mpn_zero_p.
 
-2008-09-15  Niels Möller  <nisse@lysator.liu.se>
+2008-09-15  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd.c (mpn_hgcd_matrix_init): Updated for deleted
        tp pointer.
        (MPN_HGCD_MATRIX_INIT_ITCH): Reduced storage.
        (mpn_hgcd_step, MPN_HGCD_STEP_ITCH): Deleted declarations.
 
-2008-09-15  Niels Möller <nisse@lysator.liu.se>  <nisse@king.swox.se>
+2008-09-15  Niels Möller <nisse@lysator.liu.se>  <nisse@king.swox.se>
 
        * mpn/x86_64/gmp-mparam.h (MATRIX22_STRASSEN_THRESHOLD): New
        threshold.
        * mpn/generic/gcd.c (mpn_gcd): Fixed calculation of scratch space,
        and use mpn_hgcd_itch.
 
-2008-09-15  Niels Möller  <nisse@lysator.liu.se>
+2008-09-15  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/tuneup.c (tune_matrix22_mul): New function.
        (all): Use it.
        * tests/mpn/t-matrix22.c: New file.
        * mpn/generic/matrix22_mul.c: New file.
 
-2008-09-11  Niels Möller  <nisse@king.swox.se>
+2008-09-11  Niels Möller  <nisse@king.swox.se>
 
        * tune/tuneup.c: Updated tuning of gcdext.
 
        * mpn/x86_64/gmp-mparam.h (GCDEXT_DC_THRESHOLD): Reduced threshold
        from 713 to 409.
 
-2008-09-11  Niels Möller  <nisse@lysator.liu.se>
+2008-09-11  Niels Möller  <nisse@lysator.liu.se>
 
        * gmp-impl.h: Updated for gcdext changes.
        (GCDEXT_DC_THRESHOLD): New constant, renamed from
 
        * gmp-h.in: Unconditionally include <cstdio>.
 
-2008-09-10  Niels Möller  <nisse@lysator.liu.se>
+2008-09-10  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/common.c: #if:ed out speed_mpn_gcd_binary and
        speed_mpn_gcd_accel.
 
        * doc/gmp.texi: Fix a typo and clarify mpn_gcdext docs.
 
-2008-09-09  Niels Möller  <nisse@lysator.liu.se>
+2008-09-09  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/common.c (speed_mpn_hgcd, speed_mpn_hgcd_lehmer): Adapted
        to new hgcd interface.
 
        * mpn/generic/mul_toom22.c: Compute s and t more cleverly.
 
-2008-09-08  Niels Möller  <nisse@lysator.liu.se>
+2008-09-08  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpn/t-hgcd.c: Updated tests. Rewrite of hgcd_ref.
 
 
        * configure.in: Handle core2 separately from athlon64.
 
-2008-09-05  Niels Möller  <nisse@lysator.liu.se>
+2008-09-05  Niels Möller  <nisse@lysator.liu.se>
 
        * */Makefile.in, configure, aclocal.m4, config.in: Removed files
        from repository. They're instead generated by automake and
        * gmp-impl.h (mpn_nand_n, mpn_iorn_n, mpn_nior_n, mpn_xnor_n):
        Handle nails.
 
-2005-06-13  Niels Möller  <nisse@lysator.liu.se>
+2005-06-13  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/gcdext.c (gcdext_schoenhage): Check for the
        (unlikely) case that one of the hgcd/euclid steps results in two
        * tune/speed.h (SPEED_ROUTINE_MPN_GCD_CALL): Simplify and correct code
        for generating test operands.
 
-2005-03-17  Niels Möller  <nisse@lysator.liu.se>
+2005-03-17  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd.c (qstack_adjust): New argument d, saying how much
        to adjust the top quotient.
        * tests/mpz/t-gcd.c (MAX_SCHOENHAGE_THRESHOLD): Set to largest of
        gcd,gcdext thresholds.
 
-2005-03-15  Niels Möller  <nisse@lysator.liu.se>
+2005-03-15  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/gcdext.c (gcdext_schoenhage): When calling gcdext_lehmer,
        reuse all temporary limb storage, including the storage used for the
 2004-06-03  Kevin Ryde  <kevin@swox.se>
 
        * gmp-impl.h (memset): Use a local char* pointer, in case parameter is
-       something else (eg. tune/common.c).  Reported by Emmanuel Thomé.
+       something else (eg. tune/common.c).  Reported by Emmanuel Thomé.
 
 2004-06-01  Kevin Ryde  <kevin@swox.se>
 
        * config.guess (i?86-*-*): Avoid "Illegal instruction" message which
        goes to stdout on 80386 freebsd4.9.
 
-2004-05-23  Niels Möller  <nisse@lysator.liu.se>
+2004-05-23  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/gcdext.c (gcdext_1_u): New function.
        (mpn_gcdext): Use it.
        (tune_gcdext): Remove function.
        (all): Corresponding changes.
 
-2004-05-21  Niels Möller  <nisse@lysator.liu.se>
+2004-05-21  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/gcdext.c: Complete rewrite.  Uses fast Lehmer code for
        small operands, and Schoenhage code for large operands.
 2004-05-05  Torbjorn Granlund  <tege@swox.com>
 
        * mpn/generic/mullow_n.c, mpn/generic/mullow_basecase.c: New files
-       (mainly by Niels Möller).
+       (mainly by Niels Möller).
        * configure.in, mpn/Makefile.am: Add them.
 
        * gmp-impl.h (MULLOW_BASECASE_THRESHOLD, MULLOW_DC_THRESHOLD,
 
        * doc/gmp.texi (Reentrancy, Random State Initialization): Note
        gmp_randinit use of gmp_errno is not thread safe.  Reported by Vincent
-       Lefèvre.
+       Lefèvre.
 
        * doc/gmp.texi (Random State Initialization): Add index entries for
        gmp_errno and constants.
 
 2004-03-01  Torbjorn Granlund  <tege@swox.com>
 
-       With Karl Hasselström:
+       With Karl Hasselström:
        * mpn/generic/dc_divrem_n.c (mpn_dc_div_2_by_1): New function, with
        meat from old mpn_dc_divrem_n.  Accept scratch parameter.  Rewrite to
        avoid a recursive call.
        * configure.in (sparc64-*-*bsd*): Amend -m32 setup for ABI=32, so it's
        not used in ABI=64 on the BSD systems.
 
-2004-02-18  Niels Möller  <nisse@lysator.liu.se>
+2004-02-18  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpz/t-gcd.c (gcdext_valid_p): New function.
        (ref_mpz_gcd): Deleted function.
        From Kevin:
        * config.guess: Recognize AMD's hammer processors, return x86_64.
 
-2004-01-31  Niels Möller  <nisse@lysator.liu.se>
+2004-01-31  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd.c (mpn_cmp_sum3): Declare static.
 
-2004-01-25  Niels Möller  <nisse@lysator.liu.se>
+2004-01-25  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpn/Makefile.am (check_PROGRAMS): Add t-hgcd.
 
 
        * mpn/generic/gcd.c: Reenable Schoenhage code.
 
-       With Niels Möller:
+       With Niels Möller:
        * mpn/generic/hgcd.c: Add const and inline to several functions.
        (qstack_push_start qstack_push_end qstack_push_quotient): Remove.
        (euclid_step): Insert removed functions here.
 
        * mpn/amd64/README: Add reference to ABI spec.
 
-2004-01-17  Niels Möller  <nisse@lysator.liu.se>
+2004-01-17  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd.c (hgcd_adjust): Backed out mpn_addlsh1_n
        change for now.
        * gmp-h.in (_GMP_H_HAVE_FILE): Add _MSL_STDIO_H for Metrowerks.
        Reported by Tomas Zahradnicky.
 
-2004-01-16  Niels Möller  <nisse@lysator.liu.se>
+2004-01-16  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd.c (mpn_diff_smaller_p): Use MPN_DECR_U.
        (hgcd_adjust): Use mpn_addlsh1_n when available.
        * configure.in (--with-readline=detect): Check for readline/readline.h
        and readline/history.h.  Report result of detection.
 
-2004-01-14  Niels Möller  <nisse@lysator.liu.se>
+2004-01-14  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/speed.c (routine): Disabled speed_mpn_hgcd_lehmer.
        * tune/common.c (speed_mpn_hgcd_lehmer): Disabled function.
        (hgcd_final): Special handling of the case hgcd2 returning 1. Now
        uses hgcd_adjust, instead of a full Euclid division.
 
-2004-01-13  Niels Möller  <nisse@lysator.liu.se>
+2004-01-13  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd.c (euclid_step, hgcd_case0): Merged into a
        single function euclid_step.
        (one_test): Use hgcd_ref. Don't use mpn_hgcd_lehmer.
        (main): Skip one_step if both input values are zero.
 
-2004-01-12  Niels Möller  <nisse@lysator.liu.se>
+2004-01-12  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd.c (hgcd_final): Rewritten, now uses Lehmer
        steps instead of a division loop.
        * tests/mpn/t-hgcd.c: Try the same kind of random inputs as for
        mpz/t-gcd.
 
-2004-01-11  Niels Möller  <nisse@lysator.liu.se>
+2004-01-11  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd.c (mpn_hgcd_lehmer): Rewritten, after some more
        analysis of the size reduction for one Lehmer step.
 
 2004-01-11  Torbjorn Granlund  <tege@swox.com>
 
-       With Niels Möller:
+       With Niels Möller:
        * mpn/generic/hgcd.c (hgcd_normalize): Fix ASSERTs.
        (hgcd_mul): Normalize R[1].uvp[1].  Add some more ASSERTs.
        (hgcd_update_uv): Streamline.  ASSERT that input and output is
 
        * doc/gmp.texi (Integer Logic and Bit Fiddling): Say "bitwise" in
        mpz_and, mpz_ior and mpz_xor, to avoid any confusion with what C means
-       by "logical".  Reported by Rüdiger Schütz.
+       by "logical".  Reported by Rüdiger Schütz.
 
        * gmp-h.in (_GMP_H_HAVE_FILE): Note why defined(EOF) is not good.
 
        (GMP_H_EXTERN_INLINE): Use AC_C_INLINE.
        (GMP_PROG_AR): Comment on automake $ARFLAGS.
 
-2003-12-19  Niels Möller  <nisse@lysator.liu.se>
+2003-12-19  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd.c (mpn_diff_smaller_p): Rewrote function. Tried
        to explain how it works.
 
        * mpn/generic/get_d.c: Make ONE_LIMB case actually work for nails.
 
-2003-12-18  Niels Möller  <niels@lysator.liu.se>
+2003-12-18  Niels Möller  <niels@lysator.liu.se>
 
        * mpn/generic/hgcd.c (hgcd_update_r): Assert that the output r2 is
        smaller than the input r1.
        include() from automake 1.8 aclocal.
        * acinclude.m4: Quote names in AC_DEFUN, for automake 1.8 aclocal.
 
-2003-12-17  Niels Möller  <nisse@lysator.liu.se>
+2003-12-17  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/common.c (speed_mpn_hgcd, speed_mpn_hgcd_lehmer) [nails]:
        Enabled code also for GMP_NAIL_BITS > 0.
        speed_mpn_hgcd_lehmer.
        * tune/tuneup.c (tune_hgcd) [nails]: Likewise.
 
-       * mpn/generic/gcd.c [nails]: Use Schönhage's algorithm also for
+       * mpn/generic/gcd.c [nails]: Use Schönhage's algorithm also for
        GMP_NAIL_BITS > 0.
 
        * mpn/generic/hgcd.c [nails]: Enable the code for GMP_NAIL_BITS > 0.
        can be used to locate the most significant bit.  Reword a bit for
        clarity.
 
-2003-12-12  Niels Möller  <niels@lysator.liu.se>
+2003-12-12  Niels Möller  <niels@lysator.liu.se>
 
        * mpn/generic/hgcd.c (__gmpn_hgcd_sanity): Fixed stack buffer
        overrun.
        * mpn/generic/get_str.c (mpn_get_str, POW2_P case):
        Don't append extra '\0' byte.
 
-2003-12-05  Niels Möller  <niels@lysator.liu.se>
+2003-12-05  Niels Möller  <niels@lysator.liu.se>
 
        * tune/common.c (speed_mpn_hgcd_lehmer, speed_mpn_hgcd):
        Updated for the renaming hgcd_sanity -> ASSERT_HGCD.
        (Build Options): Add cpu types alphaev7 and amd64.  Update texinfo
        html cross reference.
 
-2003-11-28  Niels Möller  <nisse@lysator.liu.se>
+2003-11-28  Niels Möller  <nisse@lysator.liu.se>
 
        * tune/tuneup.c (tune_hgcd): Disable if GMP_NAIL_BITS > 0.
        * tune/speed.c (routine): Likewise.
        numbers.
        (hgcd_tdiv): New function.
        (gcd_lehmer): New function, currently #if:ed out.
-       (hgcd_start_row_p): New function, duplicatd from hgcd.c.
+       (hgcd_start_row_p): New function, duplicated from hgcd.c.
        (gcd_schoenhage_itch): New function.
        (gcd_schoenhage): New function.
        (mpn_gcd): New advertised gcd function, which calls
        * gmp-impl.h (GCD_LEHMER_THRESHOLD): #if:ed out this macro.
        (mpn_hgcd2_lehmer_step): Added prototype.
 
-2003-11-27  Niels Möller  <nisse@lysator.liu.se>
+2003-11-27  Niels Möller  <nisse@lysator.liu.se>
 
        * tests/mpz/t-gcd.c (gcd_values): Moved definition, so that we
        don't need to forward declare the array.
 
-2003-11-26  Niels Möller  <nisse@lysator.liu.se>
+2003-11-26  Niels Möller  <nisse@lysator.liu.se>
 
        * mpn/generic/hgcd.c (mpn_hgcd2_fix): Deleted duplicate definition
        (the function belongs to hgcd2.c).
        decrease # of test to 1000.
        (gcd_values): Remove oversize test case.
 
-2003-11-26  Niels Möller  <niels@lysator.liu.se>
+2003-11-26  Niels Möller  <niels@lysator.liu.se>
 
        * gmp-impl.h: Added name mangling for hgcd-related functions. Also
        use __GMP_PROTO.
        * tests/mpz/t-gcd.c (main): Added some tests with non-random
        input.
 
-2003-11-25  Niels Möller  <nisse@lysator.liu.se>
+2003-11-25  Niels Möller  <nisse@lysator.liu.se>
 
        * gmp-impl.h (MPN_LEQ_P, MPN_EXTRACT_LIMB): New macros.
        (struct qstack, struct hgcd2_row, struct hgcd2, struct hgcd_row)
 
 2003-09-24  Torbjorn Granlund  <tege@swox.com>
 
-       * tune/speed.c (routine): Add entires for mpn_addlsh1_n, mpn_sublsh1_n,
+       * tune/speed.c (routine): Add entries for mpn_addlsh1_n, mpn_sublsh1_n,
        mpn_rsh1add_n, and mpn_rsh1sub_n.
 
        * tune/speed.h: Declare speed_mpn_addlsh1_n, speed_mpn_sublsh1_n,
        mpn_addlsh1_n.  Avoid all copying, at the expense of some additional
        workspace.
 
-       * gmp-impl.h (MPN_TOOM3_MUL_N_TSIZE, MPN_TOOM3_SQR_N_TSIZE): Accomodate
+       * gmp-impl.h (MPN_TOOM3_MUL_N_TSIZE, MPN_TOOM3_SQR_N_TSIZE): Accommodate
        latest toom3 code.
 
 2003-09-19  Kevin Ryde  <kevin@swox.se>
 
        * tests/mpz/bit.c (check_single): Correction to a diagnostic print.
 
-2003-07-24  Niels Möller  <nisse@lysator.liu.se>
+2003-07-24  Niels Möller  <nisse@lysator.liu.se>
 
        * mpz/combit.c: New file.
        * Makefile.am, mpz/Makefile.am: Add it.
        * mpn/sparc32/v9/udiv.asm: Amend heading, this file is for sparc v9.
 
        * tests/cxx/Makefile.am (TESTS_ENVIRONMENT): In libtool openbsd hack,
-       disard error messages from cp, for the benefit of --disable-shared or
+       discard error messages from cp, for the benefit of --disable-shared or
        systems not using names libgmp.so.*.
 
        * tests/devel/try.c (try_one): When overlapping, copy source data
        * mpz/get_str.c: Likewise.
        * mpf/get_str.c: Likewise.
 
-       * mpz/inp_str.c: Restucture to allocate more string space just
+       * mpz/inp_str.c: Restructure to allocate more string space just
        before needed.
        * mpbsd/min.c: Likewise.
 
 
        * Makefile.am: Put gmp.h and mp.h under $(exec_prefix)/include.
        * gmp.texi (Build Options): Add notes on this.
-       Reported by Vincent Lefèvre.
+       Reported by Vincent Lefèvre.
 
 2003-03-06  Kevin Ryde  <kevin@swox.se>
 
        * mpf/fits_u.h: Rewrite - nailify.
        * mpf/fits_s.h: Likewise.
 
-       * mpz/mod.c: Disambiguate if-statament with extra {}.
+       * mpz/mod.c: Disambiguate if-statement with extra {}.
 
        * mpf/int_p.c: Fix type of size variables.
        * mpf/get_ui: Likewise.
 
        * mpn/mp_bases.c: Add entries for base 256.  Remove __ prefix from
        table name.
-       * gmp-impl.h (__mp_bases): Remove superflous `mp_' part of name, making
+       * gmp-impl.h (__mp_bases): Remove superfluous mp_ part of name, making
        it __gmpn_bases instead of __gmpn_mp_bases.
        (mp_bases): New #define.
        * tune/speed.h (SPEED_ROUTINE_MPN_SET_STR): Allow bases up to 256.
 
 2000-04-16  Torbjorn Granlund  <tege@swox.com>
 
-       * mpn/generic/dump.c: Suppress output of leadign zeros.
+       * mpn/generic/dump.c: Suppress output of leading zeros.
 
        * mpz/inp_str.c: Fix memory leakage.
 
        tests/rand/Makefile.
 
        * acinclude.m4 (AC_CANONICAL_BUILD): Define to
-       `_AC_CANONICAL_BUILD' to deal with incompabilities between
+       `_AC_CANONICAL_BUILD' to deal with incompatibilities between
        Autoconf and Libtool.
        (AC_CHECK_TOOL_PREFIX): Likewise.
 
        appropriate.
        (athlon-*-*): Fix typo.
 
-       * config.guess: Update x86 recog code to intiallly match
+       * config.guess: Update x86 recog code to initially match
        more than just i386.
        Call K6-2 and K6-III for "k62" and "k63" respectively.
 
@@ -27133,7 +28981,7 @@ Wed Jan 28 20:28:19 1998  Torbjorn Granlund  <tege@sophie.matematik.su.se>
 Mon Jan 26 01:39:02 1998  Torbjorn Granlund  <tege@tunnis.tmg.se>
 
        * mpz/pprime_p.c (mpz_probab_prime_p): Major overhaul: Check small
-       numers specifically; check small factors, then perform a fermat test.
+       numbers specifically; check small factors, then perform a fermat test.
 
 Tue Jan 13 14:58:28 1998  Torbjorn Granlund  <tege@tunnis.tmg.se>
 
@@ -29910,7 +31758,7 @@ Sun Apr 25 18:40:26 1993  Torbjorn Granlund  (tege@pde.nada.kth.se)
        Use mpn_divmod for division; corresponding changes in return value
        convention.
        * mpz/powm.c: `carry_digit' => `carry_limb'.
-       * bsd/sdiv.c: Clearify comment.
+       * bsd/sdiv.c: Clarify comment.
 
 Sun Apr 25 00:31:28 1993  Torbjorn Granlund  (tege@pde.nada.kth.se)
 
@@ -30738,7 +32586,7 @@ Tue Jul  9 18:40:30 1991  Torbjorn Granlund  (tege@zevs.sics.se)
 
        * gmp.h: Add declaration of mpq_clear.
 
-       * dist-Makefile: Chack if "ranlib" exists, before using it.
+       * dist-Makefile: Check if "ranlib" exists, before using it.
        * dist-Makefile: Add mpz_sqrtrem.c and mpz_size.c.
        * mpz_powm: Fix typo, "pow" instead of "mpz_powm".
 
@@ -30886,7 +32734,7 @@ Thu May 23 15:28:24 1991  Torbjorn Granlund  (tege@zevs.sics.se)
 Thu May 22 20:25:29 1991  Torbjorn Granlund  (tege@zevs.sics.se)
 
        * Add manual to distribution.
-       * Fold in many missing routines descibed in the manual.
+       * Fold in many missing routines described in the manual.
        * Update Makefile.
 
 Wed May 22 13:48:46 1991  Torbjorn Granlund  (tege@zevs.sics.se)
diff --git a/INSTALL b/INSTALL
index efcfd886b6ff22bf7aadbce32e54c5c55fa232ad..75199a1aba703d51c173ca7dd282ad99a7baf100 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,20 +1,30 @@
-Copyright 1996, 1997, 1999, 2000, 2001, 2002, 2006 Free Software Foundation,
-Inc.
+Copyright 1996, 1997, 1999-2002, 2006 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
@@ -60,7 +70,7 @@ Basics" in the manual.
 Some known build problems are noted in the "Installing GMP" chapter of
 the manual.  Please report other problems to gmp-bugs@gmplib.org.
 
-The GMP web site is located here: http://gmplib.org/.
+The GMP web site is located here: https://gmplib.org/.
 
 
 ----------------
index 54caf7c190f28df0279ade5fee3d43b108480a14..0600b32390799321a0f4d1dc4a8b3d4c0bfce6fd 100644 (file)
@@ -1,5 +1,4 @@
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
-Foundation, Inc.
+Copyright (C) 1994-1996, 1999-2002 Free Software Foundation, Inc.
 
    This file is free documentation; the Free Software Foundation gives
 unlimited permission to copy, distribute and modify it.
index ad5810a8e81f7c96d3144e306f7c51fd800d5755..8567c0e3f6c2c81ca337a53427e26ccb659e3a95 100644 (file)
@@ -1,23 +1,34 @@
 ## Process this file with automake to generate Makefile.in
 
 
-# Copyright 1991, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2006, 2007, 2008, 2009, 2011, 2012, 2013 Free Software Foundation, Inc.
+# Copyright 1991, 1993, 1994, 1996, 1997, 1999-2004, 2006-2009, 2011-2014 Free
+# Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 # The following options are the same as AM_INIT_AUTOMAKE in configure.in,
@@ -74,7 +85,7 @@
 #        5.1.0   11:0:1    7:0:3     -
 #        5.1.1   11:1:1    7:1:3     -
 #        5.1.2   11:2:1    7:2:3     -
-#        5.1.3   11:3:1    7:3:3     -
+#        6.0.0   12:0:2    8:0:4     -
 #
 # 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
 # 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    = 11
-LIBGMP_LT_REVISION   = 3
-LIBGMP_LT_AGE        = 1
+LIBGMP_LT_CURRENT    = 12
+LIBGMP_LT_REVISION   = 0
+LIBGMP_LT_AGE        = 2
 
-LIBGMPXX_LT_CURRENT  = 7
-LIBGMPXX_LT_REVISION = 3
-LIBGMPXX_LT_AGE      = 3
+LIBGMPXX_LT_CURRENT  = 8
+LIBGMPXX_LT_REVISION = 0
+LIBGMPXX_LT_AGE      = 4
 
 
 SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
 
-EXTRA_DIST = configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf
+EXTRA_DIST = configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf \
+            COPYING.LESSERv3 COPYINGv2 COPYINGv3
+
 
 if WANT_CXX
 GMPXX_HEADERS_OPTION = gmpxx.h
@@ -176,7 +189,9 @@ MPZ_OBJECTS = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo                     \
   mpz/ior$U.lo mpz/iset$U.lo mpz/iset_d$U.lo mpz/iset_si$U.lo          \
   mpz/iset_str$U.lo mpz/iset_ui$U.lo mpz/jacobi$U.lo mpz/kronsz$U.lo   \
   mpz/kronuz$U.lo mpz/kronzs$U.lo mpz/kronzu$U.lo                      \
-  mpz/lcm$U.lo mpz/lcm_ui$U.lo mpz/lucnum_ui$U.lo mpz/lucnum2_ui$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/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                    \
@@ -184,7 +199,7 @@ MPZ_OBJECTS = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo                     \
   mpz/popcount$U.lo mpz/pow_ui$U.lo mpz/powm$U.lo mpz/powm_sec$U.lo    \
   mpz/powm_ui$U.lo mpz/primorial_ui$U.lo                               \
   mpz/pprime_p$U.lo mpz/random$U.lo mpz/random2$U.lo                   \
-  mpz/realloc$U.lo mpz/realloc2$U.lo mpz/remove$U.lo                   \
+  mpz/realloc$U.lo mpz/realloc2$U.lo mpz/remove$U.lo mpz/roinit_n$U.lo  \
   mpz/root$U.lo mpz/rootrem$U.lo mpz/rrandomb$U.lo mpz/scan0$U.lo      \
   mpz/scan1$U.lo mpz/set$U.lo mpz/set_d$U.lo mpz/set_f$U.lo            \
   mpz/set_q$U.lo mpz/set_si$U.lo mpz/set_str$U.lo mpz/set_ui$U.lo      \
index c51a2600371c5c312168dd7724c871c4a484805d..122305d62471ff4f51140b30200314eac4ef6d3a 100644 (file)
 
 @SET_MAKE@
 
-# Copyright 1991, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2006, 2007, 2008, 2009, 2011, 2012, 2013 Free Software Foundation, Inc.
+# Copyright 1991, 1993, 1994, 1996, 1997, 1999-2004, 2006-2009, 2011-2014 Free
+# Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 # The following options are the same as AM_INIT_AUTOMAKE in configure.in,
 # except no $(top_builddir) on ansi2knr.  That directory is wanted for the
@@ -86,7 +97,7 @@
 #        5.1.0   11:0:1    7:0:3     -
 #        5.1.1   11:1:1    7:1:3     -
 #        5.1.2   11:2:1    7:2:3     -
-#        5.1.3   11:3:1    7:3:3     -
+#        6.0.0   12:0:2    8:0:4     -
 #
 # 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
@@ -140,8 +151,8 @@ subdir = .
 DIST_COMMON = README $(am__configure_deps) $(am__include_HEADERS_DIST) \
        $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
        $(srcdir)/config.in $(srcdir)/gmp-h.in $(top_srcdir)/configure \
-       AUTHORS COPYING COPYING.LIB ChangeLog INSTALL NEWS \
-       config.guess config.sub install-sh ltmain.sh missing ylwrap
+       AUTHORS COPYING ChangeLog INSTALL NEWS config.guess config.sub \
+       install-sh ltmain.sh missing ylwrap
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
        $(top_srcdir)/configure.ac
@@ -446,12 +457,12 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-LIBGMP_LT_CURRENT = 11
-LIBGMP_LT_REVISION = 3
-LIBGMP_LT_AGE = 1
-LIBGMPXX_LT_CURRENT = 7
-LIBGMPXX_LT_REVISION = 3
-LIBGMPXX_LT_AGE = 3
+LIBGMP_LT_CURRENT = 12
+LIBGMP_LT_REVISION = 0
+LIBGMP_LT_AGE = 2
+LIBGMPXX_LT_CURRENT = 8
+LIBGMPXX_LT_REVISION = 0
+LIBGMPXX_LT_AGE = 4
 SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
 
 # The "test -f" support for srcdir!=builddir is similar to the automake .c.o
@@ -472,10 +483,11 @@ SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
 
 # Distribute mini-gmp. Test sources copied by dist-hook.
 EXTRA_DIST = configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf \
-       gmpxx.h bootstrap.c gen-fac.c gen-fib.c gen-bases.c \
-       gen-trialdivtab.c gen-jacobitab.c gen-psqr.c mini-gmp/README \
-       mini-gmp/mini-gmp.c mini-gmp/mini-gmp.h \
-       mini-gmp/tests/Makefile mini-gmp/tests/run-tests
+       COPYING.LESSERv3 COPYINGv2 COPYINGv3 gmpxx.h bootstrap.c \
+       gen-fac.c gen-fib.c gen-bases.c gen-trialdivtab.c \
+       gen-jacobitab.c gen-psqr.c mini-gmp/README mini-gmp/mini-gmp.c \
+       mini-gmp/mini-gmp.h mini-gmp/tests/Makefile \
+       mini-gmp/tests/run-tests
 @WANT_CXX_TRUE@GMPXX_HEADERS_OPTION = gmpxx.h
 
 # gmp.h and mp.h are architecture dependent, mainly since they encode the
@@ -551,7 +563,9 @@ MPZ_OBJECTS = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo                     \
   mpz/ior$U.lo mpz/iset$U.lo mpz/iset_d$U.lo mpz/iset_si$U.lo          \
   mpz/iset_str$U.lo mpz/iset_ui$U.lo mpz/jacobi$U.lo mpz/kronsz$U.lo   \
   mpz/kronuz$U.lo mpz/kronzs$U.lo mpz/kronzu$U.lo                      \
-  mpz/lcm$U.lo mpz/lcm_ui$U.lo mpz/lucnum_ui$U.lo mpz/lucnum2_ui$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/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                    \
@@ -559,7 +573,7 @@ MPZ_OBJECTS = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo                     \
   mpz/popcount$U.lo mpz/pow_ui$U.lo mpz/powm$U.lo mpz/powm_sec$U.lo    \
   mpz/powm_ui$U.lo mpz/primorial_ui$U.lo                               \
   mpz/pprime_p$U.lo mpz/random$U.lo mpz/random2$U.lo                   \
-  mpz/realloc$U.lo mpz/realloc2$U.lo mpz/remove$U.lo                   \
+  mpz/realloc$U.lo mpz/realloc2$U.lo mpz/remove$U.lo mpz/roinit_n$U.lo  \
   mpz/root$U.lo mpz/rootrem$U.lo mpz/rrandomb$U.lo mpz/scan0$U.lo      \
   mpz/scan1$U.lo mpz/set$U.lo mpz/set_d$U.lo mpz/set_f$U.lo            \
   mpz/set_q$U.lo mpz/set_si$U.lo mpz/set_str$U.lo mpz/set_ui$U.lo      \
diff --git a/NEWS b/NEWS
index e983884ea05dfaa42495cc1dd25e22461a3f1eca..f8c5229ef5ced3e97d0bbd4e816af1e35aa7b993 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,87 @@
-Copyright 1996, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Copyright 1996, 1999-2014 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 5.1.* and 5.2.0
+
+  BUGS FIXED
+  * The function mpz_invert now considers any number invertible in Z/1Z.
+
+  * The mpn multiply code now handles operands of more than 2^31 limbs
+    correctly.  (Note however that the mpz code is limited to 2^32 bits on
+    32-bit hosts and 2^37 bits on 64-bit hosts.)
+
+  * Contains all fixes from release 5.1.3.
+
+  SPEEDUPS
+  * Plain division of large operands is faster and more monotonous in operand
+    size.
+
+  * Major speedup for ARM, in particular ARM Cortex-A15, thanks to improved
+    assembly.
+
+  * Major speedup for SPARC T4/T5 and speedup also for T3, thanks to a lot of
+    new assembly.
+
+  * Speedup for Intel Sandy Bridge, Ivy Bridge, Haswell, thanks to rewritten
+    and vastly expanded assembly support.  Speedup also for the older Core 2
+    and Nehalem.
+
+  * Faster mixed arithmetic between mpq_class and double.
+
+  * With g++, optimise more operations when one argument is a simple constant.
+
+  FEATURES
+  * Support for new Intel and AMD CPUs.
+
+  * Support for ARM64 alias Aarch64 alias ARMv8.
+
+  * New public functions mpn_sec_mul and mpn_sec_sqr, implementing side-channel
+    silent multiplication and squaring.
+
+  * New public functions mpn_sec_div_qr and mpn_sec_div_r, implementing
+    side-channel silent division.
+
+  * New public functions mpn_cnd_add_n and mpn_cnd_sub_n.  Side-channel silent
+    conditional addition and subtraction.
+
+  * New public function mpn_sec_powm, implementing side-channel silent modexp.
+
+  * New public function mpn_sec_invert, implementing side-channel silent
+    modular inversion.
+
+  * Better support for applications which use the mpz_t type, but nevertheless
+    need to call some of the lower-level mpn functions.  See the documentation
+    for mpz_limbs_read and related functions.
+
+  MISC
+  * This release will not work on NetBSD 5.x, FreeBSD 7.x, 8.x or 9 series
+    before 9.3.  The reason is that the m4 command is not correctly
+    implemented.  (Workaround: Use an older GMP release, or install GNU m4 from
+    /usr/ports and tell GMP to use it.)
+
+  * This release will not build properly on FreeBSD/amd64 before version 10
+    using the 32-bit ABI (once a working m4 is installed).  The reason is
+    broken limits.h.  (Workaround: Use an older GMP release if using the 32-bit
+    ABI on these FreeBSD releases is important.)
+
+  * This release will not work reliably on FreeBSD 10.0 for i386 or amd64 using
+    the 32-bit ABI.  The reason is bugs in the compiler 'clang'.  Depending on
+    CPU-dependent compiler flags, GMP may or may not be miscompiled in a
+    particular build.  (Workaround: Compiling gcc from /usr/ports should work,
+    except that gcc circularly depends on GMP; we have not been able to test
+    that workaround due to FreeBSD 10.0 bugs affecting its ability to run under
+    KVM and Xen.)
+
+  * This release will not compile on FreeBSD before version 10 for i386,
+    targeting any modern AMD processor.  The reason is bugs in the old gcc
+    bundled with FreeBSD.  (Workaround: install a less obsolete gcc from
+    /usr/ports and tell GMP to use it, or override the -march=amdfam10
+    GMP configure command line argument.)
+
+
 Changes between GMP version 5.1.2 and 5.1.3
 
   BUGS FIXED
@@ -28,13 +105,14 @@ Changes between GMP version 5.1.2 and 5.1.3
   MISC
   * None.
 
+
 Changes between GMP version 5.1.1 and 5.1.2
 
   BUGS FIXED
   * A bug in mpz_powm_ui triggered by base arguments of at least 15000 decimal
     digits or mod arguments of at least 7500 decimal digits has been fixed.
 
-  * A AMD Bulldozer specific bug affecting the 64-bit Windows ABI has been
+  * An AMD Bulldozer specific bug affecting the 64-bit Windows ABI has been
     fixed.  This bug was in a key function (mpn_mul_1) and made both Bulldozer
     specific builds and fat builds run on Bulldozer completely non-functional.
 
@@ -137,7 +215,7 @@ Changes between GMP version 5.0.* and 5.1.0
     This is more consistent with other powerpc systems.
 
   * The coverage of the testsuite has been improved, using the lcov tool.  See
-    also http://gmplib.org/devel/lcov/.
+    also https://gmplib.org/devel/lcov/.
 
   * It is now possible to compile GMP using a C++ compiler.
 
@@ -511,7 +589,7 @@ Changes between GMP version 4.2.1 and 4.2.2
   Features:
   * New support for x86_64-solaris
   * New, rudimentary support for x86-apple-darwin and x86_64-apple-darwin.
-    (Please see http://gmplib.org/macos.html for more information.)
+    (Please see https://gmplib.org/macos.html for more information.)
 
 
 Changes between GMP version 4.2 and 4.2.1
diff --git a/README b/README
index 03ffb7ff300fcaea7d908625c16650218f065075..013899dc09ce0e2e911f946bb9c728ff4696ab79 100644 (file)
--- a/README
+++ b/README
@@ -3,17 +3,28 @@ Copyright 1991, 1996, 1999, 2000, 2007 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
@@ -38,8 +49,8 @@ increases with operand sizes for certain operations, since GNU MP in many
 cases has asymptotically faster algorithms.
 
 GNU MP is free software and may be freely copied on the terms contained in the
-files COPYING.LIB and COPYING (most of GNU MP is under the former, some under
-the latter).
+files COPYING* (see the manual for information on which license(s) applies to
+which components of GNU MP).
 
 
 
@@ -87,7 +98,7 @@ the INSTALL file in this directory.
 
 If you find a bug in the library, please make sure to tell us about it!
 
-You should first check the GNU MP web pages at http://gmplib.org/, under
+You should first check the GNU MP web pages at https://gmplib.org/, under
 "Status of the current release".  There will be patches for all known serious
 bugs there.
 
index f1f071f124ced339db7adbf679d103dac61ce14b..227712a5db0f39762e1404adbe611a2e0ea96e3f 100644 (file)
@@ -1,23 +1,33 @@
 dnl  GMP specific autoconf macros
 
 
-dnl  Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2011 Free
-dnl  Software Foundation, Inc.
+dnl  Copyright 2000-2006, 2009, 2011, 2013, 2014 Free Software Foundation, Inc.
 dnl
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  Some tests use, or must delete, the default compiler output.  The
@@ -53,7 +63,7 @@ define(X86_PATTERN,
 [[i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-*]])
 
 define(X86_64_PATTERN,
-[[athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | bulldozer-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*]])
+[[athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar-*-* | bulldozer-*-* | piledriver-*-* | steamroller-*-* | excavator-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*]])
 
 dnl  GMP_FAT_SUFFIX(DSTVAR, DIRECTORY)
 dnl  ---------------------------------
@@ -310,7 +320,9 @@ dnl  macros.
 ``bad: $][# not supported (SunOS /usr/bin/m4)
 '')ifelse(eval(89),89,`define(t2,Y)',
 `bad: eval() doesnt support 8 or 9 in a constant (OpenBSD 2.6 m4)
-')ifelse(t1`'t2,YY,`good
+')ifelse(eval(9,9),10,`define(t3,Y)',
+`bad: eval() doesnt support radix in eval (FreeBSD 8.x,9.0,9.1,9.2 m4)
+')ifelse(t1`'t2`'t3,YYY,`good
 ')]
 EOF
 dnl ' <- balance the quotes for emacs sh-mode
@@ -675,7 +687,7 @@ main ()
 
 GMP_PROG_CC_WORKS_PART_MAIN([$1], [mpn_lshift_com optimization 2],
 [/* The following is mis-compiled by Intel ia-64 icc version 1.8 under
-    "icc -O3",  After several calls, the function writes parial garbage to
+    "icc -O3",  After several calls, the function writes partial garbage to
     the result vector.  Perhaps relates to the chk.a.nc insn.  This code needs
     to be run to show the problem, but that's fine, the offending cc is a
     native-only compiler so we don't have to worry about cross compiling.  */
@@ -1831,7 +1843,7 @@ AC_CACHE_CHECK([if the .align directive accepts an 0x90 fill in .text],
        .byte   0
        .align  4, 0x90],
 [if grep "Warning: Fill parameter ignored for executable section" conftest.out >/dev/null; then
-  echo "Supressing this warning by omitting 0x90" 1>&AC_FD_CC
+  echo "Suppressing this warning by omitting 0x90" 1>&AC_FD_CC
   gmp_cv_asm_align_fill_0x90=no
 else
   gmp_cv_asm_align_fill_0x90=yes
@@ -2606,6 +2618,83 @@ esac
 ])
 
 
+dnl  GMP_ASM_X86_MULX([ACTION-IF-YES][,ACTION-IF-NO])
+dnl  ------------------------------------------------
+dnl  Determine whether the assembler supports the mulx instruction which debut
+dnl  with Haswell.
+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_MULX],
+[AC_CACHE_CHECK([if the assembler knows about the mulx instruction],
+               gmp_cv_asm_x86_mulx,
+[GMP_TRY_ASSEMBLE(
+[      .text
+       mulx    %r8, %r9, %r10],
+  [gmp_cv_asm_x86_mulx=yes],
+  [gmp_cv_asm_x86_mulx=no])
+])
+case $gmp_cv_asm_x86_mulx in
+yes)
+  ifelse([$1],,:,[$1])
+  ;;
+*)
+  AC_MSG_WARN([+----------------------------------------------------------])
+  AC_MSG_WARN([| WARNING WARNING WARNING])
+  AC_MSG_WARN([| Host CPU has the mulx instruction, but it can't be])
+  AC_MSG_WARN([| 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_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.
@@ -3013,6 +3102,57 @@ GMP_DEFINE_RAW(["define(<HAVE_REGISTER>,<$gmp_cv_asm_sparc_register>)"])
 ])
 
 
+dnl  GMP_ASM_SPARC_GOTDATA
+dnl  ----------------------
+dnl  Determine whether the assembler accepts gotdata relocations.
+dnl
+dnl  See also mpn/sparc32/sparc-defs.m4 which uses the result of this test.
+
+AC_DEFUN([GMP_ASM_SPARC_GOTDATA],
+[AC_REQUIRE([GMP_ASM_TEXT])
+AC_CACHE_CHECK([if the assembler accepts gotdata relocations],
+               gmp_cv_asm_sparc_gotdata,
+[GMP_TRY_ASSEMBLE(
+[      $gmp_cv_asm_text
+       .text
+       sethi   %gdop_hix22(symbol), %g1
+       or      %g1, %gdop_lox10(symbol), %g1
+],
+[gmp_cv_asm_sparc_gotdata=yes],
+[gmp_cv_asm_sparc_gotdata=no])])
+
+GMP_DEFINE_RAW(["define(<HAVE_GOTDATA>,<$gmp_cv_asm_sparc_gotdata>)"])
+])
+
+
+dnl  GMP_ASM_SPARC_SHARED_THUNKS
+dnl  ----------------------
+dnl  Determine whether the assembler supports all of the features
+dnl  necessary in order to emit shared PIC thunks on sparc.
+dnl
+dnl  See also mpn/sparc32/sparc-defs.m4 which uses the result of this test.
+
+AC_DEFUN([GMP_ASM_SPARC_SHARED_THUNKS],
+[AC_REQUIRE([GMP_ASM_TEXT])
+AC_CACHE_CHECK([if the assembler can support shared PIC thunks],
+               gmp_cv_asm_sparc_shared_thunks,
+[GMP_TRY_ASSEMBLE(
+[      $gmp_cv_asm_text
+       .section        .text.__sparc_get_pc_thunk.l7,"axG",@progbits,__sparc_get_pc_thunk.l7,comdat
+       .weak   __sparc_get_pc_thunk.l7
+       .hidden __sparc_get_pc_thunk.l7
+       .type   __sparc_get_pc_thunk.l7, #function
+__sparc_get_pc_thunk.l7:
+       jmp     %o7+8
+        add    %o7, %l7, %l7
+],
+[gmp_cv_asm_sparc_shared_thunks=yes],
+[gmp_cv_asm_sparc_shared_thunks=no])])
+
+GMP_DEFINE_RAW(["define(<HAVE_SHARED_THUNKS>,<$gmp_cv_asm_sparc_shared_thunks>)"])
+])
+
+
 dnl  GMP_C_ATTRIBUTE_CONST
 dnl  ---------------------
 
@@ -3341,7 +3481,7 @@ esac
 
 dnl  GMP_C_STDARG
 dnl  ------------
-dnl  Test whether to use <stdarg.h> or <varargs.h>.
+dnl  Test whether to use <stdarg.h>.
 dnl
 dnl  Notice the AC_DEFINE here is HAVE_STDARG to avoid clashing with
 dnl  HAVE_STDARG_H which could arise from AC_CHECK_HEADERS.
@@ -3351,26 +3491,26 @@ dnl  to be ANSI or K&R and the two can be differentiated by AC_PROG_CC_STDC
 dnl  or very likely by the setups for _PROTO in gmp.h.  On the other hand
 dnl  this test is nice and direct, being what we're going to actually use.
 
-AC_DEFUN([GMP_C_STDARG],
-[AC_CACHE_CHECK([whether <stdarg.h> exists and works],
-                gmp_cv_c_stdarg,
-[AC_TRY_COMPILE(
-[#include <stdarg.h>
-int foo (int x, ...)
-{
-  va_list  ap;
-  int      y;
-  va_start (ap, x);
-  y = va_arg (ap, int);
-  va_end (ap);
-  return y;
-}],,
-gmp_cv_c_stdarg=yes, gmp_cv_c_stdarg=no)
-])
-if test $gmp_cv_c_stdarg = yes; then
-  AC_DEFINE(HAVE_STDARG, 1, [Define to 1 if <stdarg.h> exists and works])
-fi
-])
+dnl  AC_DEFUN([GMP_C_STDARG],
+dnl  [AC_CACHE_CHECK([whether <stdarg.h> exists and works],
+dnl                  gmp_cv_c_stdarg,
+dnl  [AC_TRY_COMPILE(
+dnl  [#include <stdarg.h>
+dnl  int foo (int x, ...)
+dnl  {
+dnl    va_list  ap;
+dnl    int      y;
+dnl    va_start (ap, x);
+dnl    y = va_arg (ap, int);
+dnl    va_end (ap);
+dnl    return y;
+dnl  }],,
+dnl  gmp_cv_c_stdarg=yes, gmp_cv_c_stdarg=no)
+dnl  ])
+dnl  if test $gmp_cv_c_stdarg = yes; then
+dnl    AC_DEFINE(HAVE_STDARG, 1, [Define to 1 if <stdarg.h> exists and works])
+dnl  fi
+dnl  ])
 
 
 dnl  GMP_FUNC_ALLOCA
@@ -3524,8 +3664,7 @@ dnl  not sure which 2.0.x does which), but still puts the correct null
 dnl  terminated result into the buffer.
 
 AC_DEFUN([GMP_FUNC_VSNPRINTF],
-[AC_REQUIRE([GMP_C_STDARG])
-AC_CHECK_FUNC(vsnprintf,
+[AC_CHECK_FUNC(vsnprintf,
               [gmp_vsnprintf_exists=yes],
               [gmp_vsnprintf_exists=no])
 if test "$gmp_vsnprintf_exists" = no; then
@@ -3539,31 +3678,16 @@ else
 #include <string.h>  /* for strcmp */
 #include <stdio.h>   /* for vsnprintf */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
 
 int
-#if HAVE_STDARG
 check (const char *fmt, ...)
-#else
-check (va_alist)
-     va_dcl
-#endif
 {
   static char  buf[128];
   va_list  ap;
   int      ret;
 
-#if HAVE_STDARG
   va_start (ap, fmt);
-#else
-  char *fmt;
-  va_start (ap);
-  fmt = va_arg (ap, char *);
-#endif
 
   ret = vsnprintf (buf, 4, fmt, ap);
 
index b9b55592abde2d410fb7d227a17327d0fb292ace..2e85e6bf63915e0b5570eabf519a8f8ace6cec33 100644 (file)
--- a/assert.c
+++ b/assert.c
@@ -9,17 +9,28 @@ Copyright 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <stdlib.h>
index 3478ce076e2efcc687051a0e8cd9ee0498428382..bff960ed83a6378ba5aae7a547a6fc4e2e0912d1 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2002, 2004, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "mini-gmp/mini-gmp.c"
index 7251beff09dd16eecfc8ee3412b34eab01f24f26..b896f8489f0f3410f43505d02aedcd725c0d4e2a 100644 (file)
--- a/compat.c
+++ b/compat.c
@@ -5,17 +5,28 @@ Copyright 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
index 2832cdb5f26d3b77a9f9ee0cb8b82d41f9c60c8e..02b61f45aaf814e78f4ba7a785a2b9e878c1996e 100755 (executable)
@@ -3,23 +3,33 @@
 # GMP config.guess wrapper.
 
 
-# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2011, 2012 Free
-# Software Foundation, Inc.
+# Copyright 2000-2006, 2008, 2011-2014 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 # Usage: config.guess
@@ -78,36 +88,46 @@ exact_cpu=
 # files, since lame C compilers generate these even when not asked.
 #
 
-dummy=dummy-$$
-trap 'rm -f $dummy.c $dummy.o $dummy.core $dummy ${dummy}1.s ${dummy}2.c ; exit 1' 1 2 15
-
-# Use $HOST_CC if defined. $CC may point to a cross-compiler
-if test x"$CC_FOR_BUILD" = x; then
-  if test x"$HOST_CC" != x; then
-    CC_FOR_BUILD="$HOST_CC"
-  else
-    if test x"$CC" != x; then
-      CC_FOR_BUILD="$CC"
-    else
-      echo 'dummy(){}' >$dummy.c
-      for c in cc gcc c89 c99; do
-         ($c $dummy.c -c) >/dev/null 2>&1
-         if test $? = 0; then
-             CC_FOR_BUILD="$c"; break
-         fi
-      done
-      rm -f $dummy.c $dummy.o
-      if test x"$CC_FOR_BUILD" = x; then
-       CC_FOR_BUILD=no_compiler_found
-      fi
-    fi
-  fi
-fi
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy $dummy.core ${dummy}0.s" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+       for c in cc gcc c89 c99 ; do
+         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+            CC_FOR_BUILD="$c"; break ;
+         fi ;
+       done ;
+       if test x"$CC_FOR_BUILD" = x ; then
+         CC_FOR_BUILD=no_compiler_found ;
+       fi
+       ;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
 
 
 case "$guess_full" in
 
 alpha-*-*)
+  eval $set_cc_for_build
   # configfsf.guess detects exact alpha cpu types for OSF and GNU/Linux, but
   # not for *BSD and other systems.  We try to get an exact type for any
   # plain "alpha" it leaves.
@@ -115,7 +135,7 @@ alpha-*-*)
   # configfsf.guess used to have a block of code not unlike this, but these
   # days does its thing with Linux kernel /proc/cpuinfo or OSF psrinfo.
   #
-  cat <<EOF >$dummy.s
+  cat <<EOF >${dummy}0.s
        .data
 Lformat:
        .byte 37,100,45,37,120,10,0     # "%d-%x\n"
@@ -138,9 +158,9 @@ main:
        jsr \$26,exit
        .end main
 EOF
-  $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+  $CC_FOR_BUILD ${dummy}0.s -o $dummy 2>/dev/null
   if test "$?" = 0 ; then
-    case `./$dummy` in
+    case `$dummy` in
     0-0)       exact_cpu=alpha      ;;
     1-0)       exact_cpu=alphaev5   ;;
     1-1)       exact_cpu=alphaev56  ;;
@@ -150,31 +170,29 @@ EOF
     2-1307)    exact_cpu=alphaev68  ;;
     esac
   fi
-  rm -f $dummy.s $dummy.o $dummy
   ;;
 
 arm*-*-*)
   cpu_code=`sed -n 's/^CPU part.*\(0x.*\)$/\1/p' /proc/cpuinfo 2>/dev/null`
   case "$cpu_code" in
-      0x210)   exact_cpu="armxscale";;         # v5 pxa250
-      0x290)   exact_cpu="armxscale";;         # v5 pxa260
-      0x2d0)   exact_cpu="armxscale";;         # v5 pxa255
-      0x2d0)   exact_cpu="armxscale";;         # v5 pxa261
-      0x2d0)   exact_cpu="armxscale";;         # v5 pxa262
-      0x411)   exact_cpu="armxscale";;         # v5 pxa270
-      0x915)   exact_cpu="armti915t";;         # v?
-      0x925)   exact_cpu="armti925t";;         # v?
-      0x926)   exact_cpu="arm926";;            # v5
-      0x946)   exact_cpu="arm946";;            # v5
-      0x966)   exact_cpu="arm966";;            # v5
-      0xa11)   exact_cpu="armsa1";;            # v4 strongarm/sa1100
-      0xa26)   exact_cpu="arm1026";;           # v5
+      0xa10 | 0xa11 | 0xb11)                   # v4 strongarm/sa1100
+               exact_cpu="armsa1";;
+      0x915 | 0x925 | \
+      0x920 | 0x922 | 0x940)                   # v4
+               exact_cpu="arm9tdmi";;
+      0x210 | 0x290 | 0x2d0 | \
+      0x212 | 0x292 | 0x2d2 | \
+      0x411)   exact_cpu="armxscale";;         # v5 pxa2xx
+      0x926 | 0x946 | 0x966 | 0x968)           # v5te/v5tej
+               exact_cpu="arm9te";;
+      0xa20 | 0xa22 | 0xa26)                   # v5te
+               exact_cpu="arm10";;
       0xb02)   exact_cpu="arm11mpcore";;       # v6
-      0xb11)   exact_cpu="armsa1";;            # v4 strongarm/sa1110
       0xb36)   exact_cpu="arm1136";;           # v6
       0xb56)   exact_cpu="arm1156";;           # v6t2
       0xb76)   exact_cpu="arm1176";;           # v6
       0xc05)   exact_cpu="armcortexa5";;       # v7a
+      0xc07)   exact_cpu="armcortexa7";;       # v7a
       0xc08)   exact_cpu="armcortexa8";;       # v7a
       0xc09)   exact_cpu="armcortexa9";;       # v7a
       0xc0f)   exact_cpu="armcortexa15";;      # v7a
@@ -182,9 +200,11 @@ arm*-*-*)
       0xc15)   exact_cpu="armcortexr5";;       # v7r
       0xc23)   exact_cpu="armcortexm3";;       # v7m
   esac
+  exact_cpu="${exact_cpu}`sed -n 's;^Features.*\(neon\).*;\1;p' /proc/cpuinfo 2>/dev/null`"
   ;;
 
 ia64*-*-*)
+  eval $set_cc_for_build
   # CPUID[3] bits 24 to 31 is the processor family.  itanium2 is documented
   # as 0x1f, plain itanium has been seen returning 0x07 on two systems, but
   # haven't found any documentation on it as such.
@@ -195,7 +215,7 @@ ia64*-*-*)
   # "unsigned long long" is always 64 bits, in fact on hpux in ilp32 mode
   # (which is the default there), it's the only 64-bit type.
   #
-  cat >${dummy}a.s <<EOF
+  cat >${dummy}0.s <<EOF
        .text
        .global _getcpuid
        .proc   _getcpuid
@@ -210,7 +230,7 @@ getcpuid:
        br.ret.sptk.many rp ;;
        .endp   getcpuid
 EOF
-  cat >${dummy}b.c <<EOF
+  cat >$dummy.c <<EOF
 #include <stdio.h>
 unsigned long long getcpuid ();
 int
@@ -228,10 +248,9 @@ main ()
   return 0;
 }
 EOF
-  if $CC_FOR_BUILD ${dummy}a.s ${dummy}b.c -o $dummy >/dev/null 2>&1; then
-    exact_cpu=`./$dummy`
+  if $CC_FOR_BUILD ${dummy}0.s $dummy.c -o $dummy >/dev/null 2>&1; then
+    exact_cpu=`$dummy`
   fi
-  rm -f ${dummy}a.s ${dummy}a.o ${dummy}b.c ${dummy}b.o $dummy $dummy.core core
   ;;
 
 mips-*-irix[6789]*)
@@ -240,6 +259,7 @@ mips-*-irix[6789]*)
   ;;
 
 m68k-*-*)
+  eval $set_cc_for_build
   # NetBSD (and presumably other *BSD) "sysctl hw.model" gives for example
   #   hw.model = Apple Macintosh Quadra 610  (68040)
   exact_cpu=`(sysctl hw.model) 2>/dev/null | sed -n 's/^.*\(680[012346]0\).*$/m\1/p'`
@@ -254,7 +274,7 @@ m68k-*-*)
     # .byte is used to avoid problems with assembler syntax variations.
     # For testing, provoke failures by adding "illegal" possibly as
     # ".byte 0x4A, 0xFC"
-    cat >$dummy.s <<EOF
+    cat >${dummy}0.s <<EOF
        .text
        .globl main
        .globl _main
@@ -263,14 +283,15 @@ _main:
        .byte   0x70, 0x00
        .byte   0x4e, 0x75
 EOF
-    if ($CC_FOR_BUILD $dummy.s -o $dummy && ./$dummy) >/dev/null 2>&1; then
 
-      # $SHELL -c is used to execute ./$dummy below, since (./$dummy)
+    if ($CC_FOR_BUILD ${dummy}0.s -o $dummy && $dummy) >/dev/null 2>&1; then
+
+      # $SHELL -c is used to execute $dummy below, since ($dummy)
       # 2>/dev/null still prints the SIGILL message on some shells.
       #
         # Try: movel #0,%d0
         #      rtd #0
-        cat >$dummy.s <<EOF
+        cat >${dummy}0.s <<EOF
        .text
        .globl main
        .globl _main
@@ -279,8 +300,8 @@ _main:
        .byte   0x70, 0x00
        .byte   0x4e, 0x74, 0x00, 0x00
 EOF
-        if $CC_FOR_BUILD $dummy.s -o $dummy >/dev/null 2>&1; then
-          $SHELL -c ./$dummy >/dev/null 2>&1
+        if $CC_FOR_BUILD ${dummy}0.s -o $dummy >/dev/null 2>&1; then
+          $SHELL -c $dummy >/dev/null 2>&1
          if test $? != 0; then
             exact_cpu=m68000    # because rtd didn't work
           fi
@@ -293,7 +314,7 @@ EOF
         #      rts
         # Another possibility for identifying 68000 and 68010 is the
         # different value stored by "movem a0,(a0)+"
-        cat >$dummy.s <<EOF
+        cat >${dummy}0.s <<EOF
        .text
        .globl main
        .globl _main
@@ -303,8 +324,8 @@ _main:
        .byte   0x70, 0x00
        .byte   0x4e, 0x75
 EOF
-        if $CC_FOR_BUILD $dummy.s -o $dummy >/dev/null 2>&1; then
-          $SHELL -c ./$dummy >/dev/null 2>&1
+        if $CC_FOR_BUILD ${dummy}0.s -o $dummy >/dev/null 2>&1; then
+          $SHELL -c $dummy >/dev/null 2>&1
          if test $? != 0; then
             exact_cpu=m68010    # because trapf didn't work
           fi
@@ -315,7 +336,7 @@ EOF
         # Try: bfffo %d1{0:31},%d0
         #      movel #0,%d0
         #      rts
-        cat >$dummy.s <<EOF
+        cat >${dummy}0.s <<EOF
        .text
        .globl main
        .globl _main
@@ -325,8 +346,8 @@ _main:
        .byte   0x70, 0x00
        .byte   0x4e, 0x75
 EOF
-        if $CC_FOR_BUILD $dummy.s -o $dummy >/dev/null 2>&1; then
-          $SHELL -c ./$dummy >/dev/null 2>&1
+        if $CC_FOR_BUILD ${dummy}0.s -o $dummy >/dev/null 2>&1; then
+          $SHELL -c $dummy >/dev/null 2>&1
          if test $? != 0; then
             exact_cpu=m68360  # cpu32, because bfffo didn't work
           fi
@@ -338,7 +359,6 @@ EOF
         exact_cpu=m68020
       fi
     fi
-    rm -f $dummy.s $dummy.o $dummy $dummy.core core
   fi
   if test -z "$exact_cpu"; then
     case "$guess_full" in
@@ -368,6 +388,7 @@ rs6000-*-* | powerpc*-*-*)
   # a function descriptor, not actual code.  But this doesn't matter since
   # AIX doesn't allow mfpvr anyway.
   #
+  eval $set_cc_for_build
   cat >$dummy.c <<\EOF
 #include <stdio.h>
 struct {
@@ -414,13 +435,12 @@ main ()
 EOF
   if ($CC_FOR_BUILD $dummy.c -o $dummy) >/dev/null 2>&1; then
     # This style construct is needed on AIX 4.3 to suppress the SIGILL error
-    # from (*fun)().  Using $SHELL -c ./$dummy 2>/dev/null doesn't work.
-    { x=`./$dummy`; } 2>/dev/null
+    # from (*fun)().  Using $SHELL -c $dummy 2>/dev/null doesn't work.
+    { x=`$dummy`; } 2>/dev/null
     if test -n "$x"; then
       exact_cpu=$x
     fi
   fi
-  rm -f $dummy.c $dummy.o $dummy $dummy.core
 
   # Grep the linux kernel /proc/cpuinfo pseudo-file.
   # Anything unrecognised is ignored, since of course we mustn't spit out
@@ -433,7 +453,8 @@ EOF
       601)     exact_cpu="power" ;;
       603ev)   exact_cpu="powerpc603e" ;;
       604ev5)  exact_cpu="powerpc604e" ;;
-      603 | 603e | 604 | 604e | 750 | 821 | 860 | 970)
+      970??)   exact_cpu="powerpc970" ;;
+      603 | 603e | 604 | 604e | 750 | 821 | 860)
         exact_cpu="powerpc$x" ;;
       POWER[4-9])
         exact_cpu=`echo $x | sed "s;POWER;power;"` ;;
@@ -498,12 +519,11 @@ main ()
 }
 EOF
     if ($CC_FOR_BUILD $dummy.c -o $dummy) >/dev/null 2>&1; then
-      x=`./$dummy`
+      x=`$dummy`
       if test -n "$x"; then
         exact_cpu=$x
       fi
     fi
-    rm -f $dummy.c $dummy.o $dummy
   fi
 
   if test -z "$exact_cpu"; then
@@ -542,12 +562,11 @@ main (void)
 }
 EOF
     if ($CC_FOR_BUILD $dummy.c -o $dummy) >/dev/null 2>&1; then
-      x=`./$dummy`
+      x=`$dummy`
       if test -n "$x"; then
         exact_cpu=$x
       fi
     fi
-    rm -f $dummy.c $dummy.o $dummy
   fi
   ;;
 
@@ -573,6 +592,8 @@ sparc-*-* | sparc64-*-*)
     elif grep 'cpu.*MB86904' /proc/cpuinfo >/dev/null; then
       # actually MicroSPARC-II
       exact_cpu=microsparc
+    elif grep 'cpu.*UltraSparc T4' /proc/cpuinfo >/dev/null; then
+      exact_cpu="ultrasparct4"
     elif grep 'cpu.*UltraSparc T3' /proc/cpuinfo >/dev/null; then
       exact_cpu="ultrasparct3"
     elif grep 'cpu.*UltraSparc T2' /proc/cpuinfo >/dev/null; then
@@ -590,6 +611,9 @@ sparc-*-* | sparc64-*-*)
     fi
   fi
 
+  # Need to invoke this for setup of $dummy
+  eval $set_cc_for_build
+
   # Grep the output from sysinfo on SunOS.
   # sysinfo has been seen living in /bin or in /usr/kvm
   #    cpu0 is a "SuperSPARC Model 41 SPARCmodule" CPU
@@ -597,18 +621,17 @@ sparc-*-* | sparc64-*-*)
   #
   if test -z "$exact_cpu"; then
     for i in sysinfo /usr/kvm/sysinfo; do
-      if $SHELL -c $i 2>/dev/null >conftest.dat; then
-        if grep 'cpu0 is a "SuperSPARC' conftest.dat >/dev/null; then
+      if $SHELL -c $i 2>/dev/null >$dummy; then
+        if grep 'cpu0 is a "SuperSPARC' $dummy >/dev/null; then
           exact_cpu=supersparc
           break
-        elif grep 'cpu0 is a .*TMS390Z5.' conftest.dat >/dev/null; then
+        elif grep 'cpu0 is a .*TMS390Z5.' $dummy >/dev/null; then
           # TMS390Z50 and TMS390Z55
           exact_cpu=supersparc
           break
         fi
       fi
     done
-    rm -f conftest.dat
   fi
 
   # Grep the output from prtconf on Solaris.
@@ -631,35 +654,34 @@ sparc-*-* | sparc64-*-*)
   #
   for prtconfopt in "" "-vp"; do
     if test -z "$exact_cpu"; then
-      if $SHELL -c "/usr/sbin/prtconf $prtconfopt" 2>/dev/null >conftest.dat; then
-       if grep 'SUNW,UltraSPARC-T3' conftest.dat >/dev/null; then
+      if $SHELL -c "/usr/sbin/prtconf $prtconfopt" 2>/dev/null >$dummy; then
+       if grep 'SUNW,UltraSPARC-T3' $dummy >/dev/null; then
          exact_cpu=ultrasparct3
-       elif grep 'SUNW,UltraSPARC-T2' conftest.dat >/dev/null; then
+       elif grep 'SUNW,UltraSPARC-T2' $dummy >/dev/null; then
          exact_cpu=ultrasparct2
-       elif grep 'SUNW,UltraSPARC-T1' conftest.dat >/dev/null; then
+       elif grep 'SUNW,UltraSPARC-T1' $dummy >/dev/null; then
          exact_cpu=ultrasparct1
-       elif grep 'SUNW,UltraSPARC-III' conftest.dat >/dev/null; then
+       elif grep 'SUNW,UltraSPARC-III' $dummy >/dev/null; then
          exact_cpu=ultrasparc3
-       elif grep 'SUNW,UltraSPARC-IIi' conftest.dat >/dev/null; then
+       elif grep 'SUNW,UltraSPARC-IIi' $dummy >/dev/null; then
          exact_cpu=ultrasparc2i
-       elif grep 'SUNW,UltraSPARC-II' conftest.dat >/dev/null; then
+       elif grep 'SUNW,UltraSPARC-II' $dummy >/dev/null; then
          exact_cpu=ultrasparc2
-       elif grep 'SUNW,UltraSPARC' conftest.dat >/dev/null; then
+       elif grep 'SUNW,UltraSPARC' $dummy >/dev/null; then
          exact_cpu=ultrasparc
-       elif grep 'Ross,RT62.' conftest.dat >/dev/null; then
+       elif grep 'Ross,RT62.' $dummy >/dev/null; then
          # RT620, RT625, RT626 hypersparcs (v8).
          exact_cpu=sparcv8
-       elif grep 'TI,TMS390Z5.' conftest.dat >/dev/null; then
+       elif grep 'TI,TMS390Z5.' $dummy >/dev/null; then
          # TMS390Z50 and TMS390Z55
          exact_cpu=supersparc
-       elif grep 'TI,TMS390S10' conftest.dat >/dev/null; then
+       elif grep 'TI,TMS390S10' $dummy >/dev/null; then
          exact_cpu=microsparc
-       elif grep 'FMI,MB86904' conftest.dat >/dev/null; then
+       elif grep 'FMI,MB86904' $dummy >/dev/null; then
          # actually MicroSPARC-II
          exact_cpu=microsparc
        fi
       fi
-      rm -f conftest.dat
     fi
   done
 
@@ -670,34 +692,33 @@ sparc-*-* | sparc64-*-*)
   #     hw.model: Sun Microsystems UltraSparc-IIi
   #
   if test -z "$exact_cpu"; then
-    if $SHELL -c "/sbin/sysctl hw.model" 2>/dev/null >conftest.dat; then
-      if grep -i 'UltraSparc-T3' conftest.dat >/dev/null; then
+    if $SHELL -c "/sbin/sysctl hw.model" 2>/dev/null >$dummy; then
+      if grep -i 'UltraSparc-T3' $dummy >/dev/null; then
         exact_cpu=ultrasparct3
-      elif grep -i 'UltraSparc-T2' conftest.dat >/dev/null; then
+      elif grep -i 'UltraSparc-T2' $dummy >/dev/null; then
         exact_cpu=ultrasparct2
-      elif grep -i 'UltraSparc-T1' conftest.dat >/dev/null; then
+      elif grep -i 'UltraSparc-T1' $dummy >/dev/null; then
         exact_cpu=ultrasparct1
-      elif grep -i 'UltraSparc-III' conftest.dat >/dev/null; then
+      elif grep -i 'UltraSparc-III' $dummy >/dev/null; then
         exact_cpu=ultrasparc3
-      elif grep -i 'UltraSparc-IIi' conftest.dat >/dev/null; then
+      elif grep -i 'UltraSparc-IIi' $dummy >/dev/null; then
         exact_cpu=ultrasparc2i
-      elif grep -i 'UltraSparc-II' conftest.dat >/dev/null; then
+      elif grep -i 'UltraSparc-II' $dummy >/dev/null; then
         exact_cpu=ultrasparc2
-      elif grep -i 'UltraSparc' conftest.dat >/dev/null; then
+      elif grep -i 'UltraSparc' $dummy >/dev/null; then
         exact_cpu=ultrasparc
-      elif grep 'TMS390Z5.' conftest.dat >/dev/null; then
+      elif grep 'TMS390Z5.' $dummy >/dev/null; then
         # TMS390Z50 and TMS390Z55
         exact_cpu=supersparc
-      elif grep 'TMS390S10' conftest.dat >/dev/null; then
+      elif grep 'TMS390S10' $dummy >/dev/null; then
         exact_cpu=microsparc
-      elif grep 'MB86904' conftest.dat >/dev/null; then
+      elif grep 'MB86904' $dummy >/dev/null; then
         # actually MicroSPARC-II
         exact_cpu=microsparc
-      elif grep 'MB86907' conftest.dat >/dev/null; then
+      elif grep 'MB86907' $dummy >/dev/null; then
         exact_cpu=turbosparc
       fi
     fi
-    rm -f conftest.dat
   fi
 
   # sun4m and sun4d are v8s of some sort, sun4u is a v9 of some sort
@@ -717,41 +738,9 @@ sparc-*-* | sparc64-*-*)
 # conventions.
 
 i?86-*-* | amd64-*-* | x86_64-*-*)
-  cat <<EOF >${dummy}0.s
-       .globl cpuid
-       .globl _cpuid
-cpuid:
-_cpuid:
-       pushl %esi
-       pushl %ebx
-       movl 24(%esp),%eax
-       .byte 0x0f
-       .byte 0xa2
-       movl 20(%esp),%esi
-       movl %ebx,(%esi)
-       movl %edx,4(%esi)
-       movl %ecx,8(%esi)
-       popl %ebx
-       popl %esi
-       ret
-EOF
-  cat <<EOF >${dummy}1.s
-       .globl cpuid
-       .globl _cpuid
-cpuid:
-_cpuid:
-       push    %rbx
-       mov     %rdx, %r8
-       mov     %ecx, %eax
-       .byte   0x0f
-       .byte   0xa2
-       mov     %ebx, (%r8)
-       mov     %edx, 4(%r8)
-       mov     %ecx, 8(%r8)
-       pop     %rbx
-       ret
-EOF
-  cat <<EOF >${dummy}2.c
+  eval $set_cc_for_build
+
+  cat <<EOF >$dummy.c
 #include <string.h>
 #include <stdio.h>
 #define CPUID(a,b) cpuid(b,a,a,b)
@@ -768,6 +757,7 @@ main ()
   int family, model, stepping;
   const char *modelstr;
   int cpu_64bit = 0;
+  int cpuid_64bit;
 
   CPUID (vendor_string, 0);
   vendor_string[12] = 0;
@@ -792,29 +782,48 @@ main ()
          else if (model >= 4)  modelstr = "pentiummmx";
          break;
        case 6:
-         if (model <= 1)               modelstr = "pentiumpro";
-         else if (model <= 6)          modelstr = "pentium2";
-         else if (model <= 8)          modelstr = "pentium3";
-         else if (model <= 9)          modelstr = "pentiumm";
-         else if (model <= 0x0c)       modelstr = "pentium3";
-         else if (model <= 0x0e)       modelstr = "pentiumm";
-         else if (model <= 0x19)       cpu_64bit = 1, modelstr = "core2";
-         else if (model == 0x1a)       cpu_64bit = 1, modelstr = "coreinhm"; /* NHM Gainestown */
-         else if (model == 0x1c)       cpu_64bit = 1, modelstr = "atom";  /* Silverthorne */
-         else if (model == 0x1d)       cpu_64bit = 1, modelstr = "core2"; /* PNR Dunnington */
-         else if (model == 0x1e)       cpu_64bit = 1, modelstr = "coreinhm"; /* NHM Lynnfield/Jasper */
-         else if (model == 0x25)       cpu_64bit = 1, modelstr = "coreiwsm"; /* WSM Clarkdale/Arrandale */
-         else if (model == 0x26)       cpu_64bit = 1, modelstr = "atom";  /* Lincroft */
-         else if (model == 0x27)       cpu_64bit = 1, modelstr = "atom";  /* Saltwell */
-         else if (model == 0x2a)       cpu_64bit = 1, modelstr = "coreisbr"; /* SB */
-         else if (model == 0x2c)       cpu_64bit = 1, modelstr = "coreiwsm"; /* WSM Gulftown */
-         else if (model == 0x2d)       cpu_64bit = 1, modelstr = "coreisbr"; /* SBC-EP */
-         else if (model == 0x2e)       cpu_64bit = 1, modelstr = "coreinhm"; /* NHM Beckton */
-         else if (model == 0x2f)       cpu_64bit = 1, modelstr = "coreiwsm"; /* WSM Eagleton */
-         else if (model == 0x3a)       cpu_64bit = 1, modelstr = "coreisbr"; /* IBR */
-         else if (model == 0x3c)       cpu_64bit = 1, modelstr = "coreisbr"; /* Haswell */
-         else if (model == 0x36)       cpu_64bit = 1, modelstr = "atom";  /* Cedarview/Saltwell */
-         else cpu_64bit = 1, modelstr = "corei"; /* default */
+          if (model <= 1)                        modelstr = "pentiumpro";
+          else if (model <= 6)                   modelstr = "pentium2";
+          else if (model <= 8)                   modelstr = "pentium3";
+          else if (model <= 9)                   modelstr = "pentiumm";
+          else if (model <= 0x0c)                modelstr = "pentium3";
+          else if (model <= 0x0e)                modelstr = "pentiumm";
+          else if (model <= 0x19) cpu_64bit = 1, modelstr = "core2";
+          else if (model == 0x1a) cpu_64bit = 1, modelstr = "coreinhm"; /* NHM Gainestown */
+          else if (model == 0x1c) cpu_64bit = 1, modelstr = "atom";     /* Silverthorne */
+          else if (model == 0x1d) cpu_64bit = 1, modelstr = "core2";    /* PNR Dunnington */
+          else if (model == 0x1e) cpu_64bit = 1, modelstr = "coreinhm"; /* NHM Lynnfield/Jasper */
+          else if (model == 0x25) cpu_64bit = 1, modelstr = "coreiwsm"; /* WSM Clarkdale/Arrandale */
+          else if (model == 0x26) cpu_64bit = 1, modelstr = "atom";     /* Lincroft */
+          else if (model == 0x27) cpu_64bit = 1, modelstr = "atom";     /* Saltwell */
+          else if (model == 0x2a) cpu_64bit = 1, modelstr = "coreisbr"; /* SB */
+          else if (model == 0x2c) cpu_64bit = 1, modelstr = "coreiwsm"; /* WSM Gulftown */
+          else if (model == 0x2d) cpu_64bit = 1, modelstr = "coreisbr"; /* SBC-EP */
+          else if (model == 0x2e) cpu_64bit = 1, modelstr = "coreinhm"; /* NHM Beckton */
+          else if (model == 0x2f) cpu_64bit = 1, modelstr = "coreiwsm"; /* WSM Eagleton */
+          else if (model == 0x36) cpu_64bit = 1, modelstr = "atom";     /* Cedarview/Saltwell */
+          else if (model == 0x37) cpu_64bit = 1, modelstr = "coreinhm"; /* Atom Silvermont */
+          else if (model == 0x3a) cpu_64bit = 1, modelstr = "coreisbr"; /* IBR */
+          else if (model == 0x3c) cpu_64bit = 1, modelstr = "coreihwl"; /* Haswell client */
+          else if (model == 0x3d) cpu_64bit = 1, modelstr = "coreibwl"; /* Broadwell */
+          else if (model == 0x3e) cpu_64bit = 1, modelstr = "coreisbr"; /* Ivytown */
+          else if (model == 0x3f) cpu_64bit = 1, modelstr = "coreihwl"; /* Haswell server */
+          else if (model == 0x45) cpu_64bit = 1, modelstr = "coreihwl"; /* Haswell ULT */
+          else if (model == 0x46) cpu_64bit = 1, modelstr = "coreihwl"; /* Crystal Well */
+          else if (model == 0x4d) cpu_64bit = 1, modelstr = "coreinhm"; /* Silvermont/Avoton */
+          else if (model == 0x4f) cpu_64bit = 1, modelstr = "coreibwl"; /* Broadwell server */
+          else if (model == 0x56) cpu_64bit = 1, modelstr = "coreibwl"; /* Broadwell microserver */
+          else cpu_64bit = 1, modelstr = "corei"; /* default */
+
+         if (strcmp (modelstr, "coreihwl") == 0)
+           {
+             /* Some Haswells lack BMI2.  Let them appear as Sandybridges for
+                now.  */
+             CPUID (dummy_string, 7);
+             if ((dummy_string[0 + 8 / 8] & (1 << (8 % 8))) == 0)
+               modelstr = "coreisbr";
+           }
+
          break;
        case 15:
          cpu_64bit = 1, modelstr = "pentium4";
@@ -855,10 +864,18 @@ main ()
          cpu_64bit = 1, modelstr = "bobcat";
          break;
        case 21:                /* Bulldozer */
-         cpu_64bit = 1, modelstr = "bulldozer";
+         cpu_64bit = 1;
+         if (model <= 1)
+           modelstr = "bulldozer";
+         else if (model < 0x20)        /* really 2, [0x10-0x20) */
+           modelstr = "piledriver";
+         else if (model < 0x40)        /* really [0x30-0x40) */
+           modelstr = "steamroller";
+         else                          /* really [0x60-0x70) */
+           modelstr = "excavator";
          break;
-       case 22:                /* jaguar, an improved bobcat */
-         cpu_64bit = 1, modelstr = "bobcat";
+       case 22:                /* Jaguar, an improved bobcat */
+         cpu_64bit = 1, modelstr = "jaguar";
          break;
        }
     }
@@ -878,18 +895,43 @@ main ()
        }
     }
 
-  /* If our cpuid-based exact guess is more conservative than the previous
-     guess, revert.  This is of course wrong, but it can happen in an emulator,
-     so this workaround allows for successful 64-bit builds.  */
-  if (strcmp ("$guess_cpu", "x86_64") == 0 && ! cpu_64bit)
-    modelstr = "$guess_cpu";
+  CPUID (dummy_string, 0x80000001);
+  cpuid_64bit = (dummy_string[7] >> 5) & 1;
+
+  /* If our cpuid-based CPU identification thinks this is a 32-bit CPU but
+     cpuid claims AMD64 capabilities, then revert to the generic "x86_64".
+     This is of course wrong, but it can happen in some emulators, so this
+     workaround allows for successful 64-bit builds.  */
+  if (cpuid_64bit && ! cpu_64bit)
+    modelstr = "x86_64";
 
   printf ("%s", modelstr);
   return 0;
 }
 EOF
 
-  if ($CC_FOR_BUILD ${dummy}1.s ${dummy}2.c -o $dummy) >/dev/null 2>&1; then
+# The rcx/ecx zeroing here and in the variant below is needed for the BMI2
+# check.
+
+  cat <<EOF >${dummy}0.s
+       .globl cpuid
+       .globl _cpuid
+cpuid:
+_cpuid:
+       push    %rbx
+       mov     %rdx, %r8
+       mov     %ecx, %eax
+       xor     %ecx, %ecx
+       .byte   0x0f
+       .byte   0xa2
+       mov     %ebx, (%r8)
+       mov     %edx, 4(%r8)
+       mov     %ecx, 8(%r8)
+       pop     %rbx
+       ret
+EOF
+
+  if ($CC_FOR_BUILD ${dummy}0.s $dummy.c -o $dummy) >/dev/null 2>&1; then
     # On 80386 and early 80486 cpuid is not available and will result in a
     # SIGILL message, hence 2>/dev/null.
     #
@@ -897,14 +939,34 @@ EOF
     # "Illegal instruction (core dumped)" message to stdout, so we test $?
     # to check if the program run was successful.
     #
-    x=`$SHELL -c ./$dummy 2>/dev/null`
+    x=`$SHELL -c $dummy 2>/dev/null`
     if test $? = 0 && test -n "$x"; then
       exact_cpu=$x
     fi
   fi
 
+  cat <<EOF >${dummy}0.s
+       .globl cpuid
+       .globl _cpuid
+cpuid:
+_cpuid:
+       pushl %esi
+       pushl %ebx
+       movl 24(%esp),%eax
+       xor     %ecx, %ecx
+       .byte 0x0f
+       .byte 0xa2
+       movl 20(%esp),%esi
+       movl %ebx,(%esi)
+       movl %edx,4(%esi)
+       movl %ecx,8(%esi)
+       popl %ebx
+       popl %esi
+       ret
+EOF
+
   if test -z "$exact_cpu"; then
-  if ($CC_FOR_BUILD ${dummy}0.s ${dummy}2.c -o $dummy) >/dev/null 2>&1; then
+  if ($CC_FOR_BUILD ${dummy}0.s $dummy.c -o $dummy) >/dev/null 2>&1; then
     # On 80386 and early 80486 cpuid is not available and will result in a
     # SIGILL message, hence 2>/dev/null.
     #
@@ -912,7 +974,7 @@ EOF
     # "Illegal instruction (core dumped)" message to stdout, so we test $?
     # to check if the program run was successful.
     #
-    x=`$SHELL -c ./$dummy 2>/dev/null`
+    x=`$SHELL -c $dummy 2>/dev/null`
     if test $? = 0 && test -n "$x"; then
       exact_cpu=$x
     fi
@@ -921,7 +983,6 @@ EOF
 
   # We need to remove some .o files here since lame C compilers
   # generate these even when not asked.
-  rm -f ${dummy}0.s ${dummy}0.o ${dummy}1.s ${dummy}1.o ${dummy}2.c ${dummy}2.o $dummy
   ;;
 
 s390*-*-*)
index 57b138a297086adc43e2d6c9cb41bccbf7b3d5e5..e94acd7c03a941ccdba6b8cefb0db950efbce1bc 100644 (file)
--- a/config.in
+++ b/config.in
@@ -2,23 +2,33 @@
 
 /*
 
-Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Copyright 1996-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU 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 if building universal (internal helper macro) */
@@ -224,7 +234,6 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
 #undef HAVE_NATIVE_mpn_add_n_sub_n
 #undef HAVE_NATIVE_mpn_add_nc
 #undef HAVE_NATIVE_mpn_addaddmul_1msb0
-#undef HAVE_NATIVE_mpn_addcnd_n
 #undef HAVE_NATIVE_mpn_addlsh1_n
 #undef HAVE_NATIVE_mpn_addlsh2_n
 #undef HAVE_NATIVE_mpn_addlsh_n
@@ -257,9 +266,12 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
 #undef HAVE_NATIVE_mpn_bdiv_dbm1c
 #undef HAVE_NATIVE_mpn_bdiv_q_1
 #undef HAVE_NATIVE_mpn_pi1_bdiv_q_1
+#undef HAVE_NATIVE_mpn_cnd_add_n
+#undef HAVE_NATIVE_mpn_cnd_sub_n
 #undef HAVE_NATIVE_mpn_com
 #undef HAVE_NATIVE_mpn_copyd
 #undef HAVE_NATIVE_mpn_copyi
+#undef HAVE_NATIVE_mpn_div_qr_1n_pi1
 #undef HAVE_NATIVE_mpn_div_qr_2
 #undef HAVE_NATIVE_mpn_divexact_1
 #undef HAVE_NATIVE_mpn_divexact_by3c
@@ -313,7 +325,6 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
 #undef HAVE_NATIVE_mpn_sqr_diag_addlsh1
 #undef HAVE_NATIVE_mpn_sub_n
 #undef HAVE_NATIVE_mpn_sub_nc
-#undef HAVE_NATIVE_mpn_subcnd_n
 #undef HAVE_NATIVE_mpn_sublsh1_n
 #undef HAVE_NATIVE_mpn_sublsh2_n
 #undef HAVE_NATIVE_mpn_sublsh_n
@@ -387,9 +398,6 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
 /* Define to 1 if the system has the type `stack_t'. */
 #undef HAVE_STACK_T
 
-/* Define to 1 if <stdarg.h> exists and works */
-#undef HAVE_STDARG
-
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
@@ -562,6 +570,9 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
 /* Define to 1 to enable ASSERT checking, per --enable-assert */
 #undef WANT_ASSERT
 
+/* Define to 1 to enable GMP_CPU_TYPE faking cpuid, per --enable-fake-cpuid */
+#undef WANT_FAKE_CPUID
+
 /* Define to 1 when building a fat binary. */
 #undef WANT_FAT_BINARY
 
index 0777c0df037069063eade1223f7833c4f4926612..d734c434580f13e3e13331e8e9636f180b5fbefc 100755 (executable)
@@ -3,22 +3,33 @@
 # GMP config.sub wrapper.
 
 
-# Copyright 2000, 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
+# Copyright 2000-2003, 2006, 2009-2014 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 # Usage: config.sub CPU-VENDOR-OS
@@ -91,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 | core2 | corei | coreinhm | coreiwsm | coreisbr | opteron | k[89] | k10 | bobcat | bulldozer | nano)
+athlon64 | atom | core2 | corei | coreinhm | coreiwsm | coreisbr | coreihwl | coreibwl | opteron | k[89] | k10 | bobcat | jaguar | bulldozer | piledriver | steamroller | excavator | nano)
   test_cpu=x86_64 ;;
 power[2-9] | power2sc)
   test_cpu=power ;;
@@ -116,11 +127,10 @@ z900 | z990 | z9 | z10 | z196)
 z900esa | z990esa | z9esa | z10esa | z196esa)
   test_cpu=s390;;
 
-armxscale | armxscale | armxscale | armxscale | armxscale | armxscale |        \
-armti915t | armti925t | arm926 | arm946 | arm966 | armsa1 | arm1026 |  \
-arm11mpcore | armsa1 | arm1136 | arm1156 | arm1176 | armcortexa5 |     \
-armcortexa8 | armcortexa9 | armcortexa15 | armcortexr4 | armcortexr5 | \
-armcortexm3)
+armsa1 | armxscale | arm9tdmi | arm9te |                               \
+arm10* | arm11mpcore | armsa1 | arm1136 | arm1156 | arm1176 |          \
+armcortexa5 | armcortexa7 | armcortexa8 | armcortexa9 | armcortexa15 | \
+armcortexr4 | armcortexr5 | armcortexm3)
   test_cpu="arm";;
 
 *)
index 872b96a161eecdf418668d0c9dc2ca84a34b6642..9afd676206481a1f280f5da099fe1717246ae1e5 100755 (executable)
@@ -1,14 +1,12 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011, 2012 Free Software Foundation, Inc.
+#   Copyright 1992-2013 Free Software Foundation, Inc.
 
-timestamp='2012-09-25'
+timestamp='2013-11-29'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but
@@ -22,19 +20,17 @@ timestamp='2012-09-25'
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner.  Please send patches (context
-# diff format) to <config-patches@gnu.org> and include a ChangeLog
-# entry.
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
 #
-# This script attempts to guess a canonical system name similar to
-# config.sub.  If it succeeds, it prints the system name on stdout, and
-# exits with 0.  Otherwise, it exits with 1.
+# Originally written by Per Bothner.
 #
 # You can get the latest version of this script from:
 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -54,9 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -138,6 +132,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+       # If the system lacks a compiler, then just pick glibc.
+       # We could probably try harder.
+       LIBC=gnu
+
+       eval $set_cc_for_build
+       cat <<-EOF > $dummy.c
+       #include <features.h>
+       #if defined(__UCLIBC__)
+       LIBC=uclibc
+       #elif defined(__dietlibc__)
+       LIBC=dietlibc
+       #else
+       LIBC=gnu
+       #endif
+       EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+       ;;
+esac
+
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -859,21 +874,21 @@ EOF
        exit ;;
     *:GNU:*:*)
        # the GNU system
-       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
        exit ;;
     *:GNU/*:*:*)
        # other systems with GNU libc and userland
-       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
        exit ;;
     i*86:Minix:*:*)
        echo ${UNAME_MACHINE}-pc-minix
        exit ;;
     aarch64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     aarch64_be:Linux:*:*)
        UNAME_MACHINE=aarch64_be
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     alpha:Linux:*:*)
        case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@@ -886,59 +901,54 @@ EOF
          EV68*) UNAME_MACHINE=alphaev68 ;;
        esac
        objdump --private-headers /bin/sh | grep -q ld.so.1
-       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+       if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    arc:Linux:*:* | arceb:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     arm*:Linux:*:*)
        eval $set_cc_for_build
        if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
            | grep -q __ARM_EABI__
        then
-           echo ${UNAME_MACHINE}-unknown-linux-gnu
+           echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        else
            if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
                | grep -q __ARM_PCS_VFP
            then
-               echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+               echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
            else
-               echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+               echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
            fi
        fi
        exit ;;
     avr32*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     cris:Linux:*:*)
-       echo ${UNAME_MACHINE}-axis-linux-gnu
+       echo ${UNAME_MACHINE}-axis-linux-${LIBC}
        exit ;;
     crisv32:Linux:*:*)
-       echo ${UNAME_MACHINE}-axis-linux-gnu
+       echo ${UNAME_MACHINE}-axis-linux-${LIBC}
        exit ;;
     frv:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     hexagon:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     i*86:Linux:*:*)
-       LIBC=gnu
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-       #ifdef __dietlibc__
-       LIBC=dietlibc
-       #endif
-EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
-       echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+       echo ${UNAME_MACHINE}-pc-linux-${LIBC}
        exit ;;
     ia64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     m32r*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     m68*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     mips:Linux:*:* | mips64:Linux:*:*)
        eval $set_cc_for_build
@@ -957,54 +967,63 @@ EOF
        #endif
 EOF
        eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
-       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
        ;;
+    or1k:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
     or32:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     padre:Linux:*:*)
-       echo sparc-unknown-linux-gnu
+       echo sparc-unknown-linux-${LIBC}
        exit ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-       echo hppa64-unknown-linux-gnu
+       echo hppa64-unknown-linux-${LIBC}
        exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
        # Look for CPU level
        case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-         PA7*) echo hppa1.1-unknown-linux-gnu ;;
-         PA8*) echo hppa2.0-unknown-linux-gnu ;;
-         *)    echo hppa-unknown-linux-gnu ;;
+         PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+         PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+         *)    echo hppa-unknown-linux-${LIBC} ;;
        esac
        exit ;;
     ppc64:Linux:*:*)
-       echo powerpc64-unknown-linux-gnu
+       echo powerpc64-unknown-linux-${LIBC}
        exit ;;
     ppc:Linux:*:*)
-       echo powerpc-unknown-linux-gnu
+       echo powerpc-unknown-linux-${LIBC}
+       exit ;;
+    ppc64le:Linux:*:*)
+       echo powerpc64le-unknown-linux-${LIBC}
+       exit ;;
+    ppcle:Linux:*:*)
+       echo powerpcle-unknown-linux-${LIBC}
        exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
-       echo ${UNAME_MACHINE}-ibm-linux
+       echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
        exit ;;
     sh64*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     sh*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     tile*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     vax:Linux:*:*)
-       echo ${UNAME_MACHINE}-dec-linux-gnu
+       echo ${UNAME_MACHINE}-dec-linux-${LIBC}
        exit ;;
     x86_64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     xtensa*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     i*86:DYNIX/ptx:4*:*)
        # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1237,19 +1256,31 @@ EOF
        exit ;;
     *:Darwin:*:*)
        UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-       case $UNAME_PROCESSOR in
-           i386)
-               eval $set_cc_for_build
-               if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
-                 if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-                     (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
-                     grep IS_64BIT_ARCH >/dev/null
-                 then
-                     UNAME_PROCESSOR="x86_64"
-                 fi
-               fi ;;
-           unknown) UNAME_PROCESSOR=powerpc ;;
-       esac
+       eval $set_cc_for_build
+       if test "$UNAME_PROCESSOR" = unknown ; then
+           UNAME_PROCESSOR=powerpc
+       fi
+       if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+           if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+               if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+                   (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+                   grep IS_64BIT_ARCH >/dev/null
+               then
+                   case $UNAME_PROCESSOR in
+                       i386) UNAME_PROCESSOR=x86_64 ;;
+                       powerpc) UNAME_PROCESSOR=powerpc64 ;;
+                   esac
+               fi
+           fi
+       elif test "$UNAME_PROCESSOR" = i386 ; then
+           # Avoid executing cc on OS X 10.9, as it ships with a stub
+           # that puts up a graphical alert prompting to install
+           # developer tools.  Any system running Mac OS X 10.7 or
+           # later (Darwin 11 and later) is required to have a 64-bit
+           # processor. This is not true of the ARM version of Darwin
+           # that Apple uses in portable devices.
+           UNAME_PROCESSOR=x86_64
+       fi
        echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
        exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
old mode 100755 (executable)
new mode 100644 (file)
index 8df5511..61cb4bc
@@ -1,24 +1,18 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011, 2012 Free Software Foundation, Inc.
+#   Copyright 1992-2013 Free Software Foundation, Inc.
 
-timestamp='2012-12-06'
+timestamp='2013-10-01'
 
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine.  It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 #
-# This program 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.
+# This program 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 a copy of the GNU General Public License
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
@@ -26,11 +20,12 @@ timestamp='2012-12-06'
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
 
 
-# Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted GNU ChangeLog entry.
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
@@ -73,9 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -259,12 +252,12 @@ case $basic_machine in
        | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
        | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
        | am33_2.0 \
-       | arc \
+       | arc | arceb \
        | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
        | avr | avr32 \
        | be32 | be64 \
        | bfin \
-       | c4x | clipper \
+       | c4x | c8051 | clipper \
        | d10v | d30v | dlx | dsp16xx \
        | epiphany \
        | fido | fr30 | frv \
@@ -272,6 +265,7 @@ case $basic_machine in
        | hexagon \
        | i370 | i860 | i960 | ia64 \
        | ip2k | iq2000 \
+       | k1om \
        | le32 | le64 \
        | lm32 \
        | m32c | m32r | m32rle | m68000 | m68k | m88k \
@@ -293,16 +287,17 @@ case $basic_machine in
        | mipsisa64r2 | mipsisa64r2el \
        | mipsisa64sb1 | mipsisa64sb1el \
        | mipsisa64sr71k | mipsisa64sr71kel \
+       | mipsr5900 | mipsr5900el \
        | mipstx39 | mipstx39el \
        | mn10200 | mn10300 \
        | moxie \
        | mt \
        | msp430 \
        | nds32 | nds32le | nds32be \
-       | nios | nios2 \
+       | nios | nios2 | nios2eb | nios2el \
        | ns16k | ns32k \
        | open8 \
-       | or32 \
+       | or1k | or32 \
        | pdp10 | pdp11 | pj | pjl \
        | powerpc | powerpc64 | powerpc64le | powerpcle \
        | pyramid \
@@ -330,7 +325,7 @@ case $basic_machine in
        c6x)
                basic_machine=tic6x-unknown
                ;;
-       m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
+       m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
                basic_machine=$basic_machine-unknown
                os=-none
                ;;
@@ -372,13 +367,13 @@ case $basic_machine in
        | aarch64-* | aarch64_be-* \
        | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
        | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
-       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
        | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
        | avr-* | avr32-* \
        | be32-* | be64-* \
        | bfin-* | bs2000-* \
        | c[123]* | c30-* | [cjt]90-* | c4x-* \
-       | clipper-* | craynv-* | cydra-* \
+       | c8051-* | clipper-* | craynv-* | cydra-* \
        | d10v-* | d30v-* | dlx-* \
        | elxsi-* \
        | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
@@ -387,6 +382,7 @@ case $basic_machine in
        | hexagon-* \
        | i*86-* | i860-* | i960-* | ia64-* \
        | ip2k-* | iq2000-* \
+       | k1om-* \
        | le32-* | le64-* \
        | lm32-* \
        | m32c-* | m32r-* | m32rle-* \
@@ -410,12 +406,13 @@ case $basic_machine in
        | mipsisa64r2-* | mipsisa64r2el-* \
        | mipsisa64sb1-* | mipsisa64sb1el-* \
        | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+       | mipsr5900-* | mipsr5900el-* \
        | mipstx39-* | mipstx39el-* \
        | mmix-* \
        | mt-* \
        | msp430-* \
        | nds32-* | nds32le-* | nds32be-* \
-       | nios-* | nios2-* \
+       | nios-* | nios2-* | nios2eb-* | nios2el-* \
        | none-* | np1-* | ns16k-* | ns32k-* \
        | open8-* \
        | orion-* \
@@ -799,7 +796,7 @@ case $basic_machine in
                os=-mingw64
                ;;
        mingw32)
-               basic_machine=i386-pc
+               basic_machine=i686-pc
                os=-mingw32
                ;;
        mingw32ce)
@@ -835,7 +832,7 @@ case $basic_machine in
                basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
                ;;
        msys)
-               basic_machine=i386-pc
+               basic_machine=i686-pc
                os=-msys
                ;;
        mvs)
@@ -1357,7 +1354,7 @@ case $os in
        -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
              | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
              | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
-             | -sym* | -kopensolaris* \
+             | -sym* | -kopensolaris* | -plan9* \
              | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
              | -aos* | -aros* \
              | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
@@ -1503,9 +1500,6 @@ case $os in
        -aros*)
                os=-aros
                ;;
-       -kaos*)
-               os=-kaos
-               ;;
        -zvmoe)
                os=-zvmoe
                ;;
@@ -1554,6 +1548,9 @@ case $basic_machine in
        c4x-* | tic4x-*)
                os=-coff
                ;;
+       c8051-*)
+               os=-elf
+               ;;
        hexagon-*)
                os=-elf
                ;;
@@ -1597,6 +1594,9 @@ case $basic_machine in
        mips*-*)
                os=-elf
                ;;
+       or1k-*)
+               os=-elf
+               ;;
        or32-*)
                os=-coff
                ;;
index eaadd20b23387dedf8c8a71dfd6b9a1d4c7b98c0..60c6bd55ebf4234aa7298941b91850429555228e 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,29 +1,39 @@
 #! /bin/sh
 # From configure.ac Revision.
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for GNU MP 5.1.3.
+# Generated by GNU Autoconf 2.69 for GNU MP 6.0.0.
 #
-# Report bugs to <gmp-bugs@gmplib.org, see http://gmplib.org/manual/Reporting-Bugs.html>.
+# Report bugs to <gmp-bugs@gmplib.org, see https://gmplib.org/manual/Reporting-Bugs.html>.
 #
 #
 #
-# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-# 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+# Copyright 1996-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 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.
+# 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 Lesser General Public
-# License for more details.
+# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+# You should have received copies of the GNU General Public License and the
+# GNU Lesser General Public License along with the GNU MP Library.  If not,
+# see https://www.gnu.org/licenses/.
 #
 #
 #
@@ -298,10 +308,10 @@ fi
   else
     $as_echo "$0: Please tell bug-autoconf@gnu.org and
 $0: gmp-bugs@gmplib.org, see
-$0: http://gmplib.org/manual/Reporting-Bugs.html about your
-$0: system, including any error possibly output before this
-$0: message. Then install a modern shell, or manually run
-$0: the script under such a shell if you do have one."
+$0: https://gmplib.org/manual/Reporting-Bugs.html about
+$0: your system, including any error possibly output before
+$0: this message. Then install a modern shell, or manually
+$0: run the script under such a shell if you do have one."
   fi
   exit 1
 fi
@@ -613,9 +623,9 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='GNU MP'
 PACKAGE_TARNAME='gmp'
-PACKAGE_VERSION='5.1.3'
-PACKAGE_STRING='GNU MP 5.1.3'
-PACKAGE_BUGREPORT='gmp-bugs@gmplib.org, see http://gmplib.org/manual/Reporting-Bugs.html'
+PACKAGE_VERSION='6.0.0'
+PACKAGE_STRING='GNU MP 6.0.0'
+PACKAGE_BUGREPORT='gmp-bugs@gmplib.org, see https://gmplib.org/manual/Reporting-Bugs.html'
 PACKAGE_URL='http://www.gnu.org/software/gmp/'
 
 ac_unique_file="gmp-impl.h"
@@ -828,6 +838,7 @@ enable_profiling
 with_readline
 enable_fat
 enable_minithres
+enable_fake_cpuid
 enable_shared
 enable_static
 with_pic
@@ -1395,7 +1406,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 GNU MP 5.1.3 to adapt to many kinds of systems.
+\`configure' configures GNU MP 6.0.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1465,7 +1476,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of GNU MP 5.1.3:";;
+     short | recursive ) echo "Configuration of GNU MP 6.0.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1487,6 +1498,7 @@ Optional Features:
   --enable-fat            build a fat binary on systems that support it
                           [[default=no]]
   --enable-minithres      choose minimal thresholds for testing [[default=no]]
+  --enable-fake-cpuid     enable GMP_CPU_TYPE faking cpuid [[default=no]]
   --enable-shared[=PKGS]  build shared libraries [default=yes]
   --enable-static[=PKGS]  build static libraries [default=yes]
   --enable-fast-install[=PKGS]
@@ -1532,7 +1544,7 @@ Some influential environment variables:
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
-Report bugs to <gmp-bugs@gmplib.org, see http://gmplib.org/manual/Reporting-Bugs.html>.
+Report bugs to <gmp-bugs@gmplib.org, see https://gmplib.org/manual/Reporting-Bugs.html>.
 GNU MP home page: <http://www.gnu.org/software/gmp/>.
 General help using GNU software: <http://www.gnu.org/gethelp/>.
 _ACEOF
@@ -1597,7 +1609,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-GNU MP configure 5.1.3
+GNU MP configure 6.0.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1606,23 +1618,33 @@ gives unlimited permission to copy, distribute and modify it.
 
 
 
-Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Copyright 1996-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 _ACEOF
   exit
@@ -2014,52 +2036,6 @@ fi
 
 } # ac_fn_cxx_try_link
 
-# ac_fn_f77_try_link LINENO
-# -------------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_f77_try_link ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext conftest$ac_exeext
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && {
-        test -z "$ac_f77_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        test -x conftest$ac_exeext
-       }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_retval=1
-fi
-  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
-  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
-  # interfere with the next link command; also delete a directory that is
-  # left behind by Apple's compiler.  We do this before executing the actions.
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_f77_try_link
-
 # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
 # -------------------------------------------------------
 # Tests whether HEADER exists, giving a warning if it cannot be compiled using
@@ -2639,7 +2615,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 GNU MP $as_me 5.1.3, which was
+It was created by GNU MP $as_me 6.0.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2996,6 +2972,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
+
 # If --target is not used then $target_alias is empty, but if say
 # "./configure athlon-pc-freebsd3.5" is used, then all three of
 # $build_alias, $host_alias and $target_alias are set to
@@ -3566,7 +3543,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='gmp'
- VERSION='5.1.3'
+ VERSION='6.0.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3851,10 +3828,32 @@ fi
 
 
 
+# Check whether --enable-fake-cpuid was given.
+if test "${enable_fake_cpuid+set}" = set; then :
+  enableval=$enable_fake_cpuid; case $enableval in
+yes|no) ;;
+*) as_fn_error $? "bad value $enableval for --enable-fake-cpuid, need yes or no" "$LINENO" 5 ;;
+esac
+else
+  enable_fake_cpuid=no
+fi
+
+
+if test "$enable_fake_cpuid" = "yes"; then
+
+$as_echo "#define WANT_FAKE_CPUID 1" >>confdefs.h
+
+fi
+
+
 if test $enable_fat = yes && test $enable_assembly = no ; then
   as_fn_error $? "when doing a fat build, disabling assembly will not work" "$LINENO" 5
 fi
 
+if test $enable_fake_cpuid = yes && test $enable_fat = no ; then
+  as_fn_error $? "--enable-fake-cpuid requires --enable-fat" "$LINENO" 5
+fi
+
 
 tmp_host=`echo $host_cpu | sed 's/\./_/'`
 cat >>confdefs.h <<_ACEOF
@@ -3993,11 +3992,6 @@ HAVE_HOST_CPU_FAMILY_powerpc=0
 
 case $host in
 
-  a29k*-*-*)
-    path="a29k"
-    ;;
-
-
   alpha*-*-*)
     $as_echo "#define HAVE_HOST_CPU_FAMILY_alpha 1" >>confdefs.h
 
@@ -4011,8 +4005,11 @@ case $host in
       *)
         path="alpha" ;;
     esac
-    extra_functions="cntlz"
+    if test "$enable_assembly" = "yes" ; then
+       extra_functions="cntlz"
+    fi
     gcc_cflags_optlist="asm cpu oldas" # need asm ahead of cpu, see below
+    gcc_cflags_maybe="-mieee"
     gcc_cflags_oldas="-Wa,-oldas"     # see GMP_GCC_WA_OLDAS.
 
     # gcc 2.7.2.3 doesn't know any -mcpu= for alpha, apparently.
@@ -4142,9 +4139,14 @@ echo "include_mpn(\`alpha/default.m4')" >> $gmp_tmpconfigm4i
     ;;
 
 
+  arm64*-*-* | aarch64*-*-*)
+    path="arm64"
+    ;;
+
+
   arm*-*-*)
     gcc_cflags="$gcc_cflags $fomit_frame_pointer"
-    gcc_cflags_optlist="arch tune"
+    gcc_cflags_optlist="arch neon tune"
     gcc_cflags_maybe="-marm"
     gcc_testlist="gcc-arm-umodsi"
 
@@ -4152,12 +4154,15 @@ echo "include_mpn(\`arm/arm-defs.m4')" >> $gmp_tmpconfigm4i
 
     CALLING_CONVENTIONS_OBJS='arm32call.lo arm32check.lo'
 
+    # FIXME: We make mandatory compiler options optional here.  We should
+    # either enforce them, or organise to strip paths as the corresponding
+    # options fail.
     case $host_cpu in
-      armsa1 | armv4*)
+      armsa1 | arm9tdmi | armv4*)
        path="arm"
        gcc_cflags_arch="-march=armv4"
        ;;
-      armxscale | arm926 | arm946 | arm966 | arm1026 | armv5*)
+      armxscale | arm9te | arm10 | armv5*)
        path="arm/v5 arm"
        gcc_cflags_arch="-march=armv5"
        ;;
@@ -4169,19 +4174,42 @@ echo "include_mpn(\`arm/arm-defs.m4')" >> $gmp_tmpconfigm4i
        path="arm/v6t2 arm/v6 arm/v5 arm"
        gcc_cflags_arch="-march=armv6t2"
        ;;
+      armcortexa5 | armv7a*)
+       path="arm/v6t2 arm/v6 arm/v5 arm"
+       gcc_cflags_arch="-march=armv7-a"
+       ;;
+      armcortexa8)
+       path="arm/v6t2 arm/v6 arm/v5 arm"
+       gcc_cflags_arch="-march=armv7-a"
+       gcc_cflags_tune="-mtune=cortex-a8"
+       ;;
+      armcortexa8neon)
+       path="arm/v6t2 arm/v6 arm/v5 arm/neon arm"
+       gcc_cflags_arch="-march=armv7-a"
+       gcc_cflags_neon="-mfpu=neon"
+       gcc_cflags_tune="-mtune=cortex-a8"
+       ;;
       armcortexa9)
        path="arm/v7a/cora9 arm/v6t2 arm/v6 arm/v5 arm"
        gcc_cflags_arch="-march=armv7-a"
        gcc_cflags_tune="-mtune=cortex-a9"
        ;;
+      armcortexa9neon)
+       path="arm/v7a/cora9 arm/v6t2 arm/v6 arm/v5 arm/neon arm"
+       gcc_cflags_arch="-march=armv7-a"
+       gcc_cflags_neon="-mfpu=neon"
+       gcc_cflags_tune="-mtune=cortex-a9"
+       ;;
       armcortexa15)
        path="arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm"
        gcc_cflags_arch="-march=armv7-a"
        gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9"
        ;;
-      armcortexa5 | armcortexa8 | armv7a*)
-       path="arm/v6t2 arm/v6 arm/v5 arm"
+      armcortexa15neon)
+       path="arm/v7a/cora15/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm/neon arm"
        gcc_cflags_arch="-march=armv7-a"
+       gcc_cflags_neon="-mfpu=neon"
+       gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9"
        ;;
       *)
        path="arm"
@@ -4190,11 +4218,6 @@ echo "include_mpn(\`arm/arm-defs.m4')" >> $gmp_tmpconfigm4i
     ;;
 
 
-  clipper*-*-*)
-    path="clipper"
-    ;;
-
-
   # Fujitsu
   f30[01]-fujitsu-sysv*)
     cclist="gcc vcc"
@@ -4304,11 +4327,6 @@ echo "include_mpn(\`arm/arm-defs.m4')" >> $gmp_tmpconfigm4i
     ;;
 
 
-  i960*-*-*)
-    path="i960"
-    ;;
-
-
   ia64*-*-* | itanium-*-* | itanium2-*-*)
     abilist="64"
 
@@ -4421,12 +4439,6 @@ echo "include_mpn(\`m68k/m68k-defs.m4')" >> $gmp_tmpconfigm4i
     ;;
 
 
-  # National Semiconductor 32k
-  ns32k*-*-*)
-    path="ns32k"
-    ;;
-
-
   # IRIX 5 and earlier can only run 32-bit o32.
   #
   # IRIX 6 and up always has a 64-bit mips CPU can run n32 or 64.  n32 is
@@ -4749,11 +4761,6 @@ echo "include_mpn(\`mips32/mips-defs.m4')" >> $gmp_tmpconfigm4i
     ;;
 
 
-  pyramid-*-*)
-    path="pyr"
-    ;;
-
-
   # IBM System/390 and z/Architecture
   s390-*-* | z900esa-*-* | z990esa-*-* | z9esa-*-* | z10esa-*-* | z196esa-*-* | s390x-*-* | z900-*-* | z990-*-* | z9-*-* | z10-*-* | z196-*-*)
     abilist="32"
@@ -4893,32 +4900,49 @@ echo "include_mpn(\`sparc32/sparc-defs.m4')" >> $gmp_tmpconfigm4i
     # latter would be used in the 64-bit ABI on systems like "*bsd" where
     # abilist="64" only.
     #
-    case $host_cpu in
-      ultrasparct[345])
-        gcc_32_cflags="$gcc_cflags -Wa,-xarch=v8plusd" ;;
-      sparc64 | sparcv9* | ultrasparc*)
-        gcc_32_cflags="$gcc_cflags -Wa,-xarch=v8plus" ;;
-    esac
     gcc_32_cflags_maybe="-m32"
-    gcc_cflags_optlist="cpu"
+    gcc_cflags_optlist="cpu asm"
 
     # gcc 2.7.2 knows -mcypress, -msupersparc, -mv8, -msparclite.
     # gcc 2.95 knows -mcpu= v7, hypersparc, sparclite86x, f930, f934,
     #   sparclet, tsc701, v9, ultrasparc.  A warning is given that the
     #   plain -m forms will disappear.
-    # gcc 3.0 adds nothing.
-    # gcc 3.1 adds nothing.
-    # gcc 3.2 adds nothing.
     # gcc 3.3 adds ultrasparc3.
     #
     case $host_cpu in
-      supersparc)           gcc_cflags_cpu="-mcpu=supersparc -msupersparc" ;;
-      sparcv8 | microsparc | turbosparc)
-                           gcc_cflags_cpu="-mcpu=v8 -mv8" ;;
-      sparc64 | sparcv9*)   gcc_cflags_cpu="-mcpu=v9 -mv8" ;;
-      ultrasparc3)          gcc_cflags_cpu="-mcpu=ultrasparc3 -mcpu=ultrasparc -mv8" ;;
-      ultrasparc*)          gcc_cflags_cpu="-mcpu=ultrasparc -mv8" ;;
-      *)                    gcc_cflags_cpu="-mcpu=v7 -mcypress" ;;
+      supersparc*)
+                       gcc_cflags_cpu="-mcpu=supersparc -msupersparc"
+                       gcc_cflags_asm="-Wa,-Av8 -Wa,-xarch=v8";;
+      sparcv8 | microsparc* | turbosparc | hypersparc*)
+                       gcc_cflags_cpu="-mcpu=v8 -mv8"
+                       gcc_cflags_asm="-Wa,-Av8 -Wa,-xarch=v8";;
+      sparc64 | sparcv9*)
+                       gcc_cflags_cpu="-mcpu=v9"
+                       gcc_32_cflags_asm="-Wa,-Av8 -Wa,-xarch=v8plus"
+                       gcc_64_cflags_asm="-Wa,-Av9 -Wa,-xarch=v9";;
+      ultrasparc1 | ultrasparc2*)
+                       gcc_cflags_cpu="-mcpu=ultrasparc -mcpu=v9"
+                       gcc_32_cflags_asm="-Wa,-Av8plusa -Wa,-xarch=v8plusa"
+                       gcc_64_cflags_asm="-Wa,-Av9a -Wa,-xarch=v9a";;
+      ultrasparc[34])
+                       gcc_cflags_cpu="-mcpu=ultrasparc3 -mcpu=ultrasparc -mcpu=v9"
+                       gcc_32_cflags_asm="-Wa,-Av8plusb -Wa,-xarch=v8plusb"
+                       gcc_64_cflags_asm="-Wa,-Av9b -Wa,-xarch=v9b";;
+      ultrasparct[12])
+                       gcc_cflags_cpu="-mcpu=niagara -mcpu=v9"
+                       gcc_32_cflags_asm="-Wa,-Av8plusc -Wa,-xarch=v8plusc"
+                       gcc_64_cflags_asm="-Wa,-Av9c -Wa,-xarch=v9c";;
+      ultrasparct3)
+                       gcc_cflags_cpu="-mcpu=niagara3 -mcpu=niagara -mcpu=v9"
+                       gcc_32_cflags_asm="-Wa,-Av8plusd -Wa,-xarch=v8plusd"
+                       gcc_64_cflags_asm="-Wa,-Av9d -Wa,-xarch=v9d";;
+      ultrasparct4)
+                       gcc_cflags_cpu="-mcpu=niagara4 -mcpu=niagara3 -mcpu=niagara -mcpu=v9"
+                       gcc_32_cflags_asm="-Wa,-Av8plusd -Wa,-xarch=v8plusd"
+                       gcc_64_cflags_asm="-Wa,-Av9d -Wa,-xarch=v9d";;
+      *)
+                       gcc_cflags_cpu="-mcpu=v7 -mcypress"
+                       gcc_cflags_asm="";;
     esac
 
     # SunPRO cc and acc, and SunOS bundled cc
@@ -4934,11 +4958,14 @@ echo "include_mpn(\`sparc32/sparc-defs.m4')" >> $gmp_tmpconfigm4i
         # SunOS cc doesn't know -xarch, apparently always generating v7
         # code, so make this optional
        case $host_cpu in
-         sparcv8 | microsparc | supersparc | turbosparc)
-                                             cc_cflags_arch="-xarch=v8" ;;
-          ultrasparct[345])                 cc_cflags_arch="-xarch=v8plusd" ;;
-         sparc64 | sparcv9* | ultrasparc*)   cc_cflags_arch="-xarch=v8plus" ;;
-         *)                                  cc_cflags_arch="-xarch=v7" ;;
+         sparcv8 | microsparc* | supersparc* | turbosparc | hypersparc*)
+                       cc_cflags_arch="-xarch=v8";;
+          ultrasparct[345])
+                       cc_cflags_arch="-xarch=v8plusd" ;;
+         sparc64 | sparcv9* | ultrasparc*)
+                       cc_cflags_arch="-xarch=v8plus" ;;
+         *)
+                       cc_cflags_arch="-xarch=v7" ;;
        esac
 
         # SunOS cc doesn't know -xchip and doesn't seem to have an equivalent.
@@ -4946,17 +4973,21 @@ echo "include_mpn(\`sparc32/sparc-defs.m4')" >> $gmp_tmpconfigm4i
        #   micro2, hyper, hyper2, powerup, ultra, ultra2, ultra2i.
        # SunPRO cc 6 adds -xchip=ultra2e, ultra3cu.
         #
-       # FIXME: Which of ultra, ultra2 or ultra2i is the best fallback for
-       # ultrasparc3?
-       #
        case $host_cpu in
-         supersparc  cc_cflags_cpu="-xchip=super" ;;
-         microsparc  cc_cflags_cpu="-xchip=micro" ;;
+         supersparc*)  cc_cflags_cpu="-xchip=super" ;;
+         microsparc*)  cc_cflags_cpu="-xchip=micro" ;;
          turbosparc)   cc_cflags_cpu="-xchip=micro2" ;;
+         hypersparc*)  cc_cflags_cpu="-xchip=hyper" ;;
          ultrasparc)   cc_cflags_cpu="-xchip=ultra" ;;
-         ultrasparc2)  cc_cflags_cpu="-xchip=ultra2" ;;
-         ultrasparc2i) cc_cflags_cpu="-xchip=ultra2i" ;;
+         ultrasparc2)  cc_cflags_cpu="-xchip=ultra2 -xchip=ultra" ;;
+         ultrasparc2i) cc_cflags_cpu="-xchip=ultra2i -xchip=ultra2 -xchip=ultra" ;;
          ultrasparc3)  cc_cflags_cpu="-xchip=ultra3 -xchip=ultra" ;;
+         ultrasparc4)  cc_cflags_cpu="-xchip=ultra4 -xchip=ultra3 -xchip=ultra" ;;
+         ultrasparct1) cc_cflags_cpu="-xchip=ultraT1" ;;
+         ultrasparct2) cc_cflags_cpu="-xchip=ultraT2 -xchip=ultraT1" ;;
+         ultrasparct3) cc_cflags_cpu="-xchip=ultraT3 -xchip=ultraT2" ;;
+         ultrasparct4) cc_cflags_cpu="-xchip=T4" ;;
+         ultrasparct5) cc_cflags_cpu="-xchip=T5 -xchip=T4" ;;
          *)            cc_cflags_cpu="-xchip=generic" ;;
        esac
     esac
@@ -4993,8 +5024,10 @@ echo "include_mpn(\`sparc32/sparc-defs.m4')" >> $gmp_tmpconfigm4i
            path_64="sparc64/ultrasparc1234 sparc64" ;;
          ultrasparc[34])
            path_64="sparc64/ultrasparc34 sparc64/ultrasparc1234 sparc64" ;;
-         ultrasparct[12345])
+         ultrasparct[12])
            path_64="sparc64/ultrasparct1 sparc64" ;;
+         ultrasparct[345])
+           path_64="sparc64/ultrasparct3 sparc64" ;;
          *)
            path_64="sparc64"
        esac
@@ -5015,7 +5048,7 @@ echo "include_mpn(\`sparc32/sparc-defs.m4')" >> $gmp_tmpconfigm4i
         #
         gcc_64_cflags="$gcc_cflags -m64 -mptr64"
         gcc_64_ldflags="-Wc,-m64"
-        gcc_64_cflags_optlist="cpu"
+        gcc_64_cflags_optlist="cpu asm"
 
         case $host in
           *-*-solaris*)
@@ -5026,8 +5059,13 @@ echo "include_mpn(\`sparc32/sparc-defs.m4')" >> $gmp_tmpconfigm4i
             # -fast is documented as miscompiling things for the sake of speed.
             #
             cclist_64="$cclist_64 cc"
-            cc_64_cflags="-xO3 -xarch=v9"
             cc_64_cflags_optlist="cpu"
+            case $host_cpu in
+              ultrasparct[345])
+                cc_64_cflags="$cc_64_cflags -xO3 -xarch=v9d" ;;
+              *)
+                cc_64_cflags="-xO3 -xarch=v9" ;;
+            esac
             ;;
         esac
 
@@ -5076,7 +5114,7 @@ echo "include_mpn(\`vax/elf.m4')" >> $gmp_tmpconfigm4i
   # mode, in case -m32 has failed not because it's an old gcc, but because
   # it's a dual 32/64-bit gcc without a 32-bit libc, or whatever.
   #
-  i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-* | athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | bulldozer-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*)
+  i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-* | athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar-*-* | bulldozer-*-* | piledriver-*-* | steamroller-*-* | excavator-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*)
     abilist="32"
     cclist="gcc icc cc"
     gcc_cflags="$gcc_cflags $fomit_frame_pointer"
@@ -5144,7 +5182,7 @@ echo "include_mpn(\`vax/elf.m4')" >> $gmp_tmpconfigm4i
       pentiummmx)
        gcc_cflags_cpu="-mtune=pentium-mmx -mcpu=pentium-mmx -mcpu=pentium -m486"
        gcc_cflags_arch="-march=pentium-mmx -march=pentium"
-       path="x86/pentium/mmx x86/pentium x86"
+       path="x86/pentium/mmx x86/pentium x86/mmx x86"
        ;;
       i686 | pentiumpro)
        gcc_cflags_cpu="-mtune=pentiumpro -mcpu=pentiumpro -mcpu=i486 -m486"
@@ -5154,37 +5192,37 @@ echo "include_mpn(\`vax/elf.m4')" >> $gmp_tmpconfigm4i
       pentium2)
        gcc_cflags_cpu="-mtune=pentium2 -mcpu=pentium2 -mcpu=pentiumpro -mcpu=i486 -m486"
        gcc_cflags_arch="-march=pentium2 -march=pentiumpro -march=pentium"
-       path="x86/p6/mmx x86/p6 x86"
+       path="x86/p6/mmx x86/p6 x86/mmx x86"
        ;;
       pentium3)
        gcc_cflags_cpu="-mtune=pentium3 -mcpu=pentium3 -mcpu=pentiumpro -mcpu=i486 -m486"
        gcc_cflags_arch="-march=pentium3 -march=pentiumpro -march=pentium"
-       path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
+       path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
        ;;
       pentiumm)
        gcc_cflags_cpu="-mtune=pentium3 -mcpu=pentium3 -mcpu=pentiumpro -mcpu=i486 -m486"
        gcc_cflags_arch="-march=pentium3 -march=pentiumpro -march=pentium"
-       path="x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
+       path="x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
        ;;
       k6)
        gcc_cflags_cpu="-mtune=k6 -mcpu=k6 -mcpu=i486 -m486"
        gcc_cflags_arch="-march=k6"
-       path="x86/k6/mmx x86/k6 x86"
+       path="x86/k6/mmx x86/k6 x86/mmx x86"
        ;;
       k62)
        gcc_cflags_cpu="-mtune=k6-2 -mcpu=k6-2 -mcpu=k6 -mcpu=i486 -m486"
        gcc_cflags_arch="-march=k6-2 -march=k6"
-       path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86"
+       path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86/mmx x86"
        ;;
       k63)
        gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486"
        gcc_cflags_arch="-march=k6-3 -march=k6"
-       path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86"
+       path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86/mmx x86"
        ;;
       geode)
        gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486"
        gcc_cflags_arch="-march=k6-3 -march=k6"
-       path="x86/geode x86/k6/k62mmx x86/k6/mmx x86/k6 x86"
+       path="x86/geode x86/k6/k62mmx x86/k6/mmx x86/k6 x86/mmx x86"
        ;;
       athlon)
        # Athlon instruction costs are close to P6 (3 cycle load latency,
@@ -5192,7 +5230,7 @@ echo "include_mpn(\`vax/elf.m4')" >> $gmp_tmpconfigm4i
        # know athlon (eg. 2.95.2 doesn't) then fall back on pentiumpro.
        gcc_cflags_cpu="-mtune=athlon -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486"
        gcc_cflags_arch="-march=athlon -march=pentiumpro -march=pentium"
-       path="x86/k7/mmx x86/k7 x86"
+       path="x86/k7/mmx x86/k7 x86/mmx x86"
        ;;
       i786 | pentium4)
        # pentiumpro is the primary fallback when gcc doesn't know pentium4.
@@ -5202,7 +5240,7 @@ echo "include_mpn(\`vax/elf.m4')" >> $gmp_tmpconfigm4i
        gcc_cflags_cpu="-mtune=pentium4 -mcpu=pentium4 -mcpu=pentiumpro -mcpu=i486 -m486"
        gcc_cflags_arch="-march=pentium4 -march=pentium4~-mno-sse2 -march=pentiumpro -march=pentium"
        gcc_64_cflags_cpu="-mtune=nocona"
-       path="x86/pentium4/sse2 x86/pentium4/mmx x86/pentium4 x86"
+       path="x86/pentium4/sse2 x86/pentium4/mmx x86/pentium4 x86/mmx x86"
        path_64="x86_64/pentium4 x86_64"
        ;;
       viac32)
@@ -5210,66 +5248,103 @@ echo "include_mpn(\`vax/elf.m4')" >> $gmp_tmpconfigm4i
        # c3-2 has sse and mmx, so pentium3 is good for -march.
        gcc_cflags_cpu="-mtune=c3-2 -mcpu=c3-2 -mcpu=i486 -m486"
        gcc_cflags_arch="-march=c3-2 -march=pentium3 -march=pentiumpro -march=pentium"
-       path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
+       path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
        ;;
       viac3*)
        # Not sure of the best fallbacks here.
        gcc_cflags_cpu="-mtune=c3 -mcpu=c3 -mcpu=i486 -m486"
        gcc_cflags_arch="-march=c3 -march=pentium-mmx -march=pentium"
-       path="x86/pentium/mmx x86/pentium x86"
+       path="x86/pentium/mmx x86/pentium x86/mmx x86"
        ;;
       athlon64 | k8 | x86_64)
        gcc_cflags_cpu="-mtune=k8 -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486"
        gcc_cflags_arch="-march=k8 -march=k8~-mno-sse2 -march=athlon -march=pentiumpro -march=pentium"
-       path="x86/k8 x86/k7/mmx x86/k7 x86"
+       path="x86/k8 x86/k7/mmx x86/k7 x86/mmx x86"
        path_64="x86_64/k8 x86_64"
        ;;
       k10)
        gcc_cflags_cpu="-mtune=amdfam10 -mtune=k8"
        gcc_cflags_arch="-march=amdfam10 -march=k8 -march=k8~-mno-sse2"
-       path="x86/k10 x86/k8 x86/k7/mmx x86/k7 x86"
+       path="x86/k10 x86/k8 x86/k7/mmx x86/k7 x86/mmx x86"
        path_64="x86_64/k10 x86_64/k8 x86_64"
        ;;
       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"
+       path="x86/bobcat x86/k7/mmx x86/k7 x86/mmx x86"
        path_64="x86_64/bobcat x86_64/k10 x86_64/k8 x86_64"
        ;;
+      jaguar)
+       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"
+       ;;
       bulldozer | bd1)
        gcc_cflags_cpu="-mtune=bdver1 -mtune=amdfam10 -mtune=k8"
        gcc_cflags_arch="-march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
-       path="x86/bd1 x86/k7/mmx x86/k7 x86"
+       path="x86/bd1 x86/k7/mmx x86/k7 x86/mmx x86"
        path_64="x86_64/bd1 x86_64/k10 x86_64/k8 x86_64"
        ;;
+      piledriver | bd2)
+       gcc_cflags_cpu="-mtune=bdver2 -mtune=bdver1 -mtune=amdfam10 -mtune=k8"
+       gcc_cflags_arch="-march=bdver2 -march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
+       path="x86/bd2 x86/bd1 x86/k7/mmx x86/k7 x86/mmx x86"
+       path_64="x86_64/bd2 x86_64/bd1 x86_64/k10 x86_64/k8 x86_64"
+       ;;
+      steamroller | bd3)
+       gcc_cflags_cpu="-mtune=bdver3 -mtune=bdver2 -mtune=bdver1 -mtune=amdfam10 -mtune=k8"
+       gcc_cflags_arch="-march=bdver3 -march=bdver2 -march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
+       path="x86/bd3 x86/bd2 x86/bd1 x86/k7/mmx x86/k7 x86/mmx x86"
+       path_64="x86_64/bd3 x86_64/bd2 x86_64/bd1 x86_64/k10 x86_64/k8 x86_64"
+       ;;
+      excavator | bd4)
+       gcc_cflags_cpu="-mtune=bdver4 -mtune=bdver3 -mtune=bdver2 -mtune=bdver1 -mtune=amdfam10 -mtune=k8"
+       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"
+       ;;
       core2)
        gcc_cflags_cpu="-mtune=core2 -mtune=k8"
        gcc_cflags_arch="-march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
-       path="x86/core2 x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
+       path="x86/core2 x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
        path_64="x86_64/core2 x86_64"
        ;;
       corei | coreinhm | coreiwsm)
        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"
-       path="x86/coreinhm x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
+       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"
        ;;
-      coreisbr | coreihwl | coreibwl)
+      coreisbr)
        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"
-       path="x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
+       path="x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
        path_64="x86_64/coreisbr x86_64/coreinhm x86_64/core2 x86_64"
        ;;
+      coreihwl)
+       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"
+       path="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"
+       ;;
+      coreibwl)
+       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"
+       path="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"
+       # extra_functions_64="missing"   # enable for bmi2/adx simulation
+       ;;
       atom)
        gcc_cflags_cpu="-mtune=atom -mtune=pentium3"
        gcc_cflags_arch="-march=atom -march=pentium3"
-       path="x86/atom/sse2 x86/atom/mmx x86/atom x86"
+       path="x86/atom/sse2 x86/atom/mmx x86/atom x86/mmx x86"
        path_64="x86_64/atom x86_64"
        ;;
       nano)
        gcc_cflags_cpu="-mtune=nano"
        gcc_cflags_arch="-march=nano"
-       path="x86/nano x86"
+       path="x86/nano x86/mmx x86"
        path_64="x86_64/nano x86_64"
        ;;
       *)
@@ -5281,15 +5356,15 @@ echo "include_mpn(\`vax/elf.m4')" >> $gmp_tmpconfigm4i
     esac
 
     case $host in
-      athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | bulldozer-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*)
-       cclist_64="gcc"
+      athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar-*-* | bulldozer-*-* | piledriver-*-* | steamroller-*-* | excavator-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*)
+       cclist_64="gcc cc"
        gcc_64_cflags="$gcc_cflags -m64"
        gcc_64_cflags_optlist="cpu arch"
        CALLING_CONVENTIONS_OBJS_64='amd64call.lo amd64check$U.lo'
        SPEED_CYCLECOUNTER_OBJ_64=x86_64.lo
        cyclecounter_size_64=2
 
-       cclist_x32="gcc"
+       cclist_x32="gcc cc"
        gcc_x32_cflags="$gcc_cflags -mx32"
        gcc_x32_cflags_optlist="$gcc_64_cflags_optlist"
        CALLING_CONVENTIONS_OBJS_x32="$CALLING_CONVENTIONS_OBJS_64"
@@ -5301,14 +5376,13 @@ echo "include_mpn(\`vax/elf.m4')" >> $gmp_tmpconfigm4i
 
        abilist="64 x32 32"
        if test "$enable_assembly" = "yes" ; then
-           extra_functions_64="invert_limb_table"
+           extra_functions_64="$extra_functions_64 invert_limb_table"
            extra_functions_x32=$extra_functions_64
        fi
 
        case $host in
          *-*-solaris*)
            # Sun cc.
-           cclist_64="$cclist_64 cc"
            cc_64_cflags="-xO3 -m64"
            ;;
          *-*-mingw* | *-*-cygwin)
@@ -5325,18 +5399,6 @@ $as_echo "#define HOST_DOS64 1" >>confdefs.h
     ;;
 
 
-  # FIXME: z8kx won't get through config.sub.  Could make 16 versus 32 bit
-  # limb an ABI option perhaps.
-  z8kx*-*-*)
-    path="z8000x"
-    extra_functions="udiv_w_sdiv"
-    ;;
-  z8k*-*-*)
-    path="z8000"
-    extra_functions="udiv_w_sdiv"
-    ;;
-
-
   # Special CPU "none" used to select generic C, now this is obsolete.
   none-*-*)
     enable_assembly=no
@@ -6380,7 +6442,7 @@ if test "$gmp_prog_cc_works" = yes; then
   rm -f conftest* a.out b.out a.exe a_out.exe
   cat >conftest.c <<EOF
 /* The following is mis-compiled by Intel ia-64 icc version 1.8 under
-    "icc -O3",  After several calls, the function writes parial garbage to
+    "icc -O3",  After several calls, the function writes partial garbage to
     the result vector.  Perhaps relates to the chk.a.nc insn.  This code needs
     to be run to show the problem, but that's fine, the offending cc is a
     native-only compiler so we don't have to worry about cross compiling.  */
@@ -6842,13 +6904,14 @@ if test $found_compiler = no && test -n "$path"; then
 fi
 
 case $host in
-  i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-* | athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | bulldozer-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*)
+  i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-* | athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar-*-* | bulldozer-*-* | piledriver-*-* | steamroller-*-* | excavator-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*)
     # If the user asked for a fat build, override the path and flags set above
     if test $enable_fat = yes; then
       gcc_cflags_cpu=""
       gcc_cflags_arch=""
 
-      fat_functions="add_n addmul_1 bdiv_dbm1c com copyd copyi dive_1 divrem_1
+      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
                     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
@@ -6875,7 +6938,7 @@ case $host in
        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/atom x86_64/nano"
+                 x86_64/coreihwl x86_64/atom x86_64/nano"
        fat_functions="$fat_functions addmul_2 addlsh1_n addlsh2_n sublsh1_n"
       fi
 
@@ -7932,7 +7995,7 @@ if test "$gmp_prog_cc_works" = yes; then
   rm -f conftest* a.out b.out a.exe a_out.exe
   cat >conftest.c <<EOF
 /* The following is mis-compiled by Intel ia-64 icc version 1.8 under
-    "icc -O3",  After several calls, the function writes parial garbage to
+    "icc -O3",  After several calls, the function writes partial garbage to
     the result vector.  Perhaps relates to the chk.a.nc insn.  This code needs
     to be run to show the problem, but that's fine, the offending cc is a
     native-only compiler so we don't have to worry about cross compiling.  */
@@ -10527,7 +10590,7 @@ done
 # enough assembler.
 #
 case $host in
-  i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-* | athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | bulldozer-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*)
+  i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-* | athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar-*-* | bulldozer-*-* | piledriver-*-* | steamroller-*-* | excavator-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*)
     if test "$ABI" = 32; then
       case "$path $fat_path" in
         *mmx*)   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the assembler knows about MMX instructions" >&5
@@ -10706,6 +10769,155 @@ esac
  ;;
       esac
     fi
+    case "$path $fat_path" in
+      *mulx*)  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the assembler knows about the mulx instruction" >&5
+$as_echo_n "checking if the assembler knows about the mulx instruction... " >&6; }
+if ${gmp_cv_asm_x86_mulx+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.s <<EOF
+       .text
+       mulx    %r8, %r9, %r10
+EOF
+gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
+if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+  (eval $gmp_assemble) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  cat conftest.out >&5
+  gmp_cv_asm_x86_mulx=yes
+else
+  cat conftest.out >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.s >&5
+  gmp_cv_asm_x86_mulx=no
+fi
+rm -f conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_x86_mulx" >&5
+$as_echo "$gmp_cv_asm_x86_mulx" >&6; }
+case $gmp_cv_asm_x86_mulx in
+yes)
+  :
+  ;;
+*)
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: +----------------------------------------------------------" >&5
+$as_echo "$as_me: WARNING: +----------------------------------------------------------" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | WARNING WARNING WARNING" >&5
+$as_echo "$as_me: WARNING: | WARNING WARNING WARNING" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | Host CPU has the mulx instruction, but it can't be" >&5
+$as_echo "$as_me: WARNING: | Host CPU has the mulx instruction, but it can't be" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | assembled by" >&5
+$as_echo "$as_me: WARNING: | assembled by" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: |     $CCAS $CFLAGS $CPPFLAGS" >&5
+$as_echo "$as_me: WARNING: |     $CCAS $CFLAGS $CPPFLAGS" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | Older x86 instructions will be used." >&5
+$as_echo "$as_me: WARNING: | Older x86 instructions will be used." >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | This will be an inferior build." >&5
+$as_echo "$as_me: WARNING: | This will be an inferior build." >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: +----------------------------------------------------------" >&5
+$as_echo "$as_me: WARNING: +----------------------------------------------------------" >&2;}
+  tmp_path=
+for i in $path; do
+  case $i in
+    */mulx) ;;
+    *) tmp_path="$tmp_path $i" ;;
+  esac
+done
+path="$tmp_path"
+
+tmp_path=
+for i in $fat_path; do
+  case $i in
+    */mulx) ;;
+    *) tmp_path="$tmp_path $i" ;;
+  esac
+done
+fat_path="$tmp_path"
+
+
+  ;;
+esac
+ ;;
+    esac
+    case "$path $fat_path" in
+      *adx*)   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the assembler knows about the adox instruction" >&5
+$as_echo_n "checking if the assembler knows about the adox instruction... " >&6; }
+if ${gmp_cv_asm_x86_adx+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.s <<EOF
+       .text
+       adox    %r8, %r9
+       adcx    %r8, %r9
+EOF
+gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
+if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+  (eval $gmp_assemble) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  cat conftest.out >&5
+  gmp_cv_asm_x86_adx=yes
+else
+  cat conftest.out >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.s >&5
+  gmp_cv_asm_x86_adx=no
+fi
+rm -f conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_x86_adx" >&5
+$as_echo "$gmp_cv_asm_x86_adx" >&6; }
+case $gmp_cv_asm_x86_adx in
+yes)
+  :
+  ;;
+*)
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: +----------------------------------------------------------" >&5
+$as_echo "$as_me: WARNING: +----------------------------------------------------------" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | WARNING WARNING WARNING" >&5
+$as_echo "$as_me: WARNING: | WARNING WARNING WARNING" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | Host CPU has the adcx and adox instructions, but they" >&5
+$as_echo "$as_me: WARNING: | Host CPU has the adcx and adox instructions, but they" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | can't be assembled by" >&5
+$as_echo "$as_me: WARNING: | can't be assembled by" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: |     $CCAS $CFLAGS $CPPFLAGS" >&5
+$as_echo "$as_me: WARNING: |     $CCAS $CFLAGS $CPPFLAGS" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | Older x86 instructions will be used." >&5
+$as_echo "$as_me: WARNING: | Older x86 instructions will be used." >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | This will be an inferior build." >&5
+$as_echo "$as_me: WARNING: | This will be an inferior build." >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: +----------------------------------------------------------" >&5
+$as_echo "$as_me: WARNING: +----------------------------------------------------------" >&2;}
+  tmp_path=
+for i in $path; do
+  case $i in
+    */adx) ;;
+    *) tmp_path="$tmp_path $i" ;;
+  esac
+done
+path="$tmp_path"
+
+tmp_path=
+for i in $fat_path; do
+  case $i in
+    */adx) ;;
+    *) tmp_path="$tmp_path $i" ;;
+  esac
+done
+fat_path="$tmp_path"
+
+
+  ;;
+esac
+ ;;
+    esac
     ;;
 esac
 
@@ -11734,7 +11946,7 @@ fi
 # FIXME: Rumour has it libtool will one day provide a way for a configure.in
 # to say what it wants from among supported languages etc.
 #
-
+#AC_PROVIDE([AC_PROG_F77])
 
 case `pwd` in
   *\ * | *\    *)
@@ -14777,7 +14989,6 @@ func_stripname_cnf ()
 
 
 
-
 # Set options
 
 
@@ -21944,2736 +22155,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-      ac_ext=f
-ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
-ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_f77_compiler_gnu
-
-if test -z "$F77" || test "X$F77" = "Xno"; then
-  _lt_disable_F77=yes
-fi
-
-archive_cmds_need_lc_F77=no
-allow_undefined_flag_F77=
-always_export_symbols_F77=no
-archive_expsym_cmds_F77=
-export_dynamic_flag_spec_F77=
-hardcode_direct_F77=no
-hardcode_direct_absolute_F77=no
-hardcode_libdir_flag_spec_F77=
-hardcode_libdir_separator_F77=
-hardcode_minus_L_F77=no
-hardcode_automatic_F77=no
-inherit_rpath_F77=no
-module_cmds_F77=
-module_expsym_cmds_F77=
-link_all_deplibs_F77=unknown
-old_archive_cmds_F77=$old_archive_cmds
-reload_flag_F77=$reload_flag
-reload_cmds_F77=$reload_cmds
-no_undefined_flag_F77=
-whole_archive_flag_spec_F77=
-enable_shared_with_static_runtimes_F77=no
-
-# Source file extension for f77 test sources.
-ac_ext=f
-
-# Object file extension for compiled f77 test sources.
-objext=o
-objext_F77=$objext
 
-# No sense in running all these tests if we already determined that
-# the F77 compiler isn't working.  Some variables (like enable_shared)
-# are currently assumed to apply to all compilers on this platform,
-# and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_disable_F77" != yes; then
-  # Code to be used in simple compile tests
-  lt_simple_compile_test_code="\
-      subroutine t
-      return
-      end
-"
 
-  # Code to be used in simple link tests
-  lt_simple_link_test_code="\
-      program t
-      end
-"
 
-  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 
 
 
 
 
 
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
 
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
 
-# Allow CC to be a program name with arguments.
-compiler=$CC
 
-
-  # save warnings/boilerplate of simple test code
-  ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$RM conftest*
-
-  ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$RM -r conftest*
-
-
-  # Allow CC to be a program name with arguments.
-  lt_save_CC="$CC"
-  lt_save_GCC=$GCC
-  lt_save_CFLAGS=$CFLAGS
-  CC=${F77-"f77"}
-  CFLAGS=$FFLAGS
-  compiler=$CC
-  compiler_F77=$CC
-  for cc_temp in $compiler""; do
-  case $cc_temp in
-    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
-
-  GCC=$G77
-  if test -n "$compiler"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
-$as_echo_n "checking if libtool supports shared libraries... " >&6; }
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
-$as_echo "$can_build_shared" >&6; }
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
-$as_echo_n "checking whether to build shared libraries... " >&6; }
-    test "$can_build_shared" = "no" && enable_shared=no
-
-    # On AIX, shared libraries and static libraries use the same namespace, and
-    # are all built from PIC.
-    case $host_os in
-      aix3*)
-        test "$enable_shared" = yes && enable_static=no
-        if test -n "$RANLIB"; then
-          archive_cmds="$archive_cmds~\$RANLIB \$lib"
-          postinstall_cmds='$RANLIB $lib'
-        fi
-        ;;
-      aix[4-9]*)
-       if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-         test "$enable_shared" = yes && enable_static=no
-       fi
-        ;;
-    esac
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
-$as_echo "$enable_shared" >&6; }
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
-$as_echo_n "checking whether to build static libraries... " >&6; }
-    # Make sure either enable_shared or enable_static is yes.
-    test "$enable_shared" = yes || enable_static=yes
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
-$as_echo "$enable_static" >&6; }
-
-    GCC_F77="$G77"
-    LD_F77="$LD"
-
-    ## CAVEAT EMPTOR:
-    ## There is no encapsulation within the following macros, do not change
-    ## the running order or otherwise move them around unless you know exactly
-    ## what you are doing...
-    lt_prog_compiler_wl_F77=
-lt_prog_compiler_pic_F77=
-lt_prog_compiler_static_F77=
-
-
-  if test "$GCC" = yes; then
-    lt_prog_compiler_wl_F77='-Wl,'
-    lt_prog_compiler_static_F77='-static'
-
-    case $host_os in
-      aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-       # AIX 5 now supports IA64 processor
-       lt_prog_compiler_static_F77='-Bstatic'
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            lt_prog_compiler_pic_F77='-fPIC'
-        ;;
-      m68k)
-            # FIXME: we need at least 68020 code to build shared libraries, but
-            # adding the `-m68020' flag to GCC prevents building anything better,
-            # like `-m68040'.
-            lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4'
-        ;;
-      esac
-      ;;
-
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
-      ;;
-
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      lt_prog_compiler_pic_F77='-fno-common'
-      ;;
-
-    haiku*)
-      # PIC is the default for Haiku.
-      # The "-static" flag exists, but is broken.
-      lt_prog_compiler_static_F77=
-      ;;
-
-    hpux*)
-      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
-      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
-      # sets the default TLS model and affects inlining.
-      case $host_cpu in
-      hppa*64*)
-       # +Z the default
-       ;;
-      *)
-       lt_prog_compiler_pic_F77='-fPIC'
-       ;;
-      esac
-      ;;
-
-    interix[3-9]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
-
-    msdosdjgpp*)
-      # Just because we use GCC doesn't mean we suddenly get shared libraries
-      # on systems that don't support them.
-      lt_prog_compiler_can_build_shared_F77=no
-      enable_shared=no
-      ;;
-
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      lt_prog_compiler_pic_F77='-fPIC -shared'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec; then
-       lt_prog_compiler_pic_F77=-Kconform_pic
-      fi
-      ;;
-
-    *)
-      lt_prog_compiler_pic_F77='-fPIC'
-      ;;
-    esac
-
-    case $cc_basename in
-    nvcc*) # Cuda Compiler Driver 2.2
-      lt_prog_compiler_wl_F77='-Xlinker '
-      if test -n "$lt_prog_compiler_pic_F77"; then
-        lt_prog_compiler_pic_F77="-Xcompiler $lt_prog_compiler_pic_F77"
-      fi
-      ;;
-    esac
-  else
-    # PORTME Check for flag to pass linker flags through the system compiler.
-    case $host_os in
-    aix*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      if test "$host_cpu" = ia64; then
-       # AIX 5 now supports IA64 processor
-       lt_prog_compiler_static_F77='-Bstatic'
-      else
-       lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp'
-      fi
-      ;;
-
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
-      ;;
-
-    hpux9* | hpux10* | hpux11*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-       # +Z the default
-       ;;
-      *)
-       lt_prog_compiler_pic_F77='+Z'
-       ;;
-      esac
-      # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      lt_prog_compiler_static_F77='${wl}-a ${wl}archive'
-      ;;
-
-    irix5* | irix6* | nonstopux*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      # PIC (with -KPIC) is the default.
-      lt_prog_compiler_static_F77='-non_shared'
-      ;;
-
-    linux* | k*bsd*-gnu | kopensolaris*-gnu)
-      case $cc_basename in
-      # old Intel for x86_64 which still supported -KPIC.
-      ecc*)
-       lt_prog_compiler_wl_F77='-Wl,'
-       lt_prog_compiler_pic_F77='-KPIC'
-       lt_prog_compiler_static_F77='-static'
-        ;;
-      # icc used to be incompatible with GCC.
-      # ICC 10 doesn't accept -KPIC any more.
-      icc* | ifort*)
-       lt_prog_compiler_wl_F77='-Wl,'
-       lt_prog_compiler_pic_F77='-fPIC'
-       lt_prog_compiler_static_F77='-static'
-        ;;
-      # Lahey Fortran 8.1.
-      lf95*)
-       lt_prog_compiler_wl_F77='-Wl,'
-       lt_prog_compiler_pic_F77='--shared'
-       lt_prog_compiler_static_F77='--static'
-       ;;
-      nagfor*)
-       # NAG Fortran compiler
-       lt_prog_compiler_wl_F77='-Wl,-Wl,,'
-       lt_prog_compiler_pic_F77='-PIC'
-       lt_prog_compiler_static_F77='-Bstatic'
-       ;;
-      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
-        # Portland Group compilers (*not* the Pentium gcc compiler,
-       # which looks to be a dead project)
-       lt_prog_compiler_wl_F77='-Wl,'
-       lt_prog_compiler_pic_F77='-fpic'
-       lt_prog_compiler_static_F77='-Bstatic'
-        ;;
-      ccc*)
-        lt_prog_compiler_wl_F77='-Wl,'
-        # All Alpha code is PIC.
-        lt_prog_compiler_static_F77='-non_shared'
-        ;;
-      xl* | bgxl* | bgf* | mpixl*)
-       # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
-       lt_prog_compiler_wl_F77='-Wl,'
-       lt_prog_compiler_pic_F77='-qpic'
-       lt_prog_compiler_static_F77='-qstaticlink'
-       ;;
-      *)
-       case `$CC -V 2>&1 | sed 5q` in
-       *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
-         # Sun Fortran 8.3 passes all unrecognized flags to the linker
-         lt_prog_compiler_pic_F77='-KPIC'
-         lt_prog_compiler_static_F77='-Bstatic'
-         lt_prog_compiler_wl_F77=''
-         ;;
-       *Sun\ F* | *Sun*Fortran*)
-         lt_prog_compiler_pic_F77='-KPIC'
-         lt_prog_compiler_static_F77='-Bstatic'
-         lt_prog_compiler_wl_F77='-Qoption ld '
-         ;;
-       *Sun\ C*)
-         # Sun C 5.9
-         lt_prog_compiler_pic_F77='-KPIC'
-         lt_prog_compiler_static_F77='-Bstatic'
-         lt_prog_compiler_wl_F77='-Wl,'
-         ;;
-        *Intel*\ [CF]*Compiler*)
-         lt_prog_compiler_wl_F77='-Wl,'
-         lt_prog_compiler_pic_F77='-fPIC'
-         lt_prog_compiler_static_F77='-static'
-         ;;
-       *Portland\ Group*)
-         lt_prog_compiler_wl_F77='-Wl,'
-         lt_prog_compiler_pic_F77='-fpic'
-         lt_prog_compiler_static_F77='-Bstatic'
-         ;;
-       esac
-       ;;
-      esac
-      ;;
-
-    newsos6)
-      lt_prog_compiler_pic_F77='-KPIC'
-      lt_prog_compiler_static_F77='-Bstatic'
-      ;;
-
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      lt_prog_compiler_pic_F77='-fPIC -shared'
-      ;;
-
-    osf3* | osf4* | osf5*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      # All OSF/1 code is PIC.
-      lt_prog_compiler_static_F77='-non_shared'
-      ;;
-
-    rdos*)
-      lt_prog_compiler_static_F77='-non_shared'
-      ;;
-
-    solaris*)
-      lt_prog_compiler_pic_F77='-KPIC'
-      lt_prog_compiler_static_F77='-Bstatic'
-      case $cc_basename in
-      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
-       lt_prog_compiler_wl_F77='-Qoption ld ';;
-      *)
-       lt_prog_compiler_wl_F77='-Wl,';;
-      esac
-      ;;
-
-    sunos4*)
-      lt_prog_compiler_wl_F77='-Qoption ld '
-      lt_prog_compiler_pic_F77='-PIC'
-      lt_prog_compiler_static_F77='-Bstatic'
-      ;;
-
-    sysv4 | sysv4.2uw2* | sysv4.3*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      lt_prog_compiler_pic_F77='-KPIC'
-      lt_prog_compiler_static_F77='-Bstatic'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec ;then
-       lt_prog_compiler_pic_F77='-Kconform_pic'
-       lt_prog_compiler_static_F77='-Bstatic'
-      fi
-      ;;
-
-    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      lt_prog_compiler_pic_F77='-KPIC'
-      lt_prog_compiler_static_F77='-Bstatic'
-      ;;
-
-    unicos*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      lt_prog_compiler_can_build_shared_F77=no
-      ;;
-
-    uts4*)
-      lt_prog_compiler_pic_F77='-pic'
-      lt_prog_compiler_static_F77='-Bstatic'
-      ;;
-
-    *)
-      lt_prog_compiler_can_build_shared_F77=no
-      ;;
-    esac
-  fi
-
-case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
-  *djgpp*)
-    lt_prog_compiler_pic_F77=
-    ;;
-  *)
-    lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77"
-    ;;
-esac
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
-if ${lt_cv_prog_compiler_pic_F77+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_pic_F77=$lt_prog_compiler_pic_F77
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_F77" >&5
-$as_echo "$lt_cv_prog_compiler_pic_F77" >&6; }
-lt_prog_compiler_pic_F77=$lt_cv_prog_compiler_pic_F77
-
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$lt_prog_compiler_pic_F77"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
-$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... " >&6; }
-if ${lt_cv_prog_compiler_pic_works_F77+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_pic_works_F77=no
-   ac_outfile=conftest.$ac_objext
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$lt_prog_compiler_pic_F77"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_pic_works_F77=yes
-     fi
-   fi
-   $RM conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_F77" >&5
-$as_echo "$lt_cv_prog_compiler_pic_works_F77" >&6; }
-
-if test x"$lt_cv_prog_compiler_pic_works_F77" = xyes; then
-    case $lt_prog_compiler_pic_F77 in
-     "" | " "*) ;;
-     *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;;
-     esac
-else
-    lt_prog_compiler_pic_F77=
-     lt_prog_compiler_can_build_shared_F77=no
-fi
-
-fi
-
-
-
-
-
-#
-# Check to make sure the static flag actually works.
-#
-wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
-if ${lt_cv_prog_compiler_static_works_F77+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_static_works_F77=no
-   save_LDFLAGS="$LDFLAGS"
-   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
-   echo "$lt_simple_link_test_code" > conftest.$ac_ext
-   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The linker can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test -s conftest.err; then
-       # Append any errors to the config.log.
-       cat conftest.err 1>&5
-       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_cv_prog_compiler_static_works_F77=yes
-       fi
-     else
-       lt_cv_prog_compiler_static_works_F77=yes
-     fi
-   fi
-   $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_F77" >&5
-$as_echo "$lt_cv_prog_compiler_static_works_F77" >&6; }
-
-if test x"$lt_cv_prog_compiler_static_works_F77" = xyes; then
-    :
-else
-    lt_prog_compiler_static_F77=
-fi
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
-$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if ${lt_cv_prog_compiler_c_o_F77+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_c_o_F77=no
-   $RM -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_c_o_F77=yes
-     fi
-   fi
-   chmod u+w . 2>&5
-   $RM conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
-   $RM out/* && rmdir out
-   cd ..
-   $RM -r conftest
-   $RM conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_F77" >&5
-$as_echo "$lt_cv_prog_compiler_c_o_F77" >&6; }
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
-$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if ${lt_cv_prog_compiler_c_o_F77+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_c_o_F77=no
-   $RM -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_c_o_F77=yes
-     fi
-   fi
-   chmod u+w . 2>&5
-   $RM conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
-   $RM out/* && rmdir out
-   cd ..
-   $RM -r conftest
-   $RM conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_F77" >&5
-$as_echo "$lt_cv_prog_compiler_c_o_F77" >&6; }
-
-
-
-
-hard_links="nottested"
-if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then
-  # do not overwrite the value of need_locks provided by the user
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
-$as_echo_n "checking if we can lock with hard links... " >&6; }
-  hard_links=yes
-  $RM conftest*
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  touch conftest.a
-  ln conftest.a conftest.b 2>&5 || hard_links=no
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
-$as_echo "$hard_links" >&6; }
-  if test "$hard_links" = no; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
-    need_locks=warn
-  fi
-else
-  need_locks=no
-fi
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
-
-  runpath_var=
-  allow_undefined_flag_F77=
-  always_export_symbols_F77=no
-  archive_cmds_F77=
-  archive_expsym_cmds_F77=
-  compiler_needs_object_F77=no
-  enable_shared_with_static_runtimes_F77=no
-  export_dynamic_flag_spec_F77=
-  export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  hardcode_automatic_F77=no
-  hardcode_direct_F77=no
-  hardcode_direct_absolute_F77=no
-  hardcode_libdir_flag_spec_F77=
-  hardcode_libdir_separator_F77=
-  hardcode_minus_L_F77=no
-  hardcode_shlibpath_var_F77=unsupported
-  inherit_rpath_F77=no
-  link_all_deplibs_F77=unknown
-  module_cmds_F77=
-  module_expsym_cmds_F77=
-  old_archive_from_new_cmds_F77=
-  old_archive_from_expsyms_cmds_F77=
-  thread_safe_flag_spec_F77=
-  whole_archive_flag_spec_F77=
-  # include_expsyms should be a list of space-separated symbols to be *always*
-  # included in the symbol list
-  include_expsyms_F77=
-  # exclude_expsyms can be an extended regexp of symbols to exclude
-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-  # as well as any symbol that contains `d'.
-  exclude_expsyms_F77='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
-  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
-  # platforms (ab)use it in PIC code, but their linkers get confused if
-  # the symbol is explicitly referenced.  Since portable code cannot
-  # rely on this symbol name, it's probably fine to never include it in
-  # preloaded symbol tables.
-  # Exclude shared library initialization/finalization symbols.
-  extract_expsyms_cmds=
-
-  case $host_os in
-  cygwin* | mingw* | pw32* | cegcc*)
-    # FIXME: the MSVC++ port hasn't been tested in a loooong time
-    # When not using gcc, we currently assume that we are using
-    # Microsoft Visual C++.
-    if test "$GCC" != yes; then
-      with_gnu_ld=no
-    fi
-    ;;
-  interix*)
-    # we just hope/assume this is gcc and not c89 (= MSVC++)
-    with_gnu_ld=yes
-    ;;
-  openbsd*)
-    with_gnu_ld=no
-    ;;
-  esac
-
-  ld_shlibs_F77=yes
-
-  # On some targets, GNU ld is compatible enough with the native linker
-  # that we're better off using the native interface for both.
-  lt_use_gnu_ld_interface=no
-  if test "$with_gnu_ld" = yes; then
-    case $host_os in
-      aix*)
-       # The AIX port of GNU ld has always aspired to compatibility
-       # with the native linker.  However, as the warning in the GNU ld
-       # block says, versions before 2.19.5* couldn't really create working
-       # shared libraries, regardless of the interface used.
-       case `$LD -v 2>&1` in
-         *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
-         *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
-         *\ \(GNU\ Binutils\)\ [3-9]*) ;;
-         *)
-           lt_use_gnu_ld_interface=yes
-           ;;
-       esac
-       ;;
-      *)
-       lt_use_gnu_ld_interface=yes
-       ;;
-    esac
-  fi
-
-  if test "$lt_use_gnu_ld_interface" = yes; then
-    # If archive_cmds runs LD, not CC, wlarc should be empty
-    wlarc='${wl}'
-
-    # Set some defaults for GNU ld with shared library support. These
-    # are reset later if shared libraries are not supported. Putting them
-    # here allows them to be overridden if necessary.
-    runpath_var=LD_RUN_PATH
-    hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
-    export_dynamic_flag_spec_F77='${wl}--export-dynamic'
-    # ancient GNU ld didn't support --whole-archive et. al.
-    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
-      whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-    else
-      whole_archive_flag_spec_F77=
-    fi
-    supports_anon_versioning=no
-    case `$LD -v 2>&1` in
-      *GNU\ gold*) supports_anon_versioning=yes ;;
-      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
-      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
-      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
-      *\ 2.11.*) ;; # other 2.11 versions
-      *) supports_anon_versioning=yes ;;
-    esac
-
-    # See if GNU ld supports shared libraries.
-    case $host_os in
-    aix[3-9]*)
-      # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
-       ld_shlibs_F77=no
-       cat <<_LT_EOF 1>&2
-
-*** Warning: the GNU linker, at least up to release 2.19, is reported
-*** to be unable to reliably create shared libraries on AIX.
-*** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to install binutils
-*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
-*** You will then need to restart the configuration process.
-
-_LT_EOF
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            archive_expsym_cmds_F77=''
-        ;;
-      m68k)
-            archive_cmds_F77='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-            hardcode_libdir_flag_spec_F77='-L$libdir'
-            hardcode_minus_L_F77=yes
-        ;;
-      esac
-      ;;
-
-    beos*)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-       allow_undefined_flag_F77=unsupported
-       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
-       # support --undefined.  This deserves some investigation.  FIXME
-       archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      else
-       ld_shlibs_F77=no
-      fi
-      ;;
-
-    cygwin* | mingw* | pw32* | cegcc*)
-      # _LT_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless,
-      # as there is no search path for DLLs.
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      export_dynamic_flag_spec_F77='${wl}--export-all-symbols'
-      allow_undefined_flag_F77=unsupported
-      always_export_symbols_F77=no
-      enable_shared_with_static_runtimes_F77=yes
-      export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
-      exclude_expsyms_F77='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
-
-      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-        archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-       # If the export-symbols file already is a .def file (1st line
-       # is EXPORTS), use it as is; otherwise, prepend...
-       archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-         cp $export_symbols $output_objdir/$soname.def;
-       else
-         echo EXPORTS > $output_objdir/$soname.def;
-         cat $export_symbols >> $output_objdir/$soname.def;
-       fi~
-       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-      else
-       ld_shlibs_F77=no
-      fi
-      ;;
-
-    haiku*)
-      archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      link_all_deplibs_F77=yes
-      ;;
-
-    interix[3-9]*)
-      hardcode_direct_F77=no
-      hardcode_shlibpath_var_F77=no
-      hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
-      export_dynamic_flag_spec_F77='${wl}-E'
-      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-      # Instead, shared libraries are loaded at an image base (0x10000000 by
-      # default) and relocated if they conflict, which is a slow very memory
-      # consuming and fragmenting process.  To avoid this, we pick a random,
-      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      ;;
-
-    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
-      tmp_diet=no
-      if test "$host_os" = linux-dietlibc; then
-       case $cc_basename in
-         diet\ *) tmp_diet=yes;;       # linux-dietlibc with static linking (!diet-dyn)
-       esac
-      fi
-      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
-        && test "$tmp_diet" = no
-      then
-       tmp_addflag=' $pic_flag'
-       tmp_sharedflag='-shared'
-       case $cc_basename,$host_cpu in
-        pgcc*)                         # Portland Group C compiler
-         whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-         tmp_addflag=' $pic_flag'
-         ;;
-       pgf77* | pgf90* | pgf95* | pgfortran*)
-                                       # Portland Group f77 and f90 compilers
-         whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-         tmp_addflag=' $pic_flag -Mnomain' ;;
-       ecc*,ia64* | icc*,ia64*)        # Intel C compiler on ia64
-         tmp_addflag=' -i_dynamic' ;;
-       efc*,ia64* | ifort*,ia64*)      # Intel Fortran compiler on ia64
-         tmp_addflag=' -i_dynamic -nofor_main' ;;
-       ifc* | ifort*)                  # Intel Fortran compiler
-         tmp_addflag=' -nofor_main' ;;
-       lf95*)                          # Lahey Fortran 8.1
-         whole_archive_flag_spec_F77=
-         tmp_sharedflag='--shared' ;;
-       xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
-         tmp_sharedflag='-qmkshrobj'
-         tmp_addflag= ;;
-       nvcc*)  # Cuda Compiler Driver 2.2
-         whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-         compiler_needs_object_F77=yes
-         ;;
-       esac
-       case `$CC -V 2>&1 | sed 5q` in
-       *Sun\ C*)                       # Sun C 5.9
-         whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-         compiler_needs_object_F77=yes
-         tmp_sharedflag='-G' ;;
-       *Sun\ F*)                       # Sun Fortran 8.3
-         tmp_sharedflag='-G' ;;
-       esac
-       archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-
-        if test "x$supports_anon_versioning" = xyes; then
-          archive_expsym_cmds_F77='echo "{ global:" > $output_objdir/$libname.ver~
-           cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-           echo "local: *; };" >> $output_objdir/$libname.ver~
-           $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-        fi
-
-       case $cc_basename in
-       xlf* | bgf* | bgxlf* | mpixlf*)
-         # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
-         whole_archive_flag_spec_F77='--whole-archive$convenience --no-whole-archive'
-         hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
-         archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
-         if test "x$supports_anon_versioning" = xyes; then
-           archive_expsym_cmds_F77='echo "{ global:" > $output_objdir/$libname.ver~
-             cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-             echo "local: *; };" >> $output_objdir/$libname.ver~
-             $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
-         fi
-         ;;
-       esac
-      else
-        ld_shlibs_F77=no
-      fi
-      ;;
-
-    netbsd*)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-       archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
-       wlarc=
-      else
-       archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-       archive_expsym_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      fi
-      ;;
-
-    solaris*)
-      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
-       ld_shlibs_F77=no
-       cat <<_LT_EOF 1>&2
-
-*** Warning: The releases 2.8.* of the GNU linker cannot reliably
-*** create shared libraries on Solaris systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.9.1 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-_LT_EOF
-      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-       archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-       archive_expsym_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-       ld_shlibs_F77=no
-      fi
-      ;;
-
-    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
-      case `$LD -v 2>&1` in
-        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
-       ld_shlibs_F77=no
-       cat <<_LT_EOF 1>&2
-
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-_LT_EOF
-       ;;
-       *)
-         # For security reasons, it is highly recommended that you always
-         # use absolute paths for naming shared libraries, and exclude the
-         # DT_RUNPATH tag from executables and libraries.  But doing so
-         # requires that you compile everything twice, which is a pain.
-         if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-           hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
-           archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-           archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-         else
-           ld_shlibs_F77=no
-         fi
-       ;;
-      esac
-      ;;
-
-    sunos4*)
-      archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      wlarc=
-      hardcode_direct_F77=yes
-      hardcode_shlibpath_var_F77=no
-      ;;
-
-    *)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-       archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-       archive_expsym_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-       ld_shlibs_F77=no
-      fi
-      ;;
-    esac
-
-    if test "$ld_shlibs_F77" = no; then
-      runpath_var=
-      hardcode_libdir_flag_spec_F77=
-      export_dynamic_flag_spec_F77=
-      whole_archive_flag_spec_F77=
-    fi
-  else
-    # PORTME fill in a description of your system's linker (not GNU ld)
-    case $host_os in
-    aix3*)
-      allow_undefined_flag_F77=unsupported
-      always_export_symbols_F77=yes
-      archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
-      # Note: this linker hardcodes the directories in LIBPATH if there
-      # are no directories specified by -L.
-      hardcode_minus_L_F77=yes
-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
-       # Neither direct hardcoding nor static linking is supported with a
-       # broken collect2.
-       hardcode_direct_F77=unsupported
-      fi
-      ;;
-
-    aix[4-9]*)
-      if test "$host_cpu" = ia64; then
-       # On IA64, the linker does run time linking by default, so we don't
-       # have to do anything special.
-       aix_use_runtimelinking=no
-       exp_sym_flag='-Bexport'
-       no_entry_flag=""
-      else
-       # If we're using GNU nm, then we don't want the "-C" option.
-       # -C means demangle to AIX nm, but means don't demangle with GNU nm
-       # Also, AIX nm treats weak defined symbols like other global
-       # defined symbols, whereas GNU nm marks them as "W".
-       if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-         export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-       else
-         export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-       fi
-       aix_use_runtimelinking=no
-
-       # Test if we are trying to use run time linking or normal
-       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
-       # need to do runtime linking.
-       case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
-         for ld_flag in $LDFLAGS; do
-         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
-           aix_use_runtimelinking=yes
-           break
-         fi
-         done
-         ;;
-       esac
-
-       exp_sym_flag='-bexport'
-       no_entry_flag='-bnoentry'
-      fi
-
-      # When large executables or shared objects are built, AIX ld can
-      # have problems creating the table of contents.  If linking a library
-      # or program results in "error TOC overflow" add -mminimal-toc to
-      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
-
-      archive_cmds_F77=''
-      hardcode_direct_F77=yes
-      hardcode_direct_absolute_F77=yes
-      hardcode_libdir_separator_F77=':'
-      link_all_deplibs_F77=yes
-      file_list_spec_F77='${wl}-f,'
-
-      if test "$GCC" = yes; then
-       case $host_os in aix4.[012]|aix4.[012].*)
-       # We only want to do this on AIX 4.2 and lower, the check
-       # below for broken collect2 doesn't work under 4.3+
-         collect2name=`${CC} -print-prog-name=collect2`
-         if test -f "$collect2name" &&
-          strings "$collect2name" | $GREP resolve_lib_name >/dev/null
-         then
-         # We have reworked collect2
-         :
-         else
-         # We have old collect2
-         hardcode_direct_F77=unsupported
-         # It fails to find uninstalled libraries when the uninstalled
-         # path is not listed in the libpath.  Setting hardcode_minus_L
-         # to unsupported forces relinking
-         hardcode_minus_L_F77=yes
-         hardcode_libdir_flag_spec_F77='-L$libdir'
-         hardcode_libdir_separator_F77=
-         fi
-         ;;
-       esac
-       shared_flag='-shared'
-       if test "$aix_use_runtimelinking" = yes; then
-         shared_flag="$shared_flag "'${wl}-G'
-       fi
-      else
-       # not using gcc
-       if test "$host_cpu" = ia64; then
-       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-       # chokes on -Wl,-G. The following line is correct:
-         shared_flag='-G'
-       else
-         if test "$aix_use_runtimelinking" = yes; then
-           shared_flag='${wl}-G'
-         else
-           shared_flag='${wl}-bM:SRE'
-         fi
-       fi
-      fi
-
-      export_dynamic_flag_spec_F77='${wl}-bexpall'
-      # It seems that -bexpall does not export symbols beginning with
-      # underscore (_), so it is better to generate a list of symbols to export.
-      always_export_symbols_F77=yes
-      if test "$aix_use_runtimelinking" = yes; then
-       # Warning - without using the other runtime loading flags (-brtl),
-       # -berok will link without error, but may produce a broken library.
-       allow_undefined_flag_F77='-berok'
-        # Determine the default libpath from the value encoded in an
-        # empty executable.
-        if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  if ${lt_cv_aix_libpath__F77+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat > conftest.$ac_ext <<_ACEOF
-      program main
-
-      end
-_ACEOF
-if ac_fn_f77_try_link "$LINENO"; then :
-
-  lt_aix_libpath_sed='
-      /Import File Strings/,/^$/ {
-         /^0/ {
-             s/^0  *\([^ ]*\) *$/\1/
-             p
-         }
-      }'
-  lt_cv_aix_libpath__F77=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  # Check for a 64-bit object if we didn't find anything.
-  if test -z "$lt_cv_aix_libpath__F77"; then
-    lt_cv_aix_libpath__F77=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  if test -z "$lt_cv_aix_libpath__F77"; then
-    lt_cv_aix_libpath__F77="/usr/lib:/lib"
-  fi
-
-fi
-
-  aix_libpath=$lt_cv_aix_libpath__F77
-fi
-
-        hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
-        archive_expsym_cmds_F77='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-      else
-       if test "$host_cpu" = ia64; then
-         hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib'
-         allow_undefined_flag_F77="-z nodefs"
-         archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-       else
-        # Determine the default libpath from the value encoded in an
-        # empty executable.
-        if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  if ${lt_cv_aix_libpath__F77+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat > conftest.$ac_ext <<_ACEOF
-      program main
-
-      end
-_ACEOF
-if ac_fn_f77_try_link "$LINENO"; then :
-
-  lt_aix_libpath_sed='
-      /Import File Strings/,/^$/ {
-         /^0/ {
-             s/^0  *\([^ ]*\) *$/\1/
-             p
-         }
-      }'
-  lt_cv_aix_libpath__F77=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  # Check for a 64-bit object if we didn't find anything.
-  if test -z "$lt_cv_aix_libpath__F77"; then
-    lt_cv_aix_libpath__F77=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  if test -z "$lt_cv_aix_libpath__F77"; then
-    lt_cv_aix_libpath__F77="/usr/lib:/lib"
-  fi
-
-fi
-
-  aix_libpath=$lt_cv_aix_libpath__F77
-fi
-
-        hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
-         # Warning - without using the other run time loading flags,
-         # -berok will link without error, but may produce a broken library.
-         no_undefined_flag_F77=' ${wl}-bernotok'
-         allow_undefined_flag_F77=' ${wl}-berok'
-         if test "$with_gnu_ld" = yes; then
-           # We only use this code for GNU lds that support --whole-archive.
-           whole_archive_flag_spec_F77='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-         else
-           # Exported symbols can be pulled into shared objects from archives
-           whole_archive_flag_spec_F77='$convenience'
-         fi
-         archive_cmds_need_lc_F77=yes
-         # This is similar to how AIX traditionally builds its shared libraries.
-         archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-       fi
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            archive_expsym_cmds_F77=''
-        ;;
-      m68k)
-            archive_cmds_F77='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-            hardcode_libdir_flag_spec_F77='-L$libdir'
-            hardcode_minus_L_F77=yes
-        ;;
-      esac
-      ;;
-
-    bsdi[45]*)
-      export_dynamic_flag_spec_F77=-rdynamic
-      ;;
-
-    cygwin* | mingw* | pw32* | cegcc*)
-      # When not using gcc, we currently assume that we are using
-      # Microsoft Visual C++.
-      # hardcode_libdir_flag_spec is actually meaningless, as there is
-      # no search path for DLLs.
-      case $cc_basename in
-      cl*)
-       # Native MSVC
-       hardcode_libdir_flag_spec_F77=' '
-       allow_undefined_flag_F77=unsupported
-       always_export_symbols_F77=yes
-       file_list_spec_F77='@'
-       # Tell ltmain to make .lib files, not .a files.
-       libext=lib
-       # Tell ltmain to make .dll files, not .so files.
-       shrext_cmds=".dll"
-       # FIXME: Setting linknames here is a bad hack.
-       archive_cmds_F77='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-       archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-           sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-         else
-           sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-         fi~
-         $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-         linknames='
-       # The linker will not automatically build a static lib if we build a DLL.
-       # _LT_TAGVAR(old_archive_from_new_cmds, F77)='true'
-       enable_shared_with_static_runtimes_F77=yes
-       exclude_expsyms_F77='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
-       export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
-       # Don't use ranlib
-       old_postinstall_cmds_F77='chmod 644 $oldlib'
-       postlink_cmds_F77='lt_outputfile="@OUTPUT@"~
-         lt_tool_outputfile="@TOOL_OUTPUT@"~
-         case $lt_outputfile in
-           *.exe|*.EXE) ;;
-           *)
-             lt_outputfile="$lt_outputfile.exe"
-             lt_tool_outputfile="$lt_tool_outputfile.exe"
-             ;;
-         esac~
-         if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-           $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-           $RM "$lt_outputfile.manifest";
-         fi'
-       ;;
-      *)
-       # Assume MSVC wrapper
-       hardcode_libdir_flag_spec_F77=' '
-       allow_undefined_flag_F77=unsupported
-       # Tell ltmain to make .lib files, not .a files.
-       libext=lib
-       # Tell ltmain to make .dll files, not .so files.
-       shrext_cmds=".dll"
-       # FIXME: Setting linknames here is a bad hack.
-       archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
-       # The linker will automatically build a .lib file if we build a DLL.
-       old_archive_from_new_cmds_F77='true'
-       # FIXME: Should let the user specify the lib program.
-       old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs'
-       enable_shared_with_static_runtimes_F77=yes
-       ;;
-      esac
-      ;;
-
-    darwin* | rhapsody*)
-
-
-  archive_cmds_need_lc_F77=no
-  hardcode_direct_F77=no
-  hardcode_automatic_F77=yes
-  hardcode_shlibpath_var_F77=unsupported
-  if test "$lt_cv_ld_force_load" = "yes"; then
-    whole_archive_flag_spec_F77='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
-    compiler_needs_object_F77=yes
-  else
-    whole_archive_flag_spec_F77=''
-  fi
-  link_all_deplibs_F77=yes
-  allow_undefined_flag_F77="$_lt_dar_allow_undefined"
-  case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
-     *) _lt_dar_can_shared=$GCC ;;
-  esac
-  if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=func_echo_all
-    archive_cmds_F77="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-    module_cmds_F77="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-    archive_expsym_cmds_F77="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-    module_expsym_cmds_F77="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
-
-  else
-  ld_shlibs_F77=no
-  fi
-
-      ;;
-
-    dgux*)
-      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      hardcode_shlibpath_var_F77=no
-      ;;
-
-    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
-    # support.  Future versions do this automatically, but an explicit c++rt0.o
-    # does not break anything, and helps significantly (at the cost of a little
-    # extra space).
-    freebsd2.2*)
-      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
-      hardcode_libdir_flag_spec_F77='-R$libdir'
-      hardcode_direct_F77=yes
-      hardcode_shlibpath_var_F77=no
-      ;;
-
-    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2.*)
-      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct_F77=yes
-      hardcode_minus_L_F77=yes
-      hardcode_shlibpath_var_F77=no
-      ;;
-
-    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | dragonfly*)
-      archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-      hardcode_libdir_flag_spec_F77='-R$libdir'
-      hardcode_direct_F77=yes
-      hardcode_shlibpath_var_F77=no
-      ;;
-
-    hpux9*)
-      if test "$GCC" = yes; then
-       archive_cmds_F77='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      else
-       archive_cmds_F77='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      fi
-      hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
-      hardcode_libdir_separator_F77=:
-      hardcode_direct_F77=yes
-
-      # hardcode_minus_L: Not really in the search PATH,
-      # but as the default location of the library.
-      hardcode_minus_L_F77=yes
-      export_dynamic_flag_spec_F77='${wl}-E'
-      ;;
-
-    hpux10*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
-       archive_cmds_F77='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-      else
-       archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      if test "$with_gnu_ld" = no; then
-       hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
-       hardcode_libdir_separator_F77=:
-       hardcode_direct_F77=yes
-       hardcode_direct_absolute_F77=yes
-       export_dynamic_flag_spec_F77='${wl}-E'
-       # hardcode_minus_L: Not really in the search PATH,
-       # but as the default location of the library.
-       hardcode_minus_L_F77=yes
-      fi
-      ;;
-
-    hpux11*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
-       case $host_cpu in
-       hppa*64*)
-         archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-         ;;
-       ia64*)
-         archive_cmds_F77='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-         ;;
-       *)
-         archive_cmds_F77='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-         ;;
-       esac
-      else
-       case $host_cpu in
-       hppa*64*)
-         archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-         ;;
-       ia64*)
-         archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-         ;;
-       *)
-       archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-         ;;
-       esac
-      fi
-      if test "$with_gnu_ld" = no; then
-       hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
-       hardcode_libdir_separator_F77=:
-
-       case $host_cpu in
-       hppa*64*|ia64*)
-         hardcode_direct_F77=no
-         hardcode_shlibpath_var_F77=no
-         ;;
-       *)
-         hardcode_direct_F77=yes
-         hardcode_direct_absolute_F77=yes
-         export_dynamic_flag_spec_F77='${wl}-E'
-
-         # hardcode_minus_L: Not really in the search PATH,
-         # but as the default location of the library.
-         hardcode_minus_L_F77=yes
-         ;;
-       esac
-      fi
-      ;;
-
-    irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-       archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-       # Try to use the -exported_symbol ld option, if it does not
-       # work, assume that -exports_file does not work either and
-       # implicitly export all symbols.
-       # This should be the same for all languages, so no per-tag cache variable.
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
-$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
-if ${lt_cv_irix_exported_symbol+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  save_LDFLAGS="$LDFLAGS"
-          LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-          cat > conftest.$ac_ext <<_ACEOF
-
-      subroutine foo
-      end
-_ACEOF
-if ac_fn_f77_try_link "$LINENO"; then :
-  lt_cv_irix_exported_symbol=yes
-else
-  lt_cv_irix_exported_symbol=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-           LDFLAGS="$save_LDFLAGS"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
-$as_echo "$lt_cv_irix_exported_symbol" >&6; }
-       if test "$lt_cv_irix_exported_symbol" = yes; then
-          archive_expsym_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-       fi
-      else
-       archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-       archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
-      fi
-      archive_cmds_need_lc_F77='no'
-      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator_F77=:
-      inherit_rpath_F77=yes
-      link_all_deplibs_F77=yes
-      ;;
-
-    netbsd*)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-       archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
-      else
-       archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
-      fi
-      hardcode_libdir_flag_spec_F77='-R$libdir'
-      hardcode_direct_F77=yes
-      hardcode_shlibpath_var_F77=no
-      ;;
-
-    newsos6)
-      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct_F77=yes
-      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator_F77=:
-      hardcode_shlibpath_var_F77=no
-      ;;
-
-    *nto* | *qnx*)
-      ;;
-
-    openbsd*)
-      if test -f /usr/libexec/ld.so; then
-       hardcode_direct_F77=yes
-       hardcode_shlibpath_var_F77=no
-       hardcode_direct_absolute_F77=yes
-       if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-         archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-         archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-         hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
-         export_dynamic_flag_spec_F77='${wl}-E'
-       else
-         case $host_os in
-          openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-            archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-            hardcode_libdir_flag_spec_F77='-R$libdir'
-            ;;
-          *)
-            archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-            hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
-            ;;
-         esac
-       fi
-      else
-       ld_shlibs_F77=no
-      fi
-      ;;
-
-    os2*)
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      hardcode_minus_L_F77=yes
-      allow_undefined_flag_F77=unsupported
-      archive_cmds_F77='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      old_archive_from_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
-      ;;
-
-    osf3*)
-      if test "$GCC" = yes; then
-       allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
-       archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-       allow_undefined_flag_F77=' -expect_unresolved \*'
-       archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-      fi
-      archive_cmds_need_lc_F77='no'
-      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator_F77=:
-      ;;
-
-    osf4* | osf5*)     # as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-       allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
-       archive_cmds_F77='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-       hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
-      else
-       allow_undefined_flag_F77=' -expect_unresolved \*'
-       archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-       archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-       $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
-
-       # Both c and cxx compiler support -rpath directly
-       hardcode_libdir_flag_spec_F77='-rpath $libdir'
-      fi
-      archive_cmds_need_lc_F77='no'
-      hardcode_libdir_separator_F77=:
-      ;;
-
-    solaris*)
-      no_undefined_flag_F77=' -z defs'
-      if test "$GCC" = yes; then
-       wlarc='${wl}'
-       archive_cmds_F77='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-       archive_expsym_cmds_F77='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-         $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-      else
-       case `$CC -V 2>&1` in
-       *"Compilers 5.0"*)
-         wlarc=''
-         archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
-         archive_expsym_cmds_F77='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-         $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
-         ;;
-       *)
-         wlarc='${wl}'
-         archive_cmds_F77='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
-         archive_expsym_cmds_F77='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-         $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-         ;;
-       esac
-      fi
-      hardcode_libdir_flag_spec_F77='-R$libdir'
-      hardcode_shlibpath_var_F77=no
-      case $host_os in
-      solaris2.[0-5] | solaris2.[0-5].*) ;;
-      *)
-       # The compiler driver will combine and reorder linker options,
-       # but understands `-z linker_flag'.  GCC discards it without `$wl',
-       # but is careful enough not to reorder.
-       # Supported since Solaris 2.6 (maybe 2.5.1?)
-       if test "$GCC" = yes; then
-         whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-       else
-         whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract'
-       fi
-       ;;
-      esac
-      link_all_deplibs_F77=yes
-      ;;
-
-    sunos4*)
-      if test "x$host_vendor" = xsequent; then
-       # Use $CC to link under sequent, because it throws in some extra .o
-       # files that make .init and .fini sections work.
-       archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-       archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      hardcode_direct_F77=yes
-      hardcode_minus_L_F77=yes
-      hardcode_shlibpath_var_F77=no
-      ;;
-
-    sysv4)
-      case $host_vendor in
-       sni)
-         archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-         hardcode_direct_F77=yes # is this really true???
-       ;;
-       siemens)
-         ## LD is ld it makes a PLAMLIB
-         ## CC just makes a GrossModule.
-         archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags'
-         reload_cmds_F77='$CC -r -o $output$reload_objs'
-         hardcode_direct_F77=no
-        ;;
-       motorola)
-         archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-         hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie
-       ;;
-      esac
-      runpath_var='LD_RUN_PATH'
-      hardcode_shlibpath_var_F77=no
-      ;;
-
-    sysv4.3*)
-      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_shlibpath_var_F77=no
-      export_dynamic_flag_spec_F77='-Bexport'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec; then
-       archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-       hardcode_shlibpath_var_F77=no
-       runpath_var=LD_RUN_PATH
-       hardcode_runpath_var=yes
-       ld_shlibs_F77=yes
-      fi
-      ;;
-
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
-      no_undefined_flag_F77='${wl}-z,text'
-      archive_cmds_need_lc_F77=no
-      hardcode_shlibpath_var_F77=no
-      runpath_var='LD_RUN_PATH'
-
-      if test "$GCC" = yes; then
-       archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-       archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-       archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-       archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
-
-    sysv5* | sco3.2v5* | sco5v6*)
-      # Note: We can NOT use -z defs as we might desire, because we do not
-      # link with -lc, and that would cause any symbols used from libc to
-      # always be unresolved, which means just about no library would
-      # ever link correctly.  If we're not using GNU ld we use -z text
-      # though, which does catch some bad symbols but isn't as heavy-handed
-      # as -z defs.
-      no_undefined_flag_F77='${wl}-z,text'
-      allow_undefined_flag_F77='${wl}-z,nodefs'
-      archive_cmds_need_lc_F77=no
-      hardcode_shlibpath_var_F77=no
-      hardcode_libdir_flag_spec_F77='${wl}-R,$libdir'
-      hardcode_libdir_separator_F77=':'
-      link_all_deplibs_F77=yes
-      export_dynamic_flag_spec_F77='${wl}-Bexport'
-      runpath_var='LD_RUN_PATH'
-
-      if test "$GCC" = yes; then
-       archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-       archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-       archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-       archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
-
-    uts4*)
-      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      hardcode_shlibpath_var_F77=no
-      ;;
-
-    *)
-      ld_shlibs_F77=no
-      ;;
-    esac
-
-    if test x$host_vendor = xsni; then
-      case $host in
-      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-       export_dynamic_flag_spec_F77='${wl}-Blargedynsym'
-       ;;
-      esac
-    fi
-  fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_F77" >&5
-$as_echo "$ld_shlibs_F77" >&6; }
-test "$ld_shlibs_F77" = no && can_build_shared=no
-
-with_gnu_ld_F77=$with_gnu_ld
-
-
-
-
-
-
-#
-# Do we need to explicitly link libc?
-#
-case "x$archive_cmds_need_lc_F77" in
-x|xyes)
-  # Assume -lc should be added
-  archive_cmds_need_lc_F77=yes
-
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
-    case $archive_cmds_F77 in
-    *'~'*)
-      # FIXME: we may have to deal with multi-command sequences.
-      ;;
-    '$CC '*)
-      # Test whether the compiler implicitly links with -lc since on some
-      # systems, -lgcc has to come before -lc. If gcc already passes -lc
-      # to ld, don't add -lc before -lgcc.
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
-$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-if ${lt_cv_archive_cmds_need_lc_F77+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  $RM conftest*
-       echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-       if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } 2>conftest.err; then
-         soname=conftest
-         lib=conftest
-         libobjs=conftest.$ac_objext
-         deplibs=
-         wl=$lt_prog_compiler_wl_F77
-         pic_flag=$lt_prog_compiler_pic_F77
-         compiler_flags=-v
-         linker_flags=-v
-         verstring=
-         output_objdir=.
-         libname=conftest
-         lt_save_allow_undefined_flag=$allow_undefined_flag_F77
-         allow_undefined_flag_F77=
-         if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_F77 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
-  (eval $archive_cmds_F77 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-         then
-           lt_cv_archive_cmds_need_lc_F77=no
-         else
-           lt_cv_archive_cmds_need_lc_F77=yes
-         fi
-         allow_undefined_flag_F77=$lt_save_allow_undefined_flag
-       else
-         cat conftest.err 1>&5
-       fi
-       $RM conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_F77" >&5
-$as_echo "$lt_cv_archive_cmds_need_lc_F77" >&6; }
-      archive_cmds_need_lc_F77=$lt_cv_archive_cmds_need_lc_F77
-      ;;
-    esac
-  fi
-  ;;
-esac
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
-$as_echo_n "checking dynamic linker characteristics... " >&6; }
-
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-shrext_cmds=".so"
-postinstall_cmds=
-postuninstall_cmds=
-finish_cmds=
-finish_eval=
-shlibpath_var=
-shlibpath_overrides_runpath=unknown
-version_type=none
-dynamic_linker="$host_os ld.so"
-sys_lib_dlsearch_path_spec="/lib /usr/lib"
-need_lib_prefix=unknown
-hardcode_into_libs=no
-
-# when you set need_version to no, make sure it does not cause -set_version
-# flags to be left without arguments
-need_version=unknown
-
-case $host_os in
-aix3*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
-  shlibpath_var=LIBPATH
-
-  # AIX 3 has no versioning support, so we append a major version to the name.
-  soname_spec='${libname}${release}${shared_ext}$major'
-  ;;
-
-aix[4-9]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  hardcode_into_libs=yes
-  if test "$host_cpu" = ia64; then
-    # AIX 5 supports IA64
-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
-    shlibpath_var=LD_LIBRARY_PATH
-  else
-    # With GCC up to 2.95.x, collect2 would create an import file
-    # for dependence libraries.  The import file would start with
-    # the line `#! .'.  This would cause the generated library to
-    # depend on `.', always an invalid library.  This was fixed in
-    # development snapshots of GCC prior to 3.0.
-    case $host_os in
-      aix4 | aix4.[01] | aix4.[01].*)
-      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
-          echo ' yes '
-          echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
-       :
-      else
-       can_build_shared=no
-      fi
-      ;;
-    esac
-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
-    # soname into executable. Probably we can add versioning support to
-    # collect2, so additional links can be useful in future.
-    if test "$aix_use_runtimelinking" = yes; then
-      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
-      # instead of lib<name>.a to let people know that these are not
-      # typical AIX shared libraries.
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    else
-      # We preserve .a as extension for shared libraries through AIX4.2
-      # and later when we are not doing run time linking.
-      library_names_spec='${libname}${release}.a $libname.a'
-      soname_spec='${libname}${release}${shared_ext}$major'
-    fi
-    shlibpath_var=LIBPATH
-  fi
-  ;;
-
-amigaos*)
-  case $host_cpu in
-  powerpc)
-    # Since July 2007 AmigaOS4 officially supports .so libraries.
-    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    ;;
-  m68k)
-    library_names_spec='$libname.ixlibrary $libname.a'
-    # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
-    ;;
-  esac
-  ;;
-
-beos*)
-  library_names_spec='${libname}${shared_ext}'
-  dynamic_linker="$host_os ld.so"
-  shlibpath_var=LIBRARY_PATH
-  ;;
-
-bsdi[45]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
-  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
-  # the default ld.so.conf also contains /usr/contrib/lib and
-  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
-  # libtool to hard-code these into programs
-  ;;
-
-cygwin* | mingw* | pw32* | cegcc*)
-  version_type=windows
-  shrext_cmds=".dll"
-  need_version=no
-  need_lib_prefix=no
-
-  case $GCC,$cc_basename in
-  yes,*)
-    # gcc
-    library_names_spec='$libname.dll.a'
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname~
-      chmod a+x \$dldir/$dlname~
-      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
-        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
-      fi'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
-
-    case $host_os in
-    cygwin*)
-      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-
-      ;;
-    mingw* | cegcc*)
-      # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    esac
-    dynamic_linker='Win32 ld.exe'
-    ;;
-
-  *,cl*)
-    # Native MSVC
-    libname_spec='$name'
-    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-    library_names_spec='${libname}.dll.lib'
-
-    case $build_os in
-    mingw*)
-      sys_lib_search_path_spec=
-      lt_save_ifs=$IFS
-      IFS=';'
-      for lt_path in $LIB
-      do
-        IFS=$lt_save_ifs
-        # Let DOS variable expansion print the short 8.3 style file name.
-        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
-        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
-      done
-      IFS=$lt_save_ifs
-      # Convert to MSYS style.
-      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
-      ;;
-    cygwin*)
-      # Convert to unix form, then to dos form, then back to unix form
-      # but this time dos style (no spaces!) so that the unix form looks
-      # like /cygdrive/c/PROGRA~1:/cygdr...
-      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
-      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
-      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
-      ;;
-    *)
-      sys_lib_search_path_spec="$LIB"
-      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
-      fi
-      # FIXME: find the short name or the path components, as spaces are
-      # common. (e.g. "Program Files" -> "PROGRA~1")
-      ;;
-    esac
-
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
-    dynamic_linker='Win32 link.exe'
-    ;;
-
-  *)
-    # Assume MSVC wrapper
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    dynamic_linker='Win32 ld.exe'
-    ;;
-  esac
-  # FIXME: first we should search . and the directory the executable is in
-  shlibpath_var=PATH
-  ;;
-
-darwin* | rhapsody*)
-  dynamic_linker="$host_os dyld"
-  version_type=darwin
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
-  soname_spec='${libname}${release}${major}$shared_ext'
-  shlibpath_overrides_runpath=yes
-  shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
-
-  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
-  ;;
-
-dgux*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  ;;
-
-freebsd* | dragonfly*)
-  # DragonFly does not have aout.  When/if they implement a new
-  # versioning mechanism, adjust this.
-  if test -x /usr/bin/objformat; then
-    objformat=`/usr/bin/objformat`
-  else
-    case $host_os in
-    freebsd[23].*) objformat=aout ;;
-    *) objformat=elf ;;
-    esac
-  fi
-  version_type=freebsd-$objformat
-  case $version_type in
-    freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-      need_version=no
-      need_lib_prefix=no
-      ;;
-    freebsd-*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
-      need_version=yes
-      ;;
-  esac
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_os in
-  freebsd2.*)
-    shlibpath_overrides_runpath=yes
-    ;;
-  freebsd3.[01]* | freebsdelf3.[01]*)
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
-  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
-    shlibpath_overrides_runpath=no
-    hardcode_into_libs=yes
-    ;;
-  *) # from 4.6 on, and DragonFly
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  esac
-  ;;
-
-gnu*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-haiku*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  dynamic_linker="$host_os runtime_loader"
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
-  hardcode_into_libs=yes
-  ;;
-
-hpux9* | hpux10* | hpux11*)
-  # Give a soname corresponding to the major version so that dld.sl refuses to
-  # link against other versions.
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  case $host_cpu in
-  ia64*)
-    shrext_cmds='.so'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.so"
-    shlibpath_var=LD_LIBRARY_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    if test "X$HPUX_IA64_MODE" = X32; then
-      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
-    else
-      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
-    fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-  hppa*64*)
-    shrext_cmds='.sl'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-  *)
-    shrext_cmds='.sl'
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=SHLIB_PATH
-    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    ;;
-  esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
-  postinstall_cmds='chmod 555 $lib'
-  # or fails outright, so override atomically:
-  install_override_mode=555
-  ;;
-
-interix[3-9]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-irix5* | irix6* | nonstopux*)
-  case $host_os in
-    nonstopux*) version_type=nonstopux ;;
-    *)
-       if test "$lt_cv_prog_gnu_ld" = yes; then
-               version_type=linux # correct to gnu/linux during the next big refactor
-       else
-               version_type=irix
-       fi ;;
-  esac
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
-  case $host_os in
-  irix5* | nonstopux*)
-    libsuff= shlibsuff=
-    ;;
-  *)
-    case $LD in # libtool.m4 will add one of these switches to LD
-    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
-      libsuff= shlibsuff= libmagic=32-bit;;
-    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
-      libsuff=32 shlibsuff=N32 libmagic=N32;;
-    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
-      libsuff=64 shlibsuff=64 libmagic=64-bit;;
-    *) libsuff= shlibsuff= libmagic=never-match;;
-    esac
-    ;;
-  esac
-  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
-  shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
-  hardcode_into_libs=yes
-  ;;
-
-# No shared lib support for Linux oldld, aout, or coff.
-linux*oldld* | linux*aout* | linux*coff*)
-  dynamic_linker=no
-  ;;
-
-# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-
-  # Some binutils ld are patched to set DT_RUNPATH
-  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_shlibpath_overrides_runpath=no
-    save_LDFLAGS=$LDFLAGS
-    save_libdir=$libdir
-    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_F77\"; \
-        LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_F77\""
-    cat > conftest.$ac_ext <<_ACEOF
-      program main
-
-      end
-_ACEOF
-if ac_fn_f77_try_link "$LINENO"; then :
-  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
-  lt_cv_shlibpath_overrides_runpath=yes
-fi
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-    LDFLAGS=$save_LDFLAGS
-    libdir=$save_libdir
-
-fi
-
-  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
-
-  # This implies no fast_install, which is unacceptable.
-  # Some rework will be needed to allow for fast_install
-  # before this can be enabled.
-  hardcode_into_libs=yes
-
-  # Append ld.so.conf contents to the search path
-  if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[      ]*hwcap[        ]/d;s/[:,      ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
-  fi
-
-  # We used to test for /lib/ld.so.1 and disable shared libraries on
-  # powerpc, because MkLinux only supported shared libraries with the
-  # GNU dynamic linker.  Since this was broken with cross compilers,
-  # most powerpc-linux boxes support dynamic linking these days and
-  # people can always --disable-shared, the test was removed, and we
-  # assume the GNU/Linux dynamic linker is in use.
-  dynamic_linker='GNU/Linux ld.so'
-  ;;
-
-netbsd*)
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-    dynamic_linker='NetBSD (a.out) ld.so'
-  else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    dynamic_linker='NetBSD ld.elf_so'
-  fi
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  ;;
-
-newsos6)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  ;;
-
-*nto* | *qnx*)
-  version_type=qnx
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='ldqnx.so'
-  ;;
-
-openbsd*)
-  version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
-  need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
-    *)                         need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[89] | openbsd2.[89].*)
-       shlibpath_overrides_runpath=no
-       ;;
-      *)
-       shlibpath_overrides_runpath=yes
-       ;;
-      esac
-  else
-    shlibpath_overrides_runpath=yes
-  fi
-  ;;
-
-os2*)
-  libname_spec='$name'
-  shrext_cmds=".dll"
-  need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
-  dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
-  ;;
-
-osf3* | osf4* | osf5*)
-  version_type=osf
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
-  ;;
-
-rdos*)
-  dynamic_linker=no
-  ;;
-
-solaris*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  # ldd complains unless libraries are executable
-  postinstall_cmds='chmod +x $lib'
-  ;;
-
-sunos4*)
-  version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
-    need_lib_prefix=no
-  fi
-  need_version=yes
-  ;;
-
-sysv4 | sysv4.3*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_vendor in
-    sni)
-      shlibpath_overrides_runpath=no
-      need_lib_prefix=no
-      runpath_var=LD_RUN_PATH
-      ;;
-    siemens)
-      need_lib_prefix=no
-      ;;
-    motorola)
-      need_lib_prefix=no
-      need_version=no
-      shlibpath_overrides_runpath=no
-      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
-      ;;
-  esac
-  ;;
-
-sysv4*MP*)
-  if test -d /usr/nec ;then
-    version_type=linux # correct to gnu/linux during the next big refactor
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
-    shlibpath_var=LD_LIBRARY_PATH
-  fi
-  ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
-    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
-  else
-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    case $host_os in
-      sco3.2v5*)
-        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
-       ;;
-    esac
-  fi
-  sys_lib_dlsearch_path_spec='/usr/lib'
-  ;;
-
-tpf*)
-  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-uts4*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  ;;
-
-*)
-  dynamic_linker=no
-  ;;
-esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
-$as_echo "$dynamic_linker" >&6; }
-test "$dynamic_linker" = no && can_build_shared=no
-
-variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
-  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
-fi
-
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-fi
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
-$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
-hardcode_action_F77=
-if test -n "$hardcode_libdir_flag_spec_F77" ||
-   test -n "$runpath_var_F77" ||
-   test "X$hardcode_automatic_F77" = "Xyes" ; then
-
-  # We can hardcode non-existent directories.
-  if test "$hardcode_direct_F77" != no &&
-     # If the only mechanism to avoid hardcoding is shlibpath_var, we
-     # have to relink, otherwise we might link with an installed library
-     # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, F77)" != no &&
-     test "$hardcode_minus_L_F77" != no; then
-    # Linking always hardcodes the temporary library directory.
-    hardcode_action_F77=relink
-  else
-    # We can link without hardcoding, and we can hardcode nonexisting dirs.
-    hardcode_action_F77=immediate
-  fi
-else
-  # We cannot hardcode anything, or else we can only hardcode existing
-  # directories.
-  hardcode_action_F77=unsupported
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_F77" >&5
-$as_echo "$hardcode_action_F77" >&6; }
-
-if test "$hardcode_action_F77" = relink ||
-   test "$inherit_rpath_F77" = yes; then
-  # Fast installation is not supported
-  enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
-  # Fast installation is not necessary
-  enable_fast_install=needless
-fi
-
-
-
-
-
-
-
-  fi # test -n "$compiler"
-
-  GCC=$lt_save_GCC
-  CC="$lt_save_CC"
-  CFLAGS="$lt_save_CFLAGS"
-fi # test "$_lt_disable_F77" != yes
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-
-
-
-
-
-
-
-
-
-
-        ac_config_commands="$ac_config_commands libtool"
+        ac_config_commands="$ac_config_commands libtool"
 
 
 
@@ -25263,47 +22757,7 @@ _ACEOF
  esac
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether <stdarg.h> exists and works" >&5
-$as_echo_n "checking whether <stdarg.h> exists and works... " >&6; }
-if ${gmp_cv_c_stdarg+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdarg.h>
-int foo (int x, ...)
-{
-  va_list  ap;
-  int      y;
-  va_start (ap, x);
-  y = va_arg (ap, int);
-  va_end (ap);
-  return y;
-}
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  gmp_cv_c_stdarg=yes
-else
-  gmp_cv_c_stdarg=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_c_stdarg" >&5
-$as_echo "$gmp_cv_c_stdarg" >&6; }
-if test $gmp_cv_c_stdarg = yes; then
-
-$as_echo "#define HAVE_STDARG 1" >>confdefs.h
-
-fi
-
+# GMP_C_STDARG
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc __attribute__ ((const)) works" >&5
 $as_echo_n "checking whether gcc __attribute__ ((const)) works... " >&6; }
 if ${gmp_cv_c_attribute_const+:} false; then :
@@ -26403,7 +23857,6 @@ LIBS="$old_LIBS"
 
 
 
-
 ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf"
 if test "x$ac_cv_func_vsnprintf" = xyes; then :
   gmp_vsnprintf_exists=yes
@@ -26430,31 +23883,16 @@ else
 #include <string.h>  /* for strcmp */
 #include <stdio.h>   /* for vsnprintf */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
 
 int
-#if HAVE_STDARG
 check (const char *fmt, ...)
-#else
-check (va_alist)
-     va_dcl
-#endif
 {
   static char  buf[128];
   va_list  ap;
   int      ret;
 
-#if HAVE_STDARG
   va_start (ap, fmt);
-#else
-  char *fmt;
-  va_start (ap);
-  fmt = va_arg (ap, char *);
-#endif
 
   ret = vsnprintf (buf, 4, fmt, ap);
 
@@ -26605,7 +24043,7 @@ gmp_mpn_functions_optional="umul udiv                                   \
   add_n_sub_n addaddmul_1msb0"
 
 gmp_mpn_functions="$extra_functions                                       \
-  add add_1 add_n sub sub_1 sub_n addcnd_n subcnd_n neg com               \
+  add add_1 add_n sub sub_1 sub_n cnd_add_n cnd_sub_n neg com             \
   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             \
@@ -26614,7 +24052,8 @@ gmp_mpn_functions="$extra_functions                                        \
   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 get_str set_str scan0 scan1 popcount hamdist cmp        \
+  rootrem sqrtrem sizeinbase get_str set_str                              \
+  scan0 scan1 popcount hamdist cmp                                        \
   perfsqr perfpow                                                         \
   gcd_1 gcd gcdext_1 gcdext gcd_subdiv_step                               \
   gcdext_lehmer                                                                   \
@@ -26634,6 +24073,7 @@ gmp_mpn_functions="$extra_functions                                        \
   toom_interpolate_5pts toom_interpolate_6pts toom_interpolate_7pts       \
   toom_interpolate_8pts toom_interpolate_12pts toom_interpolate_16pts     \
   invertappr invert binvert mulmod_bnm1 sqrmod_bnm1                       \
+  div_qr_1 div_qr_1n_pi1                                                  \
   div_qr_2 div_qr_2n_pi1 div_qr_2u_pi1                                    \
   sbpi1_div_q sbpi1_div_qr sbpi1_divappr_q                                \
   dcpi1_div_q dcpi1_div_qr dcpi1_divappr_q                                \
@@ -26643,11 +24083,12 @@ gmp_mpn_functions="$extra_functions                                      \
   dcpi1_bdiv_q dcpi1_bdiv_qr                                              \
   mu_bdiv_q mu_bdiv_qr                                                    \
   bdiv_q bdiv_qr broot brootinv bsqrt bsqrtinv                            \
-  divexact bdiv_dbm1c redc_1 redc_2 redc_n powm powlo powm_sec            \
-  sb_div_qr_sec sb_div_r_sec sbpi1_div_qr_sec sbpi1_div_r_sec             \
+  divexact bdiv_dbm1c redc_1 redc_2 redc_n powm powlo sec_powm            \
+  sec_mul sec_sqr sec_div_qr sec_div_r sec_pi1_div_qr sec_pi1_div_r       \
+  sec_add_1 sec_sub_1 sec_invert                                          \
   trialdiv remove                                                         \
   and_n andn_n nand_n ior_n iorn_n nior_n xor_n xnor_n                    \
-  copyi copyd zero tabselect                                              \
+  copyi copyd zero sec_tabselect                                          \
   comb_tables                                                             \
   $gmp_mpn_functions_optional"
 
@@ -26906,36 +24347,40 @@ case $tmp_fn in
                     tmp_mulfunc="aors_err2_n" ;;
   add_err3_n|sub_err3_n)
                     tmp_mulfunc="aors_err3_n" ;;
-  addcnd_n|subcnd_n) tmp_mulfunc="aorscnd_n"   ;;
+  cnd_add_n|cnd_sub_n) tmp_mulfunc="cnd_aors_n"   ;;
+  sec_add_1|sec_sub_1) tmp_mulfunc="sec_aors_1"   ;;
   addmul_1|submul_1) tmp_mulfunc="aorsmul_1" ;;
+  mul_2|addmul_2)    tmp_mulfunc="aormul_2" ;;
+  mul_3|addmul_3)    tmp_mulfunc="aormul_3" ;;
+  mul_4|addmul_4)    tmp_mulfunc="aormul_4" ;;
   popcount|hamdist)  tmp_mulfunc="popham"    ;;
   and_n|andn_n|nand_n | ior_n|iorn_n|nior_n | xor_n|xnor_n)
                      tmp_mulfunc="logops_n"  ;;
   lshift|rshift)     tmp_mulfunc="lorrshift";;
   addlsh1_n)
-                    tmp_mulfunc="aorslsh1_n aorrlsh1_n";;
+                    tmp_mulfunc="aorslsh1_n aorrlsh1_n aorsorrlsh1_n";;
   sublsh1_n)
-                    tmp_mulfunc="aorslsh1_n sorrlsh1_n";;
+                    tmp_mulfunc="aorslsh1_n sorrlsh1_n aorsorrlsh1_n";;
   rsblsh1_n)
-                    tmp_mulfunc="aorrlsh1_n sorrlsh1_n";;
+                    tmp_mulfunc="aorrlsh1_n sorrlsh1_n aorsorrlsh1_n";;
   addlsh2_n)
-                    tmp_mulfunc="aorslsh2_n aorrlsh2_n";;
+                    tmp_mulfunc="aorslsh2_n aorrlsh2_n aorsorrlsh2_n";;
   sublsh2_n)
-                    tmp_mulfunc="aorslsh2_n sorrlsh2_n";;
+                    tmp_mulfunc="aorslsh2_n sorrlsh2_n aorsorrlsh2_n";;
   rsblsh2_n)
-                    tmp_mulfunc="aorrlsh2_n sorrlsh2_n";;
+                    tmp_mulfunc="aorrlsh2_n sorrlsh2_n aorsorrlsh2_n";;
   addlsh_n)
-                    tmp_mulfunc="aorslsh_n aorrlsh_n";;
+                    tmp_mulfunc="aorslsh_n aorrlsh_n aorsorrlsh_n";;
   sublsh_n)
-                    tmp_mulfunc="aorslsh_n sorrlsh_n";;
+                    tmp_mulfunc="aorslsh_n sorrlsh_n aorsorrlsh_n";;
   rsblsh_n)
-                    tmp_mulfunc="aorrlsh_n sorrlsh_n";;
+                    tmp_mulfunc="aorrlsh_n sorrlsh_n aorsorrlsh_n";;
   rsh1add_n|rsh1sub_n)
                     tmp_mulfunc="rsh1aors_n";;
-  sb_div_qr_sec|sb_div_r_sec)
-                    tmp_mulfunc="sb_div_sec";;
-  sbpi1_div_qr_sec|sbpi1_div_r_sec)
-                    tmp_mulfunc="sbpi1_div_sec";;
+  sec_div_qr|sec_div_r)
+                    tmp_mulfunc="sec_div";;
+  sec_pi1_div_qr|sec_pi1_div_r)
+                    tmp_mulfunc="sec_pi1_div";;
 esac
 
 
@@ -27096,36 +24541,40 @@ case $tmp_fn in
                     tmp_mulfunc="aors_err2_n" ;;
   add_err3_n|sub_err3_n)
                     tmp_mulfunc="aors_err3_n" ;;
-  addcnd_n|subcnd_n) tmp_mulfunc="aorscnd_n"   ;;
+  cnd_add_n|cnd_sub_n) tmp_mulfunc="cnd_aors_n"   ;;
+  sec_add_1|sec_sub_1) tmp_mulfunc="sec_aors_1"   ;;
   addmul_1|submul_1) tmp_mulfunc="aorsmul_1" ;;
+  mul_2|addmul_2)    tmp_mulfunc="aormul_2" ;;
+  mul_3|addmul_3)    tmp_mulfunc="aormul_3" ;;
+  mul_4|addmul_4)    tmp_mulfunc="aormul_4" ;;
   popcount|hamdist)  tmp_mulfunc="popham"    ;;
   and_n|andn_n|nand_n | ior_n|iorn_n|nior_n | xor_n|xnor_n)
                      tmp_mulfunc="logops_n"  ;;
   lshift|rshift)     tmp_mulfunc="lorrshift";;
   addlsh1_n)
-                    tmp_mulfunc="aorslsh1_n aorrlsh1_n";;
+                    tmp_mulfunc="aorslsh1_n aorrlsh1_n aorsorrlsh1_n";;
   sublsh1_n)
-                    tmp_mulfunc="aorslsh1_n sorrlsh1_n";;
+                    tmp_mulfunc="aorslsh1_n sorrlsh1_n aorsorrlsh1_n";;
   rsblsh1_n)
-                    tmp_mulfunc="aorrlsh1_n sorrlsh1_n";;
+                    tmp_mulfunc="aorrlsh1_n sorrlsh1_n aorsorrlsh1_n";;
   addlsh2_n)
-                    tmp_mulfunc="aorslsh2_n aorrlsh2_n";;
+                    tmp_mulfunc="aorslsh2_n aorrlsh2_n aorsorrlsh2_n";;
   sublsh2_n)
-                    tmp_mulfunc="aorslsh2_n sorrlsh2_n";;
+                    tmp_mulfunc="aorslsh2_n sorrlsh2_n aorsorrlsh2_n";;
   rsblsh2_n)
-                    tmp_mulfunc="aorrlsh2_n sorrlsh2_n";;
+                    tmp_mulfunc="aorrlsh2_n sorrlsh2_n aorsorrlsh2_n";;
   addlsh_n)
-                    tmp_mulfunc="aorslsh_n aorrlsh_n";;
+                    tmp_mulfunc="aorslsh_n aorrlsh_n aorsorrlsh_n";;
   sublsh_n)
-                    tmp_mulfunc="aorslsh_n sorrlsh_n";;
+                    tmp_mulfunc="aorslsh_n sorrlsh_n aorsorrlsh_n";;
   rsblsh_n)
-                    tmp_mulfunc="aorrlsh_n sorrlsh_n";;
+                    tmp_mulfunc="aorrlsh_n sorrlsh_n aorsorrlsh_n";;
   rsh1add_n|rsh1sub_n)
                     tmp_mulfunc="rsh1aors_n";;
-  sb_div_qr_sec|sb_div_r_sec)
-                    tmp_mulfunc="sb_div_sec";;
-  sbpi1_div_qr_sec|sbpi1_div_r_sec)
-                    tmp_mulfunc="sbpi1_div_sec";;
+  sec_div_qr|sec_div_r)
+                    tmp_mulfunc="sec_div";;
+  sec_pi1_div_qr|sec_pi1_div_r)
+                    tmp_mulfunc="sec_pi1_div";;
 esac
 
 
@@ -27272,7 +24721,9 @@ define(dollarhash,``$#'')ifelse(dollarhash(x),1,`define(t1,Y)',
 ``bad: $# not supported (SunOS /usr/bin/m4)
 '')ifelse(eval(89),89,`define(t2,Y)',
 `bad: eval() doesnt support 8 or 9 in a constant (OpenBSD 2.6 m4)
-')ifelse(t1`'t2,YY,`good
+')ifelse(eval(9,9),10,`define(t3,Y)',
+`bad: eval() doesnt support radix in eval (FreeBSD 8.x,9.0,9.1,9.2 m4)
+')ifelse(t1`'t2`'t3,YYY,`good
 ')
 EOF
   echo "trying m4" >&5
@@ -28291,6 +25742,23 @@ echo "define(<WANT_R_REGISTERS>,<$gmp_cv_asm_powerpc_r_registers>)" >> $gmp_tmpc
 
 echo "include_mpn(\`powerpc32/powerpc-defs.m4')" >> $gmp_tmpconfigm4i
 
+
+      # Check for Linux ELFv2 ABI
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#if _CALL_ELF == 2
+yes
+#endif
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "yes" >/dev/null 2>&1; then :
+
+echo "define(<ELFv2_ABI>)" >> $gmp_tmpconfigm4
+
+fi
+rm -f conftest*
+
+
       case $host in
         *-*-aix*)
          case $ABI in
@@ -28375,8 +25843,86 @@ echo "define(<HAVE_REGISTER>,<$gmp_cv_asm_sparc_register>)" >> $gmp_tmpconfigm4
 
           ;;
       esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the assembler accepts gotdata relocations" >&5
+$as_echo_n "checking if the assembler accepts gotdata relocations... " >&6; }
+if ${gmp_cv_asm_sparc_gotdata+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.s <<EOF
+       $gmp_cv_asm_text
+       .text
+       sethi   %gdop_hix22(symbol), %g1
+       or      %g1, %gdop_lox10(symbol), %g1
+
+EOF
+gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
+if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+  (eval $gmp_assemble) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  cat conftest.out >&5
+  gmp_cv_asm_sparc_gotdata=yes
+else
+  cat conftest.out >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.s >&5
+  gmp_cv_asm_sparc_gotdata=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_sparc_gotdata" >&5
+$as_echo "$gmp_cv_asm_sparc_gotdata" >&6; }
+
+
+echo "define(<HAVE_GOTDATA>,<$gmp_cv_asm_sparc_gotdata>)" >> $gmp_tmpconfigm4
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the assembler can support shared PIC thunks" >&5
+$as_echo_n "checking if the assembler can support shared PIC thunks... " >&6; }
+if ${gmp_cv_asm_sparc_shared_thunks+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.s <<EOF
+       $gmp_cv_asm_text
+       .section        .text.__sparc_get_pc_thunk.l7,"axG",@progbits,__sparc_get_pc_thunk.l7,comdat
+       .weak   __sparc_get_pc_thunk.l7
+       .hidden __sparc_get_pc_thunk.l7
+       .type   __sparc_get_pc_thunk.l7, #function
+__sparc_get_pc_thunk.l7:
+       jmp     %o7+8
+        add    %o7, %l7, %l7
+
+EOF
+gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
+if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+  (eval $gmp_assemble) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  cat conftest.out >&5
+  gmp_cv_asm_sparc_shared_thunks=yes
+else
+  cat conftest.out >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.s >&5
+  gmp_cv_asm_sparc_shared_thunks=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_sparc_shared_thunks" >&5
+$as_echo "$gmp_cv_asm_sparc_shared_thunks" >&6; }
+
+
+echo "define(<HAVE_SHARED_THUNKS>,<$gmp_cv_asm_sparc_shared_thunks>)" >> $gmp_tmpconfigm4
+
+
       ;;
-    i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-* | athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | bulldozer-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*)
+    i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-* | athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar-*-* | bulldozer-*-* | piledriver-*-* | steamroller-*-* | excavator-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*)
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the .align directive accepts an 0x90 fill in .text" >&5
 $as_echo_n "checking if the .align directive accepts an 0x90 fill in .text... " >&6; }
@@ -28397,7 +25943,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
   test $ac_status = 0; }; then
   cat conftest.out >&5
   if grep "Warning: Fill parameter ignored for executable section" conftest.out >/dev/null; then
-  echo "Supressing this warning by omitting 0x90" 1>&5
+  echo "Suppressing this warning by omitting 0x90" 1>&5
   gmp_cv_asm_align_fill_0x90=no
 else
   gmp_cv_asm_align_fill_0x90=yes
@@ -28687,6 +26233,10 @@ echo "include_mpn(\`x86_64/darwin.m4')" >> $gmp_tmpconfigm4i
            *-*-mingw* | *-*-cygwin)
 
 echo "include_mpn(\`x86_64/dos64.m4')" >> $gmp_tmpconfigm4i
+ ;;
+           *-openbsd*)
+
+echo "define(<OPENBSD>,1)" >> $gmp_tmpconfigm4
  ;;
          esac
           ;;
@@ -30111,7 +27661,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 GNU MP $as_me 5.1.3, which was
+This file was extended by GNU MP $as_me 6.0.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -30175,7 +27725,7 @@ $config_links
 Configuration commands:
 $config_commands
 
-Report bugs to <gmp-bugs@gmplib.org, see http://gmplib.org/manual/Reporting-Bugs.html>.
+Report bugs to <gmp-bugs@gmplib.org, see https://gmplib.org/manual/Reporting-Bugs.html>.
 GNU MP home page: <http://www.gnu.org/software/gmp/>.
 General help using GNU software: <http://www.gnu.org/gethelp/>."
 
@@ -30183,7 +27733,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="\\
-GNU MP config.status 5.1.3
+GNU MP config.status 6.0.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -30449,101 +27999,53 @@ predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`'
 postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`'
 compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`'
 LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`'
-LD_F77='`$ECHO "$LD_F77" | $SED "$delay_single_quote_subst"`'
 reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`'
-reload_flag_F77='`$ECHO "$reload_flag_F77" | $SED "$delay_single_quote_subst"`'
 reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-reload_cmds_F77='`$ECHO "$reload_cmds_F77" | $SED "$delay_single_quote_subst"`'
 old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-old_archive_cmds_F77='`$ECHO "$old_archive_cmds_F77" | $SED "$delay_single_quote_subst"`'
 compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`'
-compiler_F77='`$ECHO "$compiler_F77" | $SED "$delay_single_quote_subst"`'
 GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`'
-GCC_F77='`$ECHO "$GCC_F77" | $SED "$delay_single_quote_subst"`'
 lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag_F77='`$ECHO "$lt_prog_compiler_no_builtin_flag_F77" | $SED "$delay_single_quote_subst"`'
 lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_pic_F77='`$ECHO "$lt_prog_compiler_pic_F77" | $SED "$delay_single_quote_subst"`'
 lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_wl_F77='`$ECHO "$lt_prog_compiler_wl_F77" | $SED "$delay_single_quote_subst"`'
 lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_static_F77='`$ECHO "$lt_prog_compiler_static_F77" | $SED "$delay_single_quote_subst"`'
 lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o_F77='`$ECHO "$lt_cv_prog_compiler_c_o_F77" | $SED "$delay_single_quote_subst"`'
 archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`'
-archive_cmds_need_lc_F77='`$ECHO "$archive_cmds_need_lc_F77" | $SED "$delay_single_quote_subst"`'
 enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes_F77='`$ECHO "$enable_shared_with_static_runtimes_F77" | $SED "$delay_single_quote_subst"`'
 export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
-export_dynamic_flag_spec_F77='`$ECHO "$export_dynamic_flag_spec_F77" | $SED "$delay_single_quote_subst"`'
 whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
-whole_archive_flag_spec_F77='`$ECHO "$whole_archive_flag_spec_F77" | $SED "$delay_single_quote_subst"`'
 compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`'
-compiler_needs_object_F77='`$ECHO "$compiler_needs_object_F77" | $SED "$delay_single_quote_subst"`'
 old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-old_archive_from_new_cmds_F77='`$ECHO "$old_archive_from_new_cmds_F77" | $SED "$delay_single_quote_subst"`'
 old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds_F77='`$ECHO "$old_archive_from_expsyms_cmds_F77" | $SED "$delay_single_quote_subst"`'
 archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-archive_cmds_F77='`$ECHO "$archive_cmds_F77" | $SED "$delay_single_quote_subst"`'
 archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-archive_expsym_cmds_F77='`$ECHO "$archive_expsym_cmds_F77" | $SED "$delay_single_quote_subst"`'
 module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-module_cmds_F77='`$ECHO "$module_cmds_F77" | $SED "$delay_single_quote_subst"`'
 module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-module_expsym_cmds_F77='`$ECHO "$module_expsym_cmds_F77" | $SED "$delay_single_quote_subst"`'
 with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`'
-with_gnu_ld_F77='`$ECHO "$with_gnu_ld_F77" | $SED "$delay_single_quote_subst"`'
 allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
-allow_undefined_flag_F77='`$ECHO "$allow_undefined_flag_F77" | $SED "$delay_single_quote_subst"`'
 no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
-no_undefined_flag_F77='`$ECHO "$no_undefined_flag_F77" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_F77='`$ECHO "$hardcode_libdir_flag_spec_F77" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_separator_F77='`$ECHO "$hardcode_libdir_separator_F77" | $SED "$delay_single_quote_subst"`'
 hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_direct_F77='`$ECHO "$hardcode_direct_F77" | $SED "$delay_single_quote_subst"`'
 hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_direct_absolute_F77='`$ECHO "$hardcode_direct_absolute_F77" | $SED "$delay_single_quote_subst"`'
 hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_minus_L_F77='`$ECHO "$hardcode_minus_L_F77" | $SED "$delay_single_quote_subst"`'
 hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_shlibpath_var_F77='`$ECHO "$hardcode_shlibpath_var_F77" | $SED "$delay_single_quote_subst"`'
 hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_automatic_F77='`$ECHO "$hardcode_automatic_F77" | $SED "$delay_single_quote_subst"`'
 inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`'
-inherit_rpath_F77='`$ECHO "$inherit_rpath_F77" | $SED "$delay_single_quote_subst"`'
 link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`'
-link_all_deplibs_F77='`$ECHO "$link_all_deplibs_F77" | $SED "$delay_single_quote_subst"`'
 always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`'
-always_export_symbols_F77='`$ECHO "$always_export_symbols_F77" | $SED "$delay_single_quote_subst"`'
 export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-export_symbols_cmds_F77='`$ECHO "$export_symbols_cmds_F77" | $SED "$delay_single_quote_subst"`'
 exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
-exclude_expsyms_F77='`$ECHO "$exclude_expsyms_F77" | $SED "$delay_single_quote_subst"`'
 include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
-include_expsyms_F77='`$ECHO "$include_expsyms_F77" | $SED "$delay_single_quote_subst"`'
 prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-prelink_cmds_F77='`$ECHO "$prelink_cmds_F77" | $SED "$delay_single_quote_subst"`'
 postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-postlink_cmds_F77='`$ECHO "$postlink_cmds_F77" | $SED "$delay_single_quote_subst"`'
 file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`'
-file_list_spec_F77='`$ECHO "$file_list_spec_F77" | $SED "$delay_single_quote_subst"`'
 hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_action_F77='`$ECHO "$hardcode_action_F77" | $SED "$delay_single_quote_subst"`'
 compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`'
-compiler_lib_search_dirs_F77='`$ECHO "$compiler_lib_search_dirs_F77" | $SED "$delay_single_quote_subst"`'
 predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`'
-predep_objects_F77='`$ECHO "$predep_objects_F77" | $SED "$delay_single_quote_subst"`'
 postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`'
-postdep_objects_F77='`$ECHO "$postdep_objects_F77" | $SED "$delay_single_quote_subst"`'
 predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`'
-predeps_F77='`$ECHO "$predeps_F77" | $SED "$delay_single_quote_subst"`'
 postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`'
-postdeps_F77='`$ECHO "$postdeps_F77" | $SED "$delay_single_quote_subst"`'
 compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`'
-compiler_lib_search_path_F77='`$ECHO "$compiler_lib_search_path_F77" | $SED "$delay_single_quote_subst"`'
 
 LTCC='$LTCC'
 LTCFLAGS='$LTCFLAGS'
@@ -30631,55 +28133,30 @@ predeps \
 postdeps \
 compiler_lib_search_path \
 LD_CXX \
-LD_F77 \
 reload_flag_CXX \
-reload_flag_F77 \
 compiler_CXX \
-compiler_F77 \
 lt_prog_compiler_no_builtin_flag_CXX \
-lt_prog_compiler_no_builtin_flag_F77 \
 lt_prog_compiler_pic_CXX \
-lt_prog_compiler_pic_F77 \
 lt_prog_compiler_wl_CXX \
-lt_prog_compiler_wl_F77 \
 lt_prog_compiler_static_CXX \
-lt_prog_compiler_static_F77 \
 lt_cv_prog_compiler_c_o_CXX \
-lt_cv_prog_compiler_c_o_F77 \
 export_dynamic_flag_spec_CXX \
-export_dynamic_flag_spec_F77 \
 whole_archive_flag_spec_CXX \
-whole_archive_flag_spec_F77 \
 compiler_needs_object_CXX \
-compiler_needs_object_F77 \
 with_gnu_ld_CXX \
-with_gnu_ld_F77 \
 allow_undefined_flag_CXX \
-allow_undefined_flag_F77 \
 no_undefined_flag_CXX \
-no_undefined_flag_F77 \
 hardcode_libdir_flag_spec_CXX \
-hardcode_libdir_flag_spec_F77 \
 hardcode_libdir_separator_CXX \
-hardcode_libdir_separator_F77 \
 exclude_expsyms_CXX \
-exclude_expsyms_F77 \
 include_expsyms_CXX \
-include_expsyms_F77 \
 file_list_spec_CXX \
-file_list_spec_F77 \
 compiler_lib_search_dirs_CXX \
-compiler_lib_search_dirs_F77 \
 predep_objects_CXX \
-predep_objects_F77 \
 postdep_objects_CXX \
-postdep_objects_F77 \
 predeps_CXX \
-predeps_F77 \
 postdeps_CXX \
-postdeps_F77 \
-compiler_lib_search_path_CXX \
-compiler_lib_search_path_F77; do
+compiler_lib_search_path_CXX; do
     case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
       eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
@@ -30711,27 +28188,16 @@ finish_cmds \
 sys_lib_search_path_spec \
 sys_lib_dlsearch_path_spec \
 reload_cmds_CXX \
-reload_cmds_F77 \
 old_archive_cmds_CXX \
-old_archive_cmds_F77 \
 old_archive_from_new_cmds_CXX \
-old_archive_from_new_cmds_F77 \
 old_archive_from_expsyms_cmds_CXX \
-old_archive_from_expsyms_cmds_F77 \
 archive_cmds_CXX \
-archive_cmds_F77 \
 archive_expsym_cmds_CXX \
-archive_expsym_cmds_F77 \
 module_cmds_CXX \
-module_cmds_F77 \
 module_expsym_cmds_CXX \
-module_expsym_cmds_F77 \
 export_symbols_cmds_CXX \
-export_symbols_cmds_F77 \
 prelink_cmds_CXX \
-prelink_cmds_F77 \
-postlink_cmds_CXX \
-postlink_cmds_F77; do
+postlink_cmds_CXX; do
     case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
       eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
@@ -30764,8 +28230,6 @@ fi
 
 
 
-
-
 _ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
@@ -31481,7 +28945,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
 
 
 # The names of the tagged configurations supported by this script.
-available_tags="CXX F77 "
+available_tags="CXX "
 
 # ### BEGIN LIBTOOL CONFIG
 
@@ -32230,159 +29694,6 @@ compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
 # ### END LIBTOOL TAG CONFIG: CXX
 _LT_EOF
 
-
-    cat <<_LT_EOF >> "$ofile"
-
-# ### BEGIN LIBTOOL TAG CONFIG: F77
-
-# The linker used to build libraries.
-LD=$lt_LD_F77
-
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag_F77
-reload_cmds=$lt_reload_cmds_F77
-
-# Commands used to build an old-style archive.
-old_archive_cmds=$lt_old_archive_cmds_F77
-
-# A language specific compiler.
-CC=$lt_compiler_F77
-
-# Is the compiler the GNU compiler?
-with_gcc=$GCC_F77
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77
-
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic_F77
-
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl_F77
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$lt_lt_prog_compiler_static_F77
-
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77
-
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=$archive_cmds_need_lc_F77
-
-# Whether or not to disallow shared libs when runtime libs are static.
-allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77
-
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77
-
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77
-
-# Whether the compiler copes with passing no objects directly.
-compiler_needs_object=$lt_compiler_needs_object_F77
-
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77
-
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77
-
-# Commands used to build a shared archive.
-archive_cmds=$lt_archive_cmds_F77
-archive_expsym_cmds=$lt_archive_expsym_cmds_F77
-
-# Commands used to build a loadable module if different from building
-# a shared archive.
-module_cmds=$lt_module_cmds_F77
-module_expsym_cmds=$lt_module_expsym_cmds_F77
-
-# Whether we are building with GNU ld or not.
-with_gnu_ld=$lt_with_gnu_ld_F77
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$lt_allow_undefined_flag_F77
-
-# Flag that enforces no undefined symbols.
-no_undefined_flag=$lt_no_undefined_flag_F77
-
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist
-hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77
-
-# Whether we need a single "-rpath" flag with a separated argument.
-hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77
-
-# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
-# DIR into the resulting binary.
-hardcode_direct=$hardcode_direct_F77
-
-# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
-# DIR into the resulting binary and the resulting library dependency is
-# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
-# library is relocated.
-hardcode_direct_absolute=$hardcode_direct_absolute_F77
-
-# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
-# into the resulting binary.
-hardcode_minus_L=$hardcode_minus_L_F77
-
-# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
-# into the resulting binary.
-hardcode_shlibpath_var=$hardcode_shlibpath_var_F77
-
-# Set to "yes" if building a shared library automatically hardcodes DIR
-# into the library and all subsequent libraries and executables linked
-# against it.
-hardcode_automatic=$hardcode_automatic_F77
-
-# Set to yes if linker adds runtime paths of dependent libraries
-# to runtime path list.
-inherit_rpath=$inherit_rpath_F77
-
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=$link_all_deplibs_F77
-
-# Set to "yes" if exported symbols are required.
-always_export_symbols=$always_export_symbols_F77
-
-# The commands to list exported symbols.
-export_symbols_cmds=$lt_export_symbols_cmds_F77
-
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms=$lt_exclude_expsyms_F77
-
-# Symbols that must always be exported.
-include_expsyms=$lt_include_expsyms_F77
-
-# Commands necessary for linking programs (against libraries) with templates.
-prelink_cmds=$lt_prelink_cmds_F77
-
-# Commands necessary for finishing linking programs.
-postlink_cmds=$lt_postlink_cmds_F77
-
-# Specify filename containing input files.
-file_list_spec=$lt_file_list_spec_F77
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=$hardcode_action_F77
-
-# The directories searched by this compiler when creating a shared library.
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_F77
-
-# Dependencies to place before and after the objects being linked to
-# create a shared library.
-predep_objects=$lt_predep_objects_F77
-postdep_objects=$lt_postdep_objects_F77
-predeps=$lt_predeps_F77
-postdeps=$lt_postdeps_F77
-
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path=$lt_compiler_lib_search_path_F77
-
-# ### END LIBTOOL TAG CONFIG: F77
-_LT_EOF
-
  ;;
 
   esac
index 2e559b1af2a73981ae06589d3232aafefd7aa198..64b2c50957f1e04887eb3c6293d8ac5123174bbb 100644 (file)
@@ -3,23 +3,33 @@ dnl  Process this file with autoconf to produce a configure script.
 
 define(GMP_COPYRIGHT,[[
 
-Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Copyright 1996-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 ]])
 
 AC_COPYRIGHT(GMP_COPYRIGHT)
@@ -27,7 +37,7 @@ AH_TOP(/*GMP_COPYRIGHT*/)
 
 AC_REVISION($Revision$)
 AC_PREREQ(2.59)
-AC_INIT(GNU MP, GMP_VERSION, [gmp-bugs@gmplib.org, see http://gmplib.org/manual/Reporting-Bugs.html], gmp)
+AC_INIT(GNU MP, GMP_VERSION, [gmp-bugs@gmplib.org, see https://gmplib.org/manual/Reporting-Bugs.html], gmp)
 AC_CONFIG_SRCDIR(gmp-impl.h)
 m4_pattern_forbid([^[ \t]*GMP_])
 m4_pattern_allow(GMP_LDFLAGS)
@@ -36,6 +46,7 @@ m4_pattern_allow(GMP_MPARAM_H_SUGGEST)
 m4_pattern_allow(GMP_NAIL_BITS)
 m4_pattern_allow(GMP_NUMB_BITS)
 m4_pattern_allow(GMP_NONSTD_ABI)
+m4_pattern_allow(GMP_CPU_TYPE)
 
 # If --target is not used then $target_alias is empty, but if say
 # "./configure athlon-pc-freebsd3.5" is used, then all three of
@@ -248,10 +259,28 @@ esac],
 [enable_minithres=no])
 
 
+AC_ARG_ENABLE(fake-cpuid,
+AC_HELP_STRING([--enable-fake-cpuid],[enable GMP_CPU_TYPE faking cpuid [[default=no]]]),
+[case $enableval in
+yes|no) ;;
+*) AC_MSG_ERROR([bad value $enableval for --enable-fake-cpuid, need yes or no]) ;;
+esac],
+[enable_fake_cpuid=no])
+
+if test "$enable_fake_cpuid" = "yes"; then
+  AC_DEFINE(WANT_FAKE_CPUID,1,
+  [Define to 1 to enable GMP_CPU_TYPE faking cpuid, per --enable-fake-cpuid])
+fi
+
+
 if test $enable_fat = yes && test $enable_assembly = no ; then
   AC_MSG_ERROR([when doing a fat build, disabling assembly will not work])
 fi
 
+if test $enable_fake_cpuid = yes && test $enable_fat = no ; then
+  AC_MSG_ERROR([--enable-fake-cpuid requires --enable-fat])
+fi
+
 
 tmp_host=`echo $host_cpu | sed 's/\./_/'`
 AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_$tmp_host)
@@ -429,11 +458,6 @@ AC_SUBST(HAVE_HOST_CPU_FAMILY_powerpc,0)
 
 case $host in
 
-  a29k*-*-*)
-    path="a29k"
-    ;;
-
-
   alpha*-*-*)
     AC_DEFINE(HAVE_HOST_CPU_FAMILY_alpha)
     case $host_cpu in
@@ -446,8 +470,11 @@ case $host in
       *)
         path="alpha" ;;
     esac
-    extra_functions="cntlz"
+    if test "$enable_assembly" = "yes" ; then
+       extra_functions="cntlz"
+    fi
     gcc_cflags_optlist="asm cpu oldas" # need asm ahead of cpu, see below
+    gcc_cflags_maybe="-mieee"
     gcc_cflags_oldas="-Wa,-oldas"     # see GMP_GCC_WA_OLDAS.
 
     # gcc 2.7.2.3 doesn't know any -mcpu= for alpha, apparently.
@@ -569,20 +596,28 @@ case $host in
     ;;
 
 
+  arm64*-*-* | aarch64*-*-*)
+    path="arm64"
+    ;;
+
+
   arm*-*-*)
     gcc_cflags="$gcc_cflags $fomit_frame_pointer"
-    gcc_cflags_optlist="arch tune"
+    gcc_cflags_optlist="arch neon tune"
     gcc_cflags_maybe="-marm"
     gcc_testlist="gcc-arm-umodsi"
     GMP_INCLUDE_MPN(arm/arm-defs.m4)
     CALLING_CONVENTIONS_OBJS='arm32call.lo arm32check.lo'
 
+    # FIXME: We make mandatory compiler options optional here.  We should
+    # either enforce them, or organise to strip paths as the corresponding
+    # options fail.
     case $host_cpu in
-      armsa1 | armv4*)
+      armsa1 | arm9tdmi | armv4*)
        path="arm"
        gcc_cflags_arch="-march=armv4"
        ;;
-      armxscale | arm926 | arm946 | arm966 | arm1026 | armv5*)
+      armxscale | arm9te | arm10 | armv5*)
        path="arm/v5 arm"
        gcc_cflags_arch="-march=armv5"
        ;;
@@ -594,19 +629,42 @@ case $host in
        path="arm/v6t2 arm/v6 arm/v5 arm"
        gcc_cflags_arch="-march=armv6t2"
        ;;
+      armcortexa5 | armv7a*)
+       path="arm/v6t2 arm/v6 arm/v5 arm"
+       gcc_cflags_arch="-march=armv7-a"
+       ;;
+      armcortexa8)
+       path="arm/v6t2 arm/v6 arm/v5 arm"
+       gcc_cflags_arch="-march=armv7-a"
+       gcc_cflags_tune="-mtune=cortex-a8"
+       ;;
+      armcortexa8neon)
+       path="arm/v6t2 arm/v6 arm/v5 arm/neon arm"
+       gcc_cflags_arch="-march=armv7-a"
+       gcc_cflags_neon="-mfpu=neon"
+       gcc_cflags_tune="-mtune=cortex-a8"
+       ;;
       armcortexa9)
        path="arm/v7a/cora9 arm/v6t2 arm/v6 arm/v5 arm"
        gcc_cflags_arch="-march=armv7-a"
        gcc_cflags_tune="-mtune=cortex-a9"
        ;;
+      armcortexa9neon)
+       path="arm/v7a/cora9 arm/v6t2 arm/v6 arm/v5 arm/neon arm"
+       gcc_cflags_arch="-march=armv7-a"
+       gcc_cflags_neon="-mfpu=neon"
+       gcc_cflags_tune="-mtune=cortex-a9"
+       ;;
       armcortexa15)
        path="arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm"
        gcc_cflags_arch="-march=armv7-a"
        gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9"
        ;;
-      armcortexa5 | armcortexa8 | armv7a*)
-       path="arm/v6t2 arm/v6 arm/v5 arm"
+      armcortexa15neon)
+       path="arm/v7a/cora15/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm/neon arm"
        gcc_cflags_arch="-march=armv7-a"
+       gcc_cflags_neon="-mfpu=neon"
+       gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9"
        ;;
       *)
        path="arm"
@@ -615,11 +673,6 @@ case $host in
     ;;
 
 
-  clipper*-*-*)
-    path="clipper"
-    ;;
-
-
   # Fujitsu
   [f30[01]-fujitsu-sysv*])
     cclist="gcc vcc"
@@ -729,11 +782,6 @@ case $host in
     ;;
 
 
-  i960*-*-*)
-    path="i960"
-    ;;
-
-
   IA64_PATTERN)
     abilist="64"
     GMP_INCLUDE_MPN(ia64/ia64-defs.m4)
@@ -841,12 +889,6 @@ case $host in
     ;;
 
 
-  # National Semiconductor 32k
-  ns32k*-*-*)
-    path="ns32k"
-    ;;
-
-
   # IRIX 5 and earlier can only run 32-bit o32.
   #
   # IRIX 6 and up always has a 64-bit mips CPU can run n32 or 64.  n32 is
@@ -1165,11 +1207,6 @@ case $host in
     ;;
 
 
-  pyramid-*-*)
-    path="pyr"
-    ;;
-
-
   # IBM System/390 and z/Architecture
   S390_PATTERN | S390X_PATTERN)
     abilist="32"
@@ -1287,32 +1324,49 @@ case $host in
     # latter would be used in the 64-bit ABI on systems like "*bsd" where
     # abilist="64" only.
     #
-    case $host_cpu in
-      [ultrasparct[345]])
-        gcc_32_cflags="$gcc_cflags -Wa,-xarch=v8plusd" ;;
-      sparc64 | sparcv9* | ultrasparc*)
-        gcc_32_cflags="$gcc_cflags -Wa,-xarch=v8plus" ;;
-    esac
     gcc_32_cflags_maybe="-m32"
-    gcc_cflags_optlist="cpu"
+    gcc_cflags_optlist="cpu asm"
 
     # gcc 2.7.2 knows -mcypress, -msupersparc, -mv8, -msparclite.
     # gcc 2.95 knows -mcpu= v7, hypersparc, sparclite86x, f930, f934,
     #   sparclet, tsc701, v9, ultrasparc.  A warning is given that the
     #   plain -m forms will disappear.
-    # gcc 3.0 adds nothing.
-    # gcc 3.1 adds nothing.
-    # gcc 3.2 adds nothing.
     # gcc 3.3 adds ultrasparc3.
     #
     case $host_cpu in
-      supersparc)           gcc_cflags_cpu="-mcpu=supersparc -msupersparc" ;;
-      sparcv8 | microsparc | turbosparc)
-                           gcc_cflags_cpu="-mcpu=v8 -mv8" ;;
-      sparc64 | sparcv9*)   gcc_cflags_cpu="-mcpu=v9 -mv8" ;;
-      ultrasparc3)          gcc_cflags_cpu="-mcpu=ultrasparc3 -mcpu=ultrasparc -mv8" ;;
-      ultrasparc*)          gcc_cflags_cpu="-mcpu=ultrasparc -mv8" ;;
-      *)                    gcc_cflags_cpu="-mcpu=v7 -mcypress" ;;
+      supersparc*)
+                       gcc_cflags_cpu="-mcpu=supersparc -msupersparc"
+                       gcc_cflags_asm="-Wa,-Av8 -Wa,-xarch=v8";;
+      sparcv8 | microsparc* | turbosparc | hypersparc*)
+                       gcc_cflags_cpu="-mcpu=v8 -mv8"
+                       gcc_cflags_asm="-Wa,-Av8 -Wa,-xarch=v8";;
+      sparc64 | sparcv9*)
+                       gcc_cflags_cpu="-mcpu=v9"
+                       gcc_32_cflags_asm="-Wa,-Av8 -Wa,-xarch=v8plus"
+                       gcc_64_cflags_asm="-Wa,-Av9 -Wa,-xarch=v9";;
+      ultrasparc1 | ultrasparc2*)
+                       gcc_cflags_cpu="-mcpu=ultrasparc -mcpu=v9"
+                       gcc_32_cflags_asm="-Wa,-Av8plusa -Wa,-xarch=v8plusa"
+                       gcc_64_cflags_asm="-Wa,-Av9a -Wa,-xarch=v9a";;
+      [ultrasparc[34]])
+                       gcc_cflags_cpu="-mcpu=ultrasparc3 -mcpu=ultrasparc -mcpu=v9"
+                       gcc_32_cflags_asm="-Wa,-Av8plusb -Wa,-xarch=v8plusb"
+                       gcc_64_cflags_asm="-Wa,-Av9b -Wa,-xarch=v9b";;
+      [ultrasparct[12]])
+                       gcc_cflags_cpu="-mcpu=niagara -mcpu=v9"
+                       gcc_32_cflags_asm="-Wa,-Av8plusc -Wa,-xarch=v8plusc"
+                       gcc_64_cflags_asm="-Wa,-Av9c -Wa,-xarch=v9c";;
+      ultrasparct3)
+                       gcc_cflags_cpu="-mcpu=niagara3 -mcpu=niagara -mcpu=v9"
+                       gcc_32_cflags_asm="-Wa,-Av8plusd -Wa,-xarch=v8plusd"
+                       gcc_64_cflags_asm="-Wa,-Av9d -Wa,-xarch=v9d";;
+      ultrasparct4)
+                       gcc_cflags_cpu="-mcpu=niagara4 -mcpu=niagara3 -mcpu=niagara -mcpu=v9"
+                       gcc_32_cflags_asm="-Wa,-Av8plusd -Wa,-xarch=v8plusd"
+                       gcc_64_cflags_asm="-Wa,-Av9d -Wa,-xarch=v9d";;
+      *)
+                       gcc_cflags_cpu="-mcpu=v7 -mcypress"
+                       gcc_cflags_asm="";;
     esac
 
     # SunPRO cc and acc, and SunOS bundled cc
@@ -1328,11 +1382,14 @@ case $host in
         # SunOS cc doesn't know -xarch, apparently always generating v7
         # code, so make this optional
        case $host_cpu in
-         sparcv8 | microsparc | supersparc | turbosparc)
-                                             cc_cflags_arch="-xarch=v8" ;;
-          [ultrasparct[345]])                 cc_cflags_arch="-xarch=v8plusd" ;;
-         sparc64 | sparcv9* | ultrasparc*)   cc_cflags_arch="-xarch=v8plus" ;;
-         *)                                  cc_cflags_arch="-xarch=v7" ;;
+         sparcv8 | microsparc* | supersparc* | turbosparc | hypersparc*)
+                       cc_cflags_arch="-xarch=v8";;
+          [ultrasparct[345]])
+                       cc_cflags_arch="-xarch=v8plusd" ;;
+         sparc64 | sparcv9* | ultrasparc*)
+                       cc_cflags_arch="-xarch=v8plus" ;;
+         *)
+                       cc_cflags_arch="-xarch=v7" ;;
        esac
 
         # SunOS cc doesn't know -xchip and doesn't seem to have an equivalent.
@@ -1340,17 +1397,21 @@ case $host in
        #   micro2, hyper, hyper2, powerup, ultra, ultra2, ultra2i.
        # SunPRO cc 6 adds -xchip=ultra2e, ultra3cu.
         #
-       # FIXME: Which of ultra, ultra2 or ultra2i is the best fallback for
-       # ultrasparc3?
-       #
        case $host_cpu in
-         supersparc  cc_cflags_cpu="-xchip=super" ;;
-         microsparc  cc_cflags_cpu="-xchip=micro" ;;
+         supersparc*)  cc_cflags_cpu="-xchip=super" ;;
+         microsparc*)  cc_cflags_cpu="-xchip=micro" ;;
          turbosparc)   cc_cflags_cpu="-xchip=micro2" ;;
+         hypersparc*)  cc_cflags_cpu="-xchip=hyper" ;;
          ultrasparc)   cc_cflags_cpu="-xchip=ultra" ;;
-         ultrasparc2)  cc_cflags_cpu="-xchip=ultra2" ;;
-         ultrasparc2i) cc_cflags_cpu="-xchip=ultra2i" ;;
+         ultrasparc2)  cc_cflags_cpu="-xchip=ultra2 -xchip=ultra" ;;
+         ultrasparc2i) cc_cflags_cpu="-xchip=ultra2i -xchip=ultra2 -xchip=ultra" ;;
          ultrasparc3)  cc_cflags_cpu="-xchip=ultra3 -xchip=ultra" ;;
+         ultrasparc4)  cc_cflags_cpu="-xchip=ultra4 -xchip=ultra3 -xchip=ultra" ;;
+         ultrasparct1) cc_cflags_cpu="-xchip=ultraT1" ;;
+         ultrasparct2) cc_cflags_cpu="-xchip=ultraT2 -xchip=ultraT1" ;;
+         ultrasparct3) cc_cflags_cpu="-xchip=ultraT3 -xchip=ultraT2" ;;
+         ultrasparct4) cc_cflags_cpu="-xchip=T4" ;;
+         ultrasparct5) cc_cflags_cpu="-xchip=T5 -xchip=T4" ;;
          *)            cc_cflags_cpu="-xchip=generic" ;;
        esac
     esac
@@ -1387,8 +1448,10 @@ case $host in
            path_64="sparc64/ultrasparc1234 sparc64" ;;
          [ultrasparc[34]])
            path_64="sparc64/ultrasparc34 sparc64/ultrasparc1234 sparc64" ;;
-         [ultrasparct[12345]])
+         [ultrasparct[12]])
            path_64="sparc64/ultrasparct1 sparc64" ;;
+         [ultrasparct[345]])
+           path_64="sparc64/ultrasparct3 sparc64" ;;
          *)
            path_64="sparc64"
        esac
@@ -1409,7 +1472,7 @@ case $host in
         #
         gcc_64_cflags="$gcc_cflags -m64 -mptr64"
         gcc_64_ldflags="-Wc,-m64"
-        gcc_64_cflags_optlist="cpu"
+        gcc_64_cflags_optlist="cpu asm"
 
         case $host in
           *-*-solaris*)
@@ -1420,8 +1483,13 @@ case $host in
             # -fast is documented as miscompiling things for the sake of speed.
             #
             cclist_64="$cclist_64 cc"
-            cc_64_cflags="-xO3 -xarch=v9"
             cc_64_cflags_optlist="cpu"
+            case $host_cpu in
+              [ultrasparct[345]])
+                cc_64_cflags="$cc_64_cflags -xO3 -xarch=v9d" ;;
+              *)
+                cc_64_cflags="-xO3 -xarch=v9" ;;
+            esac
             ;;
         esac
 
@@ -1536,7 +1604,7 @@ case $host in
       pentiummmx)
        gcc_cflags_cpu="-mtune=pentium-mmx -mcpu=pentium-mmx -mcpu=pentium -m486"
        gcc_cflags_arch="-march=pentium-mmx -march=pentium"
-       path="x86/pentium/mmx x86/pentium x86"
+       path="x86/pentium/mmx x86/pentium x86/mmx x86"
        ;;
       i686 | pentiumpro)
        gcc_cflags_cpu="-mtune=pentiumpro -mcpu=pentiumpro -mcpu=i486 -m486"
@@ -1546,37 +1614,37 @@ case $host in
       pentium2)
        gcc_cflags_cpu="-mtune=pentium2 -mcpu=pentium2 -mcpu=pentiumpro -mcpu=i486 -m486"
        gcc_cflags_arch="-march=pentium2 -march=pentiumpro -march=pentium"
-       path="x86/p6/mmx x86/p6 x86"
+       path="x86/p6/mmx x86/p6 x86/mmx x86"
        ;;
       pentium3)
        gcc_cflags_cpu="-mtune=pentium3 -mcpu=pentium3 -mcpu=pentiumpro -mcpu=i486 -m486"
        gcc_cflags_arch="-march=pentium3 -march=pentiumpro -march=pentium"
-       path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
+       path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
        ;;
       pentiumm)
        gcc_cflags_cpu="-mtune=pentium3 -mcpu=pentium3 -mcpu=pentiumpro -mcpu=i486 -m486"
        gcc_cflags_arch="-march=pentium3 -march=pentiumpro -march=pentium"
-       path="x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
+       path="x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
        ;;
       k6)
        gcc_cflags_cpu="-mtune=k6 -mcpu=k6 -mcpu=i486 -m486"
        gcc_cflags_arch="-march=k6"
-       path="x86/k6/mmx x86/k6 x86"
+       path="x86/k6/mmx x86/k6 x86/mmx x86"
        ;;
       k62)
        gcc_cflags_cpu="-mtune=k6-2 -mcpu=k6-2 -mcpu=k6 -mcpu=i486 -m486"
        gcc_cflags_arch="-march=k6-2 -march=k6"
-       path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86"
+       path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86/mmx x86"
        ;;
       k63)
        gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486"
        gcc_cflags_arch="-march=k6-3 -march=k6"
-       path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86"
+       path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86/mmx x86"
        ;;
       geode)
        gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486"
        gcc_cflags_arch="-march=k6-3 -march=k6"
-       path="x86/geode x86/k6/k62mmx x86/k6/mmx x86/k6 x86"
+       path="x86/geode x86/k6/k62mmx x86/k6/mmx x86/k6 x86/mmx x86"
        ;;
       athlon)
        # Athlon instruction costs are close to P6 (3 cycle load latency,
@@ -1584,7 +1652,7 @@ case $host in
        # know athlon (eg. 2.95.2 doesn't) then fall back on pentiumpro.
        gcc_cflags_cpu="-mtune=athlon -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486"
        gcc_cflags_arch="-march=athlon -march=pentiumpro -march=pentium"
-       path="x86/k7/mmx x86/k7 x86"
+       path="x86/k7/mmx x86/k7 x86/mmx x86"
        ;;
       i786 | pentium4)
        # pentiumpro is the primary fallback when gcc doesn't know pentium4.
@@ -1594,7 +1662,7 @@ case $host in
        gcc_cflags_cpu="-mtune=pentium4 -mcpu=pentium4 -mcpu=pentiumpro -mcpu=i486 -m486"
        gcc_cflags_arch="-march=pentium4 -march=pentium4~-mno-sse2 -march=pentiumpro -march=pentium"
        gcc_64_cflags_cpu="-mtune=nocona"
-       path="x86/pentium4/sse2 x86/pentium4/mmx x86/pentium4 x86"
+       path="x86/pentium4/sse2 x86/pentium4/mmx x86/pentium4 x86/mmx x86"
        path_64="x86_64/pentium4 x86_64"
        ;;
       viac32)
@@ -1602,66 +1670,103 @@ case $host in
        # c3-2 has sse and mmx, so pentium3 is good for -march.
        gcc_cflags_cpu="-mtune=c3-2 -mcpu=c3-2 -mcpu=i486 -m486"
        gcc_cflags_arch="-march=c3-2 -march=pentium3 -march=pentiumpro -march=pentium"
-       path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
+       path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
        ;;
       viac3*)
        # Not sure of the best fallbacks here.
        gcc_cflags_cpu="-mtune=c3 -mcpu=c3 -mcpu=i486 -m486"
        gcc_cflags_arch="-march=c3 -march=pentium-mmx -march=pentium"
-       path="x86/pentium/mmx x86/pentium x86"
+       path="x86/pentium/mmx x86/pentium x86/mmx x86"
        ;;
       athlon64 | k8 | x86_64)
        gcc_cflags_cpu="-mtune=k8 -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486"
        gcc_cflags_arch="-march=k8 -march=k8~-mno-sse2 -march=athlon -march=pentiumpro -march=pentium"
-       path="x86/k8 x86/k7/mmx x86/k7 x86"
+       path="x86/k8 x86/k7/mmx x86/k7 x86/mmx x86"
        path_64="x86_64/k8 x86_64"
        ;;
       k10)
        gcc_cflags_cpu="-mtune=amdfam10 -mtune=k8"
        gcc_cflags_arch="-march=amdfam10 -march=k8 -march=k8~-mno-sse2"
-       path="x86/k10 x86/k8 x86/k7/mmx x86/k7 x86"
+       path="x86/k10 x86/k8 x86/k7/mmx x86/k7 x86/mmx x86"
        path_64="x86_64/k10 x86_64/k8 x86_64"
        ;;
       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"
+       path="x86/bobcat x86/k7/mmx x86/k7 x86/mmx x86"
        path_64="x86_64/bobcat x86_64/k10 x86_64/k8 x86_64"
        ;;
+      jaguar)
+       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"
+       ;;
       bulldozer | bd1)
        gcc_cflags_cpu="-mtune=bdver1 -mtune=amdfam10 -mtune=k8"
        gcc_cflags_arch="-march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
-       path="x86/bd1 x86/k7/mmx x86/k7 x86"
+       path="x86/bd1 x86/k7/mmx x86/k7 x86/mmx x86"
        path_64="x86_64/bd1 x86_64/k10 x86_64/k8 x86_64"
        ;;
+      piledriver | bd2)
+       gcc_cflags_cpu="-mtune=bdver2 -mtune=bdver1 -mtune=amdfam10 -mtune=k8"
+       gcc_cflags_arch="-march=bdver2 -march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
+       path="x86/bd2 x86/bd1 x86/k7/mmx x86/k7 x86/mmx x86"
+       path_64="x86_64/bd2 x86_64/bd1 x86_64/k10 x86_64/k8 x86_64"
+       ;;
+      steamroller | bd3)
+       gcc_cflags_cpu="-mtune=bdver3 -mtune=bdver2 -mtune=bdver1 -mtune=amdfam10 -mtune=k8"
+       gcc_cflags_arch="-march=bdver3 -march=bdver2 -march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
+       path="x86/bd3 x86/bd2 x86/bd1 x86/k7/mmx x86/k7 x86/mmx x86"
+       path_64="x86_64/bd3 x86_64/bd2 x86_64/bd1 x86_64/k10 x86_64/k8 x86_64"
+       ;;
+      excavator | bd4)
+       gcc_cflags_cpu="-mtune=bdver4 -mtune=bdver3 -mtune=bdver2 -mtune=bdver1 -mtune=amdfam10 -mtune=k8"
+       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"
+       ;;
       core2)
        gcc_cflags_cpu="-mtune=core2 -mtune=k8"
        gcc_cflags_arch="-march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
-       path="x86/core2 x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
+       path="x86/core2 x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
        path_64="x86_64/core2 x86_64"
        ;;
       corei | coreinhm | coreiwsm)
        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"
-       path="x86/coreinhm x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
+       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"
        ;;
-      coreisbr | coreihwl | coreibwl)
+      coreisbr)
        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"
-       path="x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
+       path="x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
        path_64="x86_64/coreisbr x86_64/coreinhm x86_64/core2 x86_64"
        ;;
+      coreihwl)
+       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"
+       path="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"
+       ;;
+      coreibwl)
+       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"
+       path="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"
+       # extra_functions_64="missing"   # enable for bmi2/adx simulation
+       ;;
       atom)
        gcc_cflags_cpu="-mtune=atom -mtune=pentium3"
        gcc_cflags_arch="-march=atom -march=pentium3"
-       path="x86/atom/sse2 x86/atom/mmx x86/atom x86"
+       path="x86/atom/sse2 x86/atom/mmx x86/atom x86/mmx x86"
        path_64="x86_64/atom x86_64"
        ;;
       nano)
        gcc_cflags_cpu="-mtune=nano"
        gcc_cflags_arch="-march=nano"
-       path="x86/nano x86"
+       path="x86/nano x86/mmx x86"
        path_64="x86_64/nano x86_64"
        ;;
       *)
@@ -1674,14 +1779,14 @@ case $host in
 
     case $host in
       X86_64_PATTERN)
-       cclist_64="gcc"
+       cclist_64="gcc cc"
        gcc_64_cflags="$gcc_cflags -m64"
        gcc_64_cflags_optlist="cpu arch"
        CALLING_CONVENTIONS_OBJS_64='amd64call.lo amd64check$U.lo'
        SPEED_CYCLECOUNTER_OBJ_64=x86_64.lo
        cyclecounter_size_64=2
 
-       cclist_x32="gcc"
+       cclist_x32="gcc cc"
        gcc_x32_cflags="$gcc_cflags -mx32"
        gcc_x32_cflags_optlist="$gcc_64_cflags_optlist"
        CALLING_CONVENTIONS_OBJS_x32="$CALLING_CONVENTIONS_OBJS_64"
@@ -1693,14 +1798,13 @@ case $host in
 
        abilist="64 x32 32"
        if test "$enable_assembly" = "yes" ; then
-           extra_functions_64="invert_limb_table"
+           extra_functions_64="$extra_functions_64 invert_limb_table"
            extra_functions_x32=$extra_functions_64
        fi
 
        case $host in
          *-*-solaris*)
            # Sun cc.
-           cclist_64="$cclist_64 cc"
            cc_64_cflags="-xO3 -m64"
            ;;
          *-*-mingw* | *-*-cygwin)
@@ -1715,18 +1819,6 @@ case $host in
     ;;
 
 
-  # FIXME: z8kx won't get through config.sub.  Could make 16 versus 32 bit
-  # limb an ABI option perhaps.
-  z8kx*-*-*)
-    path="z8000x"
-    extra_functions="udiv_w_sdiv"
-    ;;
-  z8k*-*-*)
-    path="z8000"
-    extra_functions="udiv_w_sdiv"
-    ;;
-
-
   # Special CPU "none" used to select generic C, now this is obsolete.
   none-*-*)
     enable_assembly=no
@@ -1982,7 +2074,8 @@ case $host in
       gcc_cflags_cpu=""
       gcc_cflags_arch=""
 
-      fat_functions="add_n addmul_1 bdiv_dbm1c com copyd copyi dive_1 divrem_1
+      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
                     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
@@ -2009,7 +2102,7 @@ case $host in
        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/atom x86_64/nano"
+                 x86_64/coreihwl x86_64/atom x86_64/nano"
        fat_functions="$fat_functions addmul_2 addlsh1_n addlsh2_n sublsh1_n"
       fi
 
@@ -2299,6 +2392,12 @@ 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
 
@@ -2447,7 +2546,7 @@ fi
 # FIXME: Rumour has it libtool will one day provide a way for a configure.in
 # to say what it wants from among supported languages etc.
 #
-AC_PROVIDE([AC_PROG_F77])
+#AC_PROVIDE([AC_PROG_F77])
 
 AC_PROG_LIBTOOL
 
@@ -2564,7 +2663,7 @@ AC_C_VOLATILE
 
 AC_C_RESTRICT
 
-GMP_C_STDARG
+GMP_C_STDARG
 GMP_C_ATTRIBUTE_CONST
 GMP_C_ATTRIBUTE_MALLOC
 GMP_C_ATTRIBUTE_MODE
@@ -2691,7 +2790,7 @@ gmp_mpn_functions_optional="umul udiv                                     \
   add_n_sub_n addaddmul_1msb0"
 
 gmp_mpn_functions="$extra_functions                                       \
-  add add_1 add_n sub sub_1 sub_n addcnd_n subcnd_n neg com               \
+  add add_1 add_n sub sub_1 sub_n cnd_add_n cnd_sub_n neg com             \
   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             \
@@ -2700,7 +2799,8 @@ gmp_mpn_functions="$extra_functions                                          \
   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 get_str set_str scan0 scan1 popcount hamdist cmp        \
+  rootrem sqrtrem sizeinbase get_str set_str                              \
+  scan0 scan1 popcount hamdist cmp                                        \
   perfsqr perfpow                                                         \
   gcd_1 gcd gcdext_1 gcdext gcd_subdiv_step                               \
   gcdext_lehmer                                                                   \
@@ -2720,6 +2820,7 @@ gmp_mpn_functions="$extra_functions                                          \
   toom_interpolate_5pts toom_interpolate_6pts toom_interpolate_7pts       \
   toom_interpolate_8pts toom_interpolate_12pts toom_interpolate_16pts     \
   invertappr invert binvert mulmod_bnm1 sqrmod_bnm1                       \
+  div_qr_1 div_qr_1n_pi1                                                  \
   div_qr_2 div_qr_2n_pi1 div_qr_2u_pi1                                    \
   sbpi1_div_q sbpi1_div_qr sbpi1_divappr_q                                \
   dcpi1_div_q dcpi1_div_qr dcpi1_divappr_q                                \
@@ -2729,11 +2830,12 @@ gmp_mpn_functions="$extra_functions                                        \
   dcpi1_bdiv_q dcpi1_bdiv_qr                                              \
   mu_bdiv_q mu_bdiv_qr                                                    \
   bdiv_q bdiv_qr broot brootinv bsqrt bsqrtinv                            \
-  divexact bdiv_dbm1c redc_1 redc_2 redc_n powm powlo powm_sec            \
-  sb_div_qr_sec sb_div_r_sec sbpi1_div_qr_sec sbpi1_div_r_sec             \
+  divexact bdiv_dbm1c redc_1 redc_2 redc_n powm powlo sec_powm            \
+  sec_mul sec_sqr sec_div_qr sec_div_r sec_pi1_div_qr sec_pi1_div_r       \
+  sec_add_1 sec_sub_1 sec_invert                                          \
   trialdiv remove                                                         \
   and_n andn_n nand_n ior_n iorn_n nior_n xor_n xnor_n                    \
-  copyi copyd zero tabselect                                              \
+  copyi copyd zero sec_tabselect                                          \
   comb_tables                                                             \
   $gmp_mpn_functions_optional"
 
@@ -2748,36 +2850,40 @@ case $tmp_fn in
                     tmp_mulfunc="aors_err2_n" ;;
   add_err3_n|sub_err3_n)
                     tmp_mulfunc="aors_err3_n" ;;
-  addcnd_n|subcnd_n) tmp_mulfunc="aorscnd_n"   ;;
+  cnd_add_n|cnd_sub_n) tmp_mulfunc="cnd_aors_n"   ;;
+  sec_add_1|sec_sub_1) tmp_mulfunc="sec_aors_1"   ;;
   addmul_1|submul_1) tmp_mulfunc="aorsmul_1" ;;
+  mul_2|addmul_2)    tmp_mulfunc="aormul_2" ;;
+  mul_3|addmul_3)    tmp_mulfunc="aormul_3" ;;
+  mul_4|addmul_4)    tmp_mulfunc="aormul_4" ;;
   popcount|hamdist)  tmp_mulfunc="popham"    ;;
   and_n|andn_n|nand_n | ior_n|iorn_n|nior_n | xor_n|xnor_n)
                      tmp_mulfunc="logops_n"  ;;
   lshift|rshift)     tmp_mulfunc="lorrshift";;
   addlsh1_n)
-                    tmp_mulfunc="aorslsh1_n aorrlsh1_n";;
+                    tmp_mulfunc="aorslsh1_n aorrlsh1_n aorsorrlsh1_n";;
   sublsh1_n)
-                    tmp_mulfunc="aorslsh1_n sorrlsh1_n";;
+                    tmp_mulfunc="aorslsh1_n sorrlsh1_n aorsorrlsh1_n";;
   rsblsh1_n)
-                    tmp_mulfunc="aorrlsh1_n sorrlsh1_n";;
+                    tmp_mulfunc="aorrlsh1_n sorrlsh1_n aorsorrlsh1_n";;
   addlsh2_n)
-                    tmp_mulfunc="aorslsh2_n aorrlsh2_n";;
+                    tmp_mulfunc="aorslsh2_n aorrlsh2_n aorsorrlsh2_n";;
   sublsh2_n)
-                    tmp_mulfunc="aorslsh2_n sorrlsh2_n";;
+                    tmp_mulfunc="aorslsh2_n sorrlsh2_n aorsorrlsh2_n";;
   rsblsh2_n)
-                    tmp_mulfunc="aorrlsh2_n sorrlsh2_n";;
+                    tmp_mulfunc="aorrlsh2_n sorrlsh2_n aorsorrlsh2_n";;
   addlsh_n)
-                    tmp_mulfunc="aorslsh_n aorrlsh_n";;
+                    tmp_mulfunc="aorslsh_n aorrlsh_n aorsorrlsh_n";;
   sublsh_n)
-                    tmp_mulfunc="aorslsh_n sorrlsh_n";;
+                    tmp_mulfunc="aorslsh_n sorrlsh_n aorsorrlsh_n";;
   rsblsh_n)
-                    tmp_mulfunc="aorrlsh_n sorrlsh_n";;
+                    tmp_mulfunc="aorrlsh_n sorrlsh_n aorsorrlsh_n";;
   rsh1add_n|rsh1sub_n)
                     tmp_mulfunc="rsh1aors_n";;
-  sb_div_qr_sec|sb_div_r_sec)
-                    tmp_mulfunc="sb_div_sec";;
-  sbpi1_div_qr_sec|sbpi1_div_r_sec)
-                    tmp_mulfunc="sbpi1_div_sec";;
+  sec_div_qr|sec_div_r)
+                    tmp_mulfunc="sec_div";;
+  sec_pi1_div_qr|sec_pi1_div_r)
+                    tmp_mulfunc="sec_pi1_div";;
 esac
 ])
 
@@ -3240,7 +3346,6 @@ AH_VERBATIM([HAVE_NATIVE],
 #undef HAVE_NATIVE_mpn_add_n_sub_n
 #undef HAVE_NATIVE_mpn_add_nc
 #undef HAVE_NATIVE_mpn_addaddmul_1msb0
-#undef HAVE_NATIVE_mpn_addcnd_n
 #undef HAVE_NATIVE_mpn_addlsh1_n
 #undef HAVE_NATIVE_mpn_addlsh2_n
 #undef HAVE_NATIVE_mpn_addlsh_n
@@ -3273,9 +3378,12 @@ AH_VERBATIM([HAVE_NATIVE],
 #undef HAVE_NATIVE_mpn_bdiv_dbm1c
 #undef HAVE_NATIVE_mpn_bdiv_q_1
 #undef HAVE_NATIVE_mpn_pi1_bdiv_q_1
+#undef HAVE_NATIVE_mpn_cnd_add_n
+#undef HAVE_NATIVE_mpn_cnd_sub_n
 #undef HAVE_NATIVE_mpn_com
 #undef HAVE_NATIVE_mpn_copyd
 #undef HAVE_NATIVE_mpn_copyi
+#undef HAVE_NATIVE_mpn_div_qr_1n_pi1
 #undef HAVE_NATIVE_mpn_div_qr_2
 #undef HAVE_NATIVE_mpn_divexact_1
 #undef HAVE_NATIVE_mpn_divexact_by3c
@@ -3329,7 +3437,6 @@ AH_VERBATIM([HAVE_NATIVE],
 #undef HAVE_NATIVE_mpn_sqr_diag_addlsh1
 #undef HAVE_NATIVE_mpn_sub_n
 #undef HAVE_NATIVE_mpn_sub_nc
-#undef HAVE_NATIVE_mpn_subcnd_n
 #undef HAVE_NATIVE_mpn_sublsh1_n
 #undef HAVE_NATIVE_mpn_sublsh2_n
 #undef HAVE_NATIVE_mpn_sublsh_n
@@ -3399,6 +3506,14 @@ if test "$gmp_asm_syntax_testing" != no; then
       GMP_ASM_POWERPC_PIC_ALWAYS
       GMP_ASM_POWERPC_R_REGISTERS
       GMP_INCLUDE_MPN(powerpc32/powerpc-defs.m4)
+
+      # Check for Linux ELFv2 ABI
+      AC_EGREP_CPP(yes,
+[#if _CALL_ELF == 2
+yes
+#endif],
+      [GMP_DEFINE_RAW(["define(<ELFv2_ABI>)"])])
+
       case $host in
         *-*-aix*)
          case $ABI in
@@ -3433,6 +3548,8 @@ if test "$gmp_asm_syntax_testing" != no; then
           GMP_ASM_SPARC_REGISTER
           ;;
       esac
+      GMP_ASM_SPARC_GOTDATA
+      GMP_ASM_SPARC_SHARED_THUNKS
       ;;
     X86_PATTERN | X86_64_PATTERN)
       GMP_ASM_ALIGN_FILL_0x90
@@ -3459,6 +3576,8 @@ if test "$gmp_asm_syntax_testing" != no; then
              GMP_INCLUDE_MPN(x86_64/darwin.m4) ;;
            *-*-mingw* | *-*-cygwin)
              GMP_INCLUDE_MPN(x86_64/dos64.m4) ;;
+           *-openbsd*)
+             GMP_DEFINE_RAW(["define(<OPENBSD>,1)"]) ;;
          esac
           ;;
       esac
index a5d51905d660839fbd2d8c15bf7017802c573646..6af8ea3038c85aae831ed5dc5da4b1b88ff7f051 100644 (file)
@@ -1,21 +1,32 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 2001, 2002, 2003, 2012 Free Software Foundation, Inc.
+# Copyright 2001-2003, 2012 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 INCLUDES = -D__GMP_WITHIN_GMPXX -I$(top_srcdir)
index 0e9441772d82eec182051ba2382b3395003bc0e6..6066a76a7d99c8346753fdb113ba54af9164a0bf 100644 (file)
 
 @SET_MAKE@
 
-# Copyright 2001, 2002, 2003, 2012 Free Software Foundation, Inc.
+# Copyright 2001-2003, 2012 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 VPATH = @srcdir@
 am__make_dryrun = \
index 00e470c91e8f1e8a83e53ce9f3b25ca82b308104..8b728caa2d4a03e15d019272480d159e08e0ef94 100644 (file)
@@ -5,17 +5,28 @@ Copyright 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /* some compilers reputedly dislike completely empty files */
index e3ea5ae13676d7e3edb274dc88f0a855a2f032aa..3d349bcfa5fd506043a30cf9f7e3f7ec2724b5e8 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include <cctype>
 #include <iostream>
index 520d4c3e211d7275129aa6062c04dfcfec160aa3..71c2b44d5cd7534e801b5c9e2d8ceedd4787f773 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include <cctype>
 #include <iostream>
@@ -45,7 +56,7 @@ operator>> (istream &i, mpf_ptr f)
   bool ok = false;
 
   // C decimal point, as expected by mpf_set_str
-  const char *lconv_point = localeconv()->decimal_point;
+  const char *lconv_point = GMP_DECIMAL_POINT;
 
   // C++ decimal point
 #if HAVE_STD__LOCALE
index 5cf8c4f94975a4eaaf681a31534cc37f8301802f..bc12e4a228d3b503ce8cba414006df66484a631c 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include <cctype>
 #include <iostream>
index 3afa8368e245b7c147f9ece1c5716667f5a1d047..e4775bc300ee0f1c3db0090c1a555f4ff5386568 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include <cctype>
 #include <iostream>
index 4111575d098713623f8001df643cabc94d6b77ae..549742c2ad4b20d420d1ab09a3562e424be45416 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include <cctype>
 #include <iostream>
index 9b32df75883e721fe03a2c40ecf0fc7db2ab5580..3004e16cce3adb6de63b2a32eace2eac2796fdce 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmpxx.h"
 
index 7034bfbc65e9762eb9b5ed75f979ecc11c337831..4903c87d7f25d86a2ade464d8eee62c3e1db7fd1 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <stdarg.h>   /* for va_list and hence doprnt_funs_t */
index d4a2443281c40462add10e10bf183719a56f32da..8df833e15c1edd238972f61c8456fd73edc65d1a 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <stdarg.h>    /* for va_list and hence doprnt_funs_t */
index 402a570224c0170a92f84cfa7babe6cce96d4213..c6a71d2520e24e981109d753bc91c8915925b6cb 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include <clocale>
 #include <iostream>
@@ -47,7 +58,7 @@ operator<< (ostream &o, mpf_srcptr f)
   point[0] = use_facet< numpunct<char> >(o.getloc()).decimal_point();
   point[1] = '\0';
 #else
-  const char *point = localeconv()->decimal_point;
+  const char *point = GMP_DECIMAL_POINT;
 #endif
 
   GMP_ASPRINTF_T_INIT (d, &result);
index 92679f852d786efb7ddbd273e5ec920aa2c88900..f95f39a648b4d99c05542793d78a7647531c51b2 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <stdarg.h>    /* for va_list and hence doprnt_funs_t */
index d7d0b5c9698d0bac129ed051f896023b7b8acf05..ac1aefff40a03c8dbc6f1fd9539ba5b6a2d2e854 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <stdarg.h>    /* for va_list and hence doprnt_funs_t */
index d82e947c8058b3fcc4fe97db53689a5e402a25dc..0a7c2a4732913b65ef44da8e629ff702e96889e6 100644 (file)
@@ -1,21 +1,32 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 2000, 2001, 2002, 2012 Free Software Foundation, Inc.
+# Copyright 2000-2002, 2012 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 SUBDIRS = calc expr
index a9101aef10aeb3c91cb09f9505f736a793a37ac3..129c786f1c44df35b28a8a41ff5665d76eee3a0c 100644 (file)
 
 @SET_MAKE@
 
-# Copyright 2000, 2001, 2002, 2012 Free Software Foundation, Inc.
+# Copyright 2000-2002, 2012 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 VPATH = @srcdir@
 am__make_dryrun = \
   { \
index da6490755c6aa23f743bd8752efb82a5e3f46cf1..3a461ebc59965576ba3ce798d790c625b7dc6e6c 100644 (file)
@@ -1,21 +1,32 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 2000-2004 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 INCLUDES = -I$(top_srcdir)
index d84f2a27b4a54235b5b1f2b1b8d0dc5abd289c99..6606f87bc8205db64b77aad6a9a523c29b104359 100644 (file)
 
 @SET_MAKE@
 
-# Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 2000-2004 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 VPATH = @srcdir@
 am__make_dryrun = \
   { \
index f2f613049d59a4cb8cbc19a2356a58cfea544180..660394ecbc4dd06822a186fdb725c84a152279a5 100644 (file)
@@ -12,7 +12,7 @@ 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 a copy of the GNU General Public License along with
-this program.  If not, see http://www.gnu.org/licenses/.
+this program.  If not, see https://www.gnu.org/licenses/.
 
 
 
index c9ca8a6743c915e7b6daee3bf8d6ec7f658dcec4..7a9187826fc1f81e9ffe632c12a356b8508e69dc 100644 (file)
@@ -14,7 +14,7 @@ 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 a copy of the GNU General Public License along with
-this program.  If not, see http://www.gnu.org/licenses/.  */
+this program.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stddef.h>  /* for size_t */
 #ifndef NO_CALC_H
index 6ecf43e72e6178a09d586961a5f16d16db3880ba..42cdd440c252ab2579cf5f3fe7a92025f1680034 100644 (file)
@@ -14,7 +14,7 @@ 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 a copy of the GNU General Public License along with
-this program.  If not, see http://www.gnu.org/licenses/.  */
+this program.  If not, see https://www.gnu.org/licenses/.  */
 
 
 /* Define if GNU readline should be used. */
index 1b7777d634a9f944631db35e068ccff17f5e91bb..a306d1a5631f734992a4f9288160d4c040db7ade 100644 (file)
@@ -67,7 +67,7 @@
 
 /* A simple integer desk calculator using yacc and gmp.
 
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-2002 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -81,7 +81,7 @@ 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 a copy of the GNU General Public License along with
-this program.  If not, see http://www.gnu.org/licenses/.  */
+this program.  If not, see https://www.gnu.org/licenses/.  */
 
 
 /* This is a simple program, meant only to show one way to use GMP for this
index 0f9b1baad69db95693c539d51463c8598270f118..0fa1206f79a07d2bb40bed728dc08b3f060ad4ce 100644 (file)
@@ -1,7 +1,7 @@
 %{
 /* A simple integer desk calculator using yacc and gmp.
 
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-2002 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -15,7 +15,7 @@ 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 a copy of the GNU General Public License along with
-this program.  If not, see http://www.gnu.org/licenses/.  */
+this program.  If not, see https://www.gnu.org/licenses/.  */
 
 
 /* This is a simple program, meant only to show one way to use GMP for this
index d61e32b60d2d2fb3cb27a25bbea1ca8d0363d033..bf65cba425c8c6d4bc8b2262c9a6262d1e57a203 100644 (file)
@@ -472,7 +472,7 @@ char *yytext;
 #line 1 "calclex.l"
 /* Lexical analyzer for calc program.
 
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-2002 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -486,7 +486,7 @@ 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 a copy of the GNU General Public License along with
-this program.  If not, see http://www.gnu.org/licenses/.  */
+this program.  If not, see https://www.gnu.org/licenses/.  */
 #line 20 "calclex.l"
 #include <string.h>
 #include "calc-common.h"
index 32d4fc23cb13961b4845ea0ac3b44c452155d4e2..44df848fadc118d606d87f44352e47e824569c52 100644 (file)
@@ -1,6 +1,6 @@
 /* Lexical analyzer for calc program.
 
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-2002 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -14,7 +14,7 @@ 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 a copy of the GNU General Public License along with
-this program.  If not, see http://www.gnu.org/licenses/.  */
+this program.  If not, see https://www.gnu.org/licenses/.  */
 
 %{
 #include <string.h>
index 53291ff732f50b2467ac7a1f80b34f1dffa73418..40433686c180b098ee69143c1fa7616c9f2626b9 100644 (file)
@@ -14,7 +14,7 @@ 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 a copy of the GNU General Public License along with
-this program.  If not, see http://www.gnu.org/licenses/.  */
+this program.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "calc-common.h"
 
index 333cacc4961ab9f2685ead260d365201a4fcd3eb..369e751743644d1a6aa0ad40e1eecc733878ee7f 100644 (file)
@@ -1,21 +1,32 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 2001-2004 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
index f4a000bc56635e3c7bfb1c4d1e53ebe9c1ebc6b5..adb9eba91ab5fd28ce8def0fc7cd863bdfff1180 100644 (file)
 
 @SET_MAKE@
 
-# Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 2001-2004 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 VPATH = @srcdir@
 am__make_dryrun = \
   { \
index f80b4d707f522d3d5575e2ce858dc4b46fbebd3f..a54fe42c08a6c7a172fb346a479f0b19b7a50557 100644 (file)
@@ -3,17 +3,28 @@ Copyright 2001, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
@@ -90,7 +101,7 @@ hex when base==0.
 White space, as indicated by <ctype.h> isspace(), is ignored except for the
 purpose of separating tokens.
 
-Variables can be included in expressions by putting them in the varargs list
+Variables can be included in expressions by putting them in the stdarg list
 after the string.  "a", "b", "c" etc in the expression string designate
 those values.  For example,
 
index 84c5bce8812689007397991feb1d648d1414df57..9b6458fbd08323080a1e205ba8fa712a332621ff 100644 (file)
@@ -1,37 +1,34 @@
 /* Implementation specifics for expression evaluation.
 
-Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+Copyright 2000-2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
-
-
-/* Same tests as gmp.h. */
-#if  defined (__STDC__)                                 \
-  || defined (__cplusplus)                              \
-  || defined (_AIX)                                     \
-  || defined (__DECC)                                   \
-  || (defined (__mips) && defined (_SYSTYPE_SVR4))      \
-  || defined (_MSC_VER)                                 \
-  || defined (_WIN32)
-#define HAVE_STDARG 1
+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 <stdarg.h>
-#else
-#define HAVE_STDARG 0
-#include <varargs.h>
-#endif
 
 #include "expr.h"
 
index 1f4af6cea64f0aecb64319356dbe78e5c4b3a96a..42dd7966becc525506584e9579e6ed67d9a96376 100644 (file)
@@ -1,21 +1,32 @@
 /* mpexpr_evaluate -- shared code for simple expression evaluation
 
-Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+Copyright 2000-2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include <ctype.h>
 #include <stdio.h>
index 0cfda0a3356a1a0d5570f2ed1297ac0ac90f847a..d3b7c77cc3c32dbd056e4a1215d2661dcb47ee3d 100644 (file)
@@ -1,21 +1,32 @@
 /* Header for expression evaluation.
 
-Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+Copyright 2000-2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #ifndef __EXPR_H__
@@ -98,6 +109,10 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #define MPEXPR_TYPE_OPERATOR       0x2000
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef void (*mpexpr_fun_t) (void);
 
 struct mpexpr_operator_t {
@@ -120,4 +135,8 @@ int mpz_expr_a (const struct mpexpr_operator_t *, mpz_ptr, int,
                const char *, size_t, mpz_srcptr [26]);
 int mpz_expr (mpz_ptr, int, const char *, ...);
 
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
 #endif
index 98ce834798acdfe4e1662943f99a4968cfc212cb..1f7e21f89342be64237ef4246541ce9880c98e65 100644 (file)
@@ -1,21 +1,32 @@
 /* mpf expression evaluation
 
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <string.h>
@@ -93,27 +104,12 @@ const struct mpexpr_operator_t * const mpf_expr_standard_table
 
 
 int
-#if HAVE_STDARG
 mpf_expr (mpf_ptr res, int base, const char *e, ...)
-#else
-mpf_expr (va_alist)
-     va_dcl
-#endif
 {
   mpf_srcptr  var[MPEXPR_VARIABLES];
   va_list     ap;
   int         ret;
-#if HAVE_STDARG
   va_start (ap, e);
-#else
-  mpf_ptr     res;
-  int         base;
-  const char  *e;
-  va_start (ap);
-  res  = va_arg (ap, mpf_ptr);
-  base = va_arg (ap, int);
-  e    = va_arg (ap, const char *);
-#endif
 
   TRACE (printf ("mpf_expr(): base %d, %s\n", base, e));
   ret = mpexpr_va_to_var ((void **) var, ap);
index 4ab294e08866468494e20e2c1b2eb0095b5b3fa8..1918cb55cd91ed4aa19a184a33fc4e3c54ce41d2 100644 (file)
@@ -1,21 +1,32 @@
 /* mpf expression evaluation
 
-Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+Copyright 2000-2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /* Future: Bitwise "&", "|" and "&" could be done, if desired.  Not sure
index a16b2165c1ec20f2ae934f9c511e70899d757aab..96432006ef019f134c7fdb0f85289963a9f1ae8d 100644 (file)
@@ -1,21 +1,32 @@
 /* mpq expression evaluation
 
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <string.h>
@@ -126,27 +137,12 @@ const struct mpexpr_operator_t * const mpq_expr_standard_table
 
 
 int
-#if HAVE_STDARG
 mpq_expr (mpq_ptr res, int base, const char *e, ...)
-#else
-mpq_expr (va_alist)
-     va_dcl
-#endif
 {
   mpq_srcptr  var[MPEXPR_VARIABLES];
   va_list     ap;
   int         ret;
-#if HAVE_STDARG
   va_start (ap, e);
-#else
-  mpq_ptr     res;
-  int         base;
-  const char  *e;
-  va_start (ap);
-  res  = va_arg (ap, mpq_ptr);
-  base = va_arg (ap, int);
-  e    = va_arg (ap, const char *);
-#endif
 
   TRACE (printf ("mpq_expr(): base %d, %s\n", base, e));
   ret = mpexpr_va_to_var ((void **) var, ap);
index 8eaf602486e8eb98df216228d9583d3297da97c7..f3b6ecb4951a235a7251f405c4bcc9a1427f3f6b 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2000, 2001, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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>
index b53682eec6dba5f58bbb6221e15ed1301adfa77a..c25741b0233e045a917a7476ba7639520b4f1612 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
index 3d4ec6582881d5ebd931937d9cfe68c7eecdd2f8..bac1a9992e80b47a9ca5088fab8142568527d6a0 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz expression evaluation, simple part
 
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include <ctype.h>
 #include <stdio.h>
@@ -177,27 +188,12 @@ const struct mpexpr_operator_t * const mpz_expr_standard_table
 
 
 int
-#if HAVE_STDARG
 mpz_expr (mpz_ptr res, int base, const char *e, ...)
-#else
-mpz_expr (va_alist)
-     va_dcl
-#endif
 {
   mpz_srcptr  var[MPEXPR_VARIABLES];
   va_list     ap;
   int         ret;
-#if HAVE_STDARG
   va_start (ap, e);
-#else
-  mpz_ptr     res;
-  int         base;
-  const char  *e;
-  va_start (ap);
-  res  = va_arg (ap, mpz_ptr);
-  base = va_arg (ap, int);
-  e    = va_arg (ap, const char *);
-#endif
 
   TRACE (printf ("mpz_expr(): base %d, %s\n", base, e));
   ret = mpexpr_va_to_var ((void **) var, ap);
index dc544228081ad4ce0a4c328a580341b4850e89a9..eda830d970da950a041cacce18939849c9b3b40e 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz expression evaluation
 
-Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+Copyright 2000-2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include <ctype.h>
 #include <stdio.h>
index 169f5a8814f98ca755245bee39b9ee5c95ecec1c..706b910287844396ae2d4da70a13bca769014827 100644 (file)
@@ -1,21 +1,32 @@
 /* Demo program to run expression evaluation.
 
-Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+Copyright 2000-2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /* Usage: ./run-expr [-z] [-q] [-f] [-p prec] [-b base] expression...
index 195350e82940e366b8288f7b35e34b57bd30286a..2f808dd8cd3728a4d73bfd25fef779dc4a1541e7 100644 (file)
@@ -1,21 +1,32 @@
 /* Test expression evaluation (print nothing and exit 0 if successful).
 
-Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright 2000-2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <stdlib.h>
index 9c9c6dbffbc6d5d6b14561e47b70fdc0a5342ccd..0d5f26d9090626263a04deca5e7f087bf5601fdc 100644 (file)
@@ -1,7 +1,6 @@
 /* Factoring with Pollard's rho method.
 
-Copyright 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2009, 2012
-Free Software Foundation, Inc.
+Copyright 1995, 1997-2003, 2005, 2009, 2012 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free Software
@@ -13,7 +12,7 @@ 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 a copy of the GNU General Public License along with
-this program.  If not, see http://www.gnu.org/licenses/.  */
+this program.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdlib.h>
index 782106c0a0ccaf20e0794705b8f034ef436b3074..40ee70eb994e62d6be0c9e846aa308497300530a 100644 (file)
@@ -13,7 +13,7 @@ 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 a copy of the GNU General Public License along with
-this program.  If not, see http://www.gnu.org/licenses/.  */
+this program.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
 #include <string.h>
index 3dc6b32ef11ceab735d8f6096c110703a3a00df5..46bc707cfe6711739c28f4fe8f1d5bc1d5a97aa8 100644 (file)
@@ -1,21 +1,32 @@
 # GMP perl module
 
-# Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 2001-2004 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 # [Note: The above copyright notice is repeated in the documentation section
 # below, in order to get it into man pages etc generated by the various pod
@@ -624,22 +635,33 @@ Some assertion checking is available as a compile-time option.
 
 =head1 COPYRIGHT
 
-Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright 2001-2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 =cut
 
index 2282c89282fba0760678f22ff2fbf26c176b5af3..9738259c2a0c39c4a3164efd5b748548079dd202 100644 (file)
@@ -1,21 +1,32 @@
 /* GMP module external subroutines.
 
-Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2001-2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 /* Notes:
index ea7b28b40eb15c2df6973b3b534add797f036c33..4c0dec6ceacb8c533ad9781f6c36825eec2a507f 100644 (file)
@@ -2,20 +2,31 @@
 
 # Copyright 2001, 2003 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 package GMP::Mpf;
index cd60cbef1775e5b5d62db8f61bbeaee048e806f0..fe010849e0b44eb24087aaaf95fac54d33950570 100644 (file)
@@ -2,20 +2,31 @@
 
 # Copyright 2001 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 package GMP::Mpq;
index a86d4aba4dde78525270aaf08e4ebd48ce8221bf..27e6336775d7bee6728ff40f04709fd518ed438e 100644 (file)
@@ -1,21 +1,32 @@
 # GMP mpz module.
 
-# Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright 2001-2003 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 package GMP::Mpz;
index 049c729353712be659459cbda05b1c5ce5d8b68d..9f7d763dd5268f56ea942dca28c85d616489250b 100644 (file)
@@ -2,20 +2,31 @@
 
 # Copyright 2001, 2003 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 package GMP::Rand;
index e503c79dd8b7b5c198f214c9397d6ee19cc4b6ae..f3d7c53b1c22c8209ce44e1db9a801956e0fb274 100644 (file)
@@ -3,17 +3,28 @@ Copyright 2001, 2003, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index c30b503439316e0bf9919f58f1e19e9922c5bfeb..a676710c1c41c1cf0c0785330dd69e52b24f40aa 100644 (file)
@@ -2,20 +2,31 @@
 
 # Copyright 2001, 2003, 2004 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 # Bugs:
index 20ca5a704056a67b28ea12e615658e5d2d4830eb..8a10ee1ebb213ddf5c7dd2fa51b80b8941428e6b 100644 (file)
@@ -4,20 +4,31 @@
 
 # Copyright 2001, 2004 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 use strict;
 
index 40a903378d3218501a817f4579c4ca942e2f60a1..2b54089165034a02186db3b37657146f56e0d957 100644 (file)
@@ -2,22 +2,33 @@
 
 # GMP perl module tests
 
-# Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright 2001-2003 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 # These tests aim to exercise the many possible combinations of operands
index 645d3cfbb70324fe672d30121d67dcb0338e7bee..31a1d6bdd954519ab332786a0bcfd51233bd091d 100644 (file)
@@ -2,20 +2,31 @@
 
 # Copyright 2001 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 # The following uses of :constants seem to provoke segvs in perl 5.005_03,
index 06dc96d7da114fbf31239cd70bb8ba929bb02805..e863a9c51689e6984e1344de4485d899638d05ea 100644 (file)
@@ -2,20 +2,31 @@
 
 # Copyright 2001, 2003 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 TYPEMAP
index 77f767f7acf5a485e7263e9fe9188e4524617073..b3e7f5d46f05bb3e158d67c09c66460f752b015e 100644 (file)
@@ -14,7 +14,7 @@ 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 a copy of the GNU General Public License along with
-this program.  If not, see http://www.gnu.org/licenses/.  */
+this program.  If not, see https://www.gnu.org/licenses/.  */
 
 
 /* Define if you have the <sys/resource.h> header file. */
index 8ecb634f60100603c6b31360aa13d56b1d6f111f..ce28187811a2d055ffce01b8e4c921e12c331324 100644 (file)
@@ -1,8 +1,7 @@
 /* Program for computing integer expressions using the GNU Multiple Precision
    Arithmetic Library.
 
-Copyright 1997, 1999, 2000, 2001, 2002, 2005, 2008, 2012 Free Software
-Foundation, Inc.
+Copyright 1997, 1999-2002, 2005, 2008, 2012 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free Software
@@ -14,7 +13,7 @@ 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 a copy of the GNU General Public License along with
-this program.  If not, see http://www.gnu.org/licenses/.  */
+this program.  If not, see https://www.gnu.org/licenses/.  */
 
 
 /* This expressions evaluator works by building an expression tree (using a
index 61844b9afc87adaa7c78464542f2a77840c7a5d1..3cb32e2e253f87b902fa4e4dc1fb5c6a72aed012 100644 (file)
@@ -14,7 +14,7 @@ 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 a copy of the GNU General Public License along with
-this program.  If not, see http://www.gnu.org/licenses/.  */
+this program.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
 #include <stdio.h>
index b0c7e63473132fb3cd39a25d33377dce65ee302a..9d764468047d52af781e3d42d5e8d37cd0f90946 100644 (file)
@@ -2,7 +2,7 @@
    class number h(d), for a given negative fundamental discriminant, using
    Dirichlet's analytic formula.
 
-Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1999-2002 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -17,7 +17,7 @@ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.
 
 You should have received a copy of the GNU General Public License along with
-this program.  If not, see http://www.gnu.org/licenses/.  */
+this program.  If not, see https://www.gnu.org/licenses/.  */
 
 
 /* Usage: qcn [-p limit] <discriminant>...
index 2bc34ddbf9e0d55f51d114bfa3c1fe3908b0ebdb..083f25a630c170954147a0a9b136b2439dda1472 100644 (file)
@@ -3,20 +3,31 @@
 
 # Copyright 2003 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 EXTRA_DIST = configuration isa_abi_headache projects.html tasks.html
index 145fa08a64adc3beb69fd1018ed94c511270674d..1acf6029ef41c6ad10d930f8bf11f3cb59dd14af 100644 (file)
 
 # Copyright 2003 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 VPATH = @srcdir@
 am__make_dryrun = \
   { \
index 903067cc5af46df826deb0f86b0007794c01a575..b6903866b2df1025db1431681e9ee0febcb49a86 100644 (file)
@@ -1,21 +1,32 @@
 /* doc/configuration (in Emacs -*-outline-*- format). */
 
-Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright 2000-2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
@@ -46,7 +57,7 @@ The same applies to mpf, mpq, scanf and printf.
 
 The way we build libmpn (in the `mpn' subdirectory) is quite special.
 
-Currently only mpn/mp_bases.c is truely generic and included in every
+Currently only mpn/mp_bases.c is truly generic and included in every
 configuration.  All other files are linked at build time into the mpn
 build directory from one of the CPU specific sub-directories, or from
 the mpn/generic directory.
index 8805f1a47d95e35dd768a735ccf9ec951ba29f06..05804eecbbd2faafcaf93b1840256792e62bc165 100644 (file)
@@ -5,7 +5,7 @@
 @c hence no sectioning command or @node.
 
 @display
-Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
+Copyright @copyright{} 2000-2002, 2007, 2008 Free Software Foundation, Inc.
 @uref{http://fsf.org/}
 
 Everyone is permitted to copy and distribute verbatim copies
@@ -414,7 +414,7 @@ The Free Software Foundation may publish new, revised versions
 of the GNU Free Documentation License from time to time.  Such new
 versions will be similar in spirit to the present version, but may
 differ in detail to address new problems or concerns.  See
-@uref{http://www.gnu.org/copyleft/}.
+@uref{https://www.gnu.org/copyleft/}.
 
 Each version of the License is given a distinguishing version number.
 If the Document specifies that a particular numbered version of this
index 38ad326e1f4dffb865a057786b122c910bbe26b0..b1acc78505ef0d81f2f9f4ff42ca424bc6b47d2f 100644 (file)
@@ -2,11 +2,9 @@ This is ../../gmp/doc/gmp.info, produced by makeinfo version 4.13 from
 ../../gmp/doc/gmp.texi.
 
 This manual describes how to install and use the GNU multiple precision
-arithmetic library, version 5.1.3.
+arithmetic library, version 6.0.0.
 
-   Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
-2013 Free Software Foundation, Inc.
+   Copyright 1991, 1993-2014 Free Software Foundation, Inc.
 
    Permission is granted to copy, distribute and/or modify this
 document under the terms of the GNU Free Documentation License, Version
@@ -23,157 +21,157 @@ END-INFO-DIR-ENTRY
 
 \1f
 Indirect:
-gmp.info-1: 997
-gmp.info-2: 300733
+gmp.info-1: 882
+gmp.info-2: 300831
 \1f
 Tag Table:
 (Indirect)
-Node: Top\7f997
-Node: Copying\7f3183
-Node: Introduction to GMP\7f5034
-Node: Installing GMP\7f7745
-Node: Build Options\7f8477
-Node: ABI and ISA\7f24261
-Node: Notes for Package Builds\7f33832
-Node: Notes for Particular Systems\7f36919
-Node: Known Build Problems\7f43516
-Node: Performance optimization\7f47050
-Node: GMP Basics\7f48179
-Node: Headers and Libraries\7f48827
-Node: Nomenclature and Types\7f50251
-Node: Function Classes\7f52247
-Node: Variable Conventions\7f53781
-Node: Parameter Conventions\7f55390
-Node: Memory Management\7f57446
-Node: Reentrancy\7f58574
-Node: Useful Macros and Constants\7f60447
-Node: Compatibility with older versions\7f61438
-Node: Demonstration Programs\7f62349
-Node: Efficiency\7f64214
-Node: Debugging\7f71838
-Node: Profiling\7f78863
-Node: Autoconf\7f82854
-Node: Emacs\7f84633
-Node: Reporting Bugs\7f85239
-Node: Integer Functions\7f87865
-Node: Initializing Integers\7f88641
-Node: Assigning Integers\7f91017
-Node: Simultaneous Integer Init & Assign\7f92628
-Node: Converting Integers\7f94275
-Node: Integer Arithmetic\7f97239
-Node: Integer Division\7f98975
-Node: Integer Exponentiation\7f105727
-Node: Integer Roots\7f107221
-Node: Number Theoretic Functions\7f108941
-Node: Integer Comparisons\7f116416
-Node: Integer Logic and Bit Fiddling\7f117854
-Node: I/O of Integers\7f120499
-Node: Integer Random Numbers\7f123490
-Node: Integer Import and Export\7f126107
-Node: Miscellaneous Integer Functions\7f130123
-Node: Integer Special Functions\7f132037
-Node: Rational Number Functions\7f135136
-Node: Initializing Rationals\7f136329
-Node: Rational Conversions\7f138808
-Node: Rational Arithmetic\7f140558
-Node: Comparing Rationals\7f141970
-Node: Applying Integer Functions\7f143378
-Node: I/O of Rationals\7f144897
-Node: Floating-point Functions\7f146955
-Node: Initializing Floats\7f149840
-Node: Assigning Floats\7f153933
-Node: Simultaneous Float Init & Assign\7f156524
-Node: Converting Floats\7f158074
-Node: Float Arithmetic\7f161364
-Node: Float Comparison\7f163517
-Node: I/O of Floats\7f165177
-Node: Miscellaneous Float Functions\7f167866
-Node: Low-level Functions\7f169868
-Node: Random Number Functions\7f194385
-Node: Random State Initialization\7f195453
-Node: Random State Seeding\7f198318
-Node: Random State Miscellaneous\7f199723
-Node: Formatted Output\7f200365
-Node: Formatted Output Strings\7f200610
-Node: Formatted Output Functions\7f205989
-Node: C++ Formatted Output\7f210064
-Node: Formatted Input\7f212746
-Node: Formatted Input Strings\7f212982
-Node: Formatted Input Functions\7f217634
-Node: C++ Formatted Input\7f220603
-Node: C++ Class Interface\7f222506
-Node: C++ Interface General\7f223500
-Node: C++ Interface Integers\7f226570
-Node: C++ Interface Rationals\7f230285
-Node: C++ Interface Floats\7f234302
-Node: C++ Interface Random Numbers\7f240306
-Node: C++ Interface Limitations\7f242708
-Node: Custom Allocation\7f245528
-Node: Language Bindings\7f249747
-Node: Algorithms\7f253702
-Node: Multiplication Algorithms\7f254402
-Node: Basecase Multiplication\7f255491
-Node: Karatsuba Multiplication\7f257399
-Node: Toom 3-Way Multiplication\7f261025
-Node: Toom 4-Way Multiplication\7f267444
-Node: Higher degree Toom'n'half\7f268823
-Node: FFT Multiplication\7f270108
-Node: Other Multiplication\7f275443
-Node: Unbalanced Multiplication\7f277917
-Node: Division Algorithms\7f278705
-Node: Single Limb Division\7f279084
-Node: Basecase Division\7f281974
-Node: Divide and Conquer Division\7f283177
-Node: Block-Wise Barrett Division\7f285246
-Node: Exact Division\7f285898
-Node: Exact Remainder\7f289063
-Node: Small Quotient Division\7f291313
-Node: Greatest Common Divisor Algorithms\7f292911
-Node: Binary GCD\7f293208
-Node: Lehmer's Algorithm\7f296057
-Node: Subquadratic GCD\7f298276
-Node: Extended GCD\7f300733
-Node: Jacobi Symbol\7f302045
-Node: Powering Algorithms\7f303060
-Node: Normal Powering Algorithm\7f303323
-Node: Modular Powering Algorithm\7f303851
-Node: Root Extraction Algorithms\7f304633
-Node: Square Root Algorithm\7f304948
-Node: Nth Root Algorithm\7f307089
-Node: Perfect Square Algorithm\7f307874
-Node: Perfect Power Algorithm\7f309961
-Node: Radix Conversion Algorithms\7f310582
-Node: Binary to Radix\7f310958
-Node: Radix to Binary\7f314888
-Node: Other Algorithms\7f316976
-Node: Prime Testing Algorithm\7f317328
-Node: Factorial Algorithm\7f318512
-Node: Binomial Coefficients Algorithm\7f320902
-Node: Fibonacci Numbers Algorithm\7f321796
-Node: Lucas Numbers Algorithm\7f324270
-Node: Random Number Algorithms\7f324991
-Node: Assembly Coding\7f327113
-Node: Assembly Code Organisation\7f328073
-Node: Assembly Basics\7f329040
-Node: Assembly Carry Propagation\7f330190
-Node: Assembly Cache Handling\7f332021
-Node: Assembly Functional Units\7f334182
-Node: Assembly Floating Point\7f335795
-Node: Assembly SIMD Instructions\7f339573
-Node: Assembly Software Pipelining\7f340555
-Node: Assembly Loop Unrolling\7f341617
-Node: Assembly Writing Guide\7f343832
-Node: Internals\7f346597
-Node: Integer Internals\7f347109
-Node: Rational Internals\7f349365
-Node: Float Internals\7f350603
-Node: Raw Output Internals\7f358017
-Node: C++ Interface Internals\7f359211
-Node: Contributors\7f362497
-Node: References\7f368247
-Node: GNU Free Documentation License\7f374002
-Node: Concept Index\7f399171
-Node: Function Index\7f445060
+Node: Top\7f882
+Node: Copying\7f2953
+Node: Introduction to GMP\7f5299
+Node: Installing GMP\7f8014
+Node: Build Options\7f8746
+Node: ABI and ISA\7f24479
+Node: Notes for Package Builds\7f34316
+Node: Notes for Particular Systems\7f37403
+Node: Known Build Problems\7f45153
+Node: Performance optimization\7f48688
+Node: GMP Basics\7f49817
+Node: Headers and Libraries\7f50465
+Node: Nomenclature and Types\7f51870
+Node: Function Classes\7f53866
+Node: Variable Conventions\7f55400
+Node: Parameter Conventions\7f57009
+Node: Memory Management\7f59065
+Node: Reentrancy\7f60193
+Node: Useful Macros and Constants\7f62061
+Node: Compatibility with older versions\7f63052
+Node: Demonstration Programs\7f63963
+Node: Efficiency\7f65828
+Node: Debugging\7f73452
+Node: Profiling\7f80478
+Node: Autoconf\7f84469
+Node: Emacs\7f86250
+Node: Reporting Bugs\7f86856
+Node: Integer Functions\7f89483
+Node: Initializing Integers\7f90259
+Node: Assigning Integers\7f92635
+Node: Simultaneous Integer Init & Assign\7f94246
+Node: Converting Integers\7f95893
+Node: Integer Arithmetic\7f98857
+Node: Integer Division\7f100593
+Node: Integer Exponentiation\7f107345
+Node: Integer Roots\7f108839
+Node: Number Theoretic Functions\7f110559
+Node: Integer Comparisons\7f118034
+Node: Integer Logic and Bit Fiddling\7f119472
+Node: I/O of Integers\7f122117
+Node: Integer Random Numbers\7f125108
+Node: Integer Import and Export\7f127725
+Node: Miscellaneous Integer Functions\7f131741
+Node: Integer Special Functions\7f133655
+Node: Rational Number Functions\7f137815
+Node: Initializing Rationals\7f139008
+Node: Rational Conversions\7f141487
+Node: Rational Arithmetic\7f143237
+Node: Comparing Rationals\7f144649
+Node: Applying Integer Functions\7f146057
+Node: I/O of Rationals\7f147576
+Node: Floating-point Functions\7f149634
+Node: Initializing Floats\7f152604
+Node: Assigning Floats\7f156697
+Node: Simultaneous Float Init & Assign\7f159288
+Node: Converting Floats\7f160838
+Node: Float Arithmetic\7f164128
+Node: Float Comparison\7f166281
+Node: I/O of Floats\7f167941
+Node: Miscellaneous Float Functions\7f170630
+Node: Low-level Functions\7f172632
+Node: Random Number Functions\7f205756
+Node: Random State Initialization\7f206824
+Node: Random State Seeding\7f209689
+Node: Random State Miscellaneous\7f211094
+Node: Formatted Output\7f211736
+Node: Formatted Output Strings\7f211981
+Node: Formatted Output Functions\7f217360
+Node: C++ Formatted Output\7f221435
+Node: Formatted Input\7f224135
+Node: Formatted Input Strings\7f224371
+Node: Formatted Input Functions\7f229023
+Node: C++ Formatted Input\7f231992
+Node: C++ Class Interface\7f233895
+Node: C++ Interface General\7f234846
+Node: C++ Interface Integers\7f237916
+Node: C++ Interface Rationals\7f241637
+Node: C++ Interface Floats\7f245660
+Node: C++ Interface Random Numbers\7f251676
+Node: C++ Interface Limitations\7f254078
+Node: Custom Allocation\7f257656
+Node: Language Bindings\7f261875
+Node: Algorithms\7f265469
+Node: Multiplication Algorithms\7f266169
+Node: Basecase Multiplication\7f267258
+Node: Karatsuba Multiplication\7f269166
+Node: Toom 3-Way Multiplication\7f272792
+Node: Toom 4-Way Multiplication\7f279211
+Node: Higher degree Toom'n'half\7f280590
+Node: FFT Multiplication\7f281876
+Node: Other Multiplication\7f287211
+Node: Unbalanced Multiplication\7f289685
+Node: Division Algorithms\7f290473
+Node: Single Limb Division\7f290852
+Node: Basecase Division\7f293742
+Node: Divide and Conquer Division\7f294945
+Node: Block-Wise Barrett Division\7f297014
+Node: Exact Division\7f297666
+Node: Exact Remainder\7f300831
+Node: Small Quotient Division\7f303081
+Node: Greatest Common Divisor Algorithms\7f304679
+Node: Binary GCD\7f304976
+Node: Lehmer's Algorithm\7f307825
+Node: Subquadratic GCD\7f310044
+Node: Extended GCD\7f312501
+Node: Jacobi Symbol\7f313813
+Node: Powering Algorithms\7f314828
+Node: Normal Powering Algorithm\7f315091
+Node: Modular Powering Algorithm\7f315619
+Node: Root Extraction Algorithms\7f316401
+Node: Square Root Algorithm\7f316716
+Node: Nth Root Algorithm\7f318857
+Node: Perfect Square Algorithm\7f319642
+Node: Perfect Power Algorithm\7f321729
+Node: Radix Conversion Algorithms\7f322350
+Node: Binary to Radix\7f322726
+Node: Radix to Binary\7f326656
+Node: Other Algorithms\7f328744
+Node: Prime Testing Algorithm\7f329096
+Node: Factorial Algorithm\7f330280
+Node: Binomial Coefficients Algorithm\7f332670
+Node: Fibonacci Numbers Algorithm\7f333564
+Node: Lucas Numbers Algorithm\7f336038
+Node: Random Number Algorithms\7f336759
+Node: Assembly Coding\7f338881
+Node: Assembly Code Organisation\7f339841
+Node: Assembly Basics\7f340808
+Node: Assembly Carry Propagation\7f341958
+Node: Assembly Cache Handling\7f343789
+Node: Assembly Functional Units\7f345950
+Node: Assembly Floating Point\7f347563
+Node: Assembly SIMD Instructions\7f351341
+Node: Assembly Software Pipelining\7f352323
+Node: Assembly Loop Unrolling\7f353385
+Node: Assembly Writing Guide\7f355600
+Node: Internals\7f358365
+Node: Integer Internals\7f358877
+Node: Rational Internals\7f361133
+Node: Float Internals\7f362371
+Node: Raw Output Internals\7f369785
+Node: C++ Interface Internals\7f370979
+Node: Contributors\7f374300
+Node: References\7f380372
+Node: GNU Free Documentation License\7f386132
+Node: Concept Index\7f411295
+Node: Function Index\7f457482
 \1f
 End Tag Table
 
index 416c1d4b79bf0bc81bf7993b576f9fa1afdb45f7..8b759764b22dd2e4866ca7379bc23ed413b5d4c5 100644 (file)
@@ -2,11 +2,9 @@ This is ../../gmp/doc/gmp.info, produced by makeinfo version 4.13 from
 ../../gmp/doc/gmp.texi.
 
 This manual describes how to install and use the GNU multiple precision
-arithmetic library, version 5.1.3.
+arithmetic library, version 6.0.0.
 
-   Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
-2013 Free Software Foundation, Inc.
+   Copyright 1991, 1993-2014 Free Software Foundation, Inc.
 
    Permission is granted to copy, distribute and/or modify this
 document under the terms of the GNU Free Documentation License, Version
@@ -28,11 +26,9 @@ GNU MP
 ******
 
    This manual describes how to install and use the GNU multiple
-precision arithmetic library, version 5.1.3.
+precision arithmetic library, version 6.0.0.
 
-   Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
-2013 Free Software Foundation, Inc.
+   Copyright 1991, 1993-2014 Free Software Foundation, Inc.
 
    Permission is granted to copy, distribute and/or modify this
 document under the terms of the GNU Free Documentation License, Version
@@ -100,11 +96,20 @@ modified by someone else and passed on, we want their recipients to
 know that what they have is not what we distributed, so that any
 problems introduced by others will not reflect on our reputation.
 
-   The precise conditions of the license for the GNU MP library are
-found in the Lesser General Public License version 3 that accompanies
-the source code, see `COPYING.LIB'.  Certain demonstration programs are
-provided under the terms of the plain General Public License version 3,
-see `COPYING'.
+   More precisely, the GNU MP library is dual licensed, under the
+conditions of the GNU Lesser General Public License version 3 (see
+`COPYING.LESSERv3'), or the GNU General Public License version 2 (see
+`COPYINGv2'). This is the recipient's choice, and the recipient also has
+the additional option of applying later versions of these licenses. (The
+reason for this dual licensing is to make it possible to use the
+library with programs which are licensed under GPL version 2, but which
+for historical or other reasons do not allow use under later versions
+of the GPL).
+
+   Programs which are not part of the library itself, such as
+demonstration programs and the GMP testsuite, are licensed under the
+terms of the GNU General Public License version 3 (see `COPYINGv3'), or
+any later version.
 
 \1f
 File: gmp.info,  Node: Introduction to GMP,  Next: Installing GMP,  Prev: Copying,  Up: Top
@@ -130,32 +135,31 @@ carefully optimized assembly code for the most common inner loops for
 many different CPUs, and by a general emphasis on speed (as opposed to
 simplicity or elegance).
 
-   There is assembly code for these CPUs: ARM, DEC Alpha 21064, 21164,
-and 21264, AMD 29000, AMD K6, K6-2, Athlon, and Athlon64, Hitachi
-SuperH and SH-2, HPPA 1.0, 1.1 and 2.0, Intel Pentium, Pentium
-Pro/II/III, Pentium 4, generic x86, Intel IA-64, i960, Motorola
-MC68000, MC68020, MC88100, and MC88110, Motorola/IBM PowerPC 32 and 64,
-National NS32000, IBM POWER, MIPS R3000, R4000, SPARCv7, SuperSPARC,
-generic SPARCv8, UltraSPARC, DEC VAX, and Zilog Z8000.  Some
-optimizations also for Cray vector systems, Clipper, IBM ROMP (RT), and
-Pyramid AP/XP.
+   There is assembly code for these CPUs: ARM Cortex-A9, Cortex-A15,
+and generic ARM, DEC Alpha 21064, 21164, and 21264, AMD K8 and K10
+(sold under many brands, e.g. Athlon64, Phenom, Opteron) Bulldozer, and
+Bobcat, Intel Pentium, Pentium Pro/II/III, Pentium 4, Core2, Nehalem,
+Sandy bridge, Haswell, generic x86, Intel IA-64, Motorola/IBM PowerPC
+32 and 64 such as POWER970, POWER5, POWER6, and POWER7, MIPS 32-bit and
+64-bit, SPARC 32-bit ad 64-bit with special support for all UltraSPARC
+models.  There is also assembly code for many obsolete CPUs.
 
 For up-to-date information on GMP, please see the GMP web pages at
 
-     `http://gmplib.org/'
+     `https://gmplib.org/'
 
 The latest version of the library is available at
 
-     `ftp://ftp.gnu.org/gnu/gmp/'
+     `https://ftp.gnu.org/gnu/gmp/'
 
    Many sites around the world mirror `ftp.gnu.org', please use a mirror
-near you, see `http://www.gnu.org/order/ftp.html' for a full list.
+near you, see `https://www.gnu.org/order/ftp.html' for a full list.
 
    There are three public mailing lists of interest.  One for release
 announcements, one for general questions and discussions about usage of
 the GMP library and one for bug reports.  For more information, see
 
-     `http://gmplib.org/mailman/listinfo/'.
+     `https://gmplib.org/mailman/listinfo/'.
 
    The proper place for bug reports is <gmp-bugs@gmplib.org>.  See
 *note Reporting Bugs:: for information about reporting bugs.
@@ -229,7 +233,7 @@ Build Directory
      directory.  For example
 
           cd /my/build/dir
-          /my/sources/gmp-5.1.3/configure
+          /my/sources/gmp-6.0.0/configure
 
      Not all `make' programs have the necessary features (`VPATH') to
      support this.  In particular, SunOS and Slowaris `make' have bugs
@@ -352,8 +356,7 @@ CPU types
           pentium2, pentium3, pentium4, k6, k62, k63, athlon, amd64,
           viac3, viac32
 
-        * Other: a29k, arm, clipper, i960, ns32k, pyramid, sh, sh2, vax,
-          z8k
+        * Other: arm, sh, sh2, vax,
 
      CPUs not listed will use generic C code.
 
@@ -625,6 +628,15 @@ AMD64 (`x86_64')
           (In GCC 2.95 and earlier there's no `-m32' option, it's the
           only mode.)
 
+    `ABI=x32'
+          The x32 ABI uses 64-bit limbs but 32-bit pointers.  Like the
+          64-bit ABI, it makes full use of the chip's arithmetic
+          capabilities.  This ABI is not supported by all operating
+          systems.
+
+               gcc  -mx32
+
+
 
 HPPA 2.0 (`hppa2.0*', `hppa64')
 
@@ -914,6 +926,20 @@ Floating Point Mode
      in single precision mode.  Of course this affects all code,
      including application code, not just GMP.
 
+FreeBSD 7.x, 8.x, 9.0, 9.1, 9.2
+     `m4' in these releases of FreeBSD has an eval function which
+     ignores its 2nd and 3rd arguments, which makes it unsuitable for
+     `.asm' file processing.  `./configure' will detect the problem and
+     either abort or choose another m4 in the `PATH'.  The bug is fixed
+     in FreeBSD 9.3 and 10.0, so either upgrade or use GNU m4.  Note
+     that the FreeBSD package system installs GNU m4 under the name
+     `gm4', which GMP cannot guess.
+
+FreeBSD 7.x, 8.x, 9.x
+     GMP releases starting with 5.2 do not support `ABI=32' on
+     FreeBSD/amd64 prior to release 10.0 of the system.  The cause is a
+     broken `limits.h', which GMP no longer works around.
+
 MS-DOS and MS Windows
      On an MS-DOS system DJGPP can be used to build GMP, and on an MS
      Windows system Cygwin, DJGPP and MINGW can be used.  All three are
@@ -957,6 +983,15 @@ Motorola 68k CPU Types
      CPU32 series chips.  `m68302' can be used for "Dragonball" series
      chips, though this is merely a synonym for `m68000'.
 
+NetBSD 5.x
+     `m4' in these releases of NetBSD has an eval function which
+     ignores its 2nd and 3rd arguments, which makes it unsuitable for
+     `.asm' file processing.  `./configure' will detect the problem and
+     either abort or choose another m4 in the `PATH'.  The bug is fixed
+     in NetBSD 6, so either upgrade or use GNU m4.  Note that the
+     NetBSD package system installs GNU m4 under the name `gm4', which
+     GMP cannot guess.
+
 OpenBSD 2.6
      `m4' in this release of OpenBSD has a bug in `eval' that makes it
      unsuitable for `.asm' file processing.  `./configure' will detect
@@ -1026,7 +1061,7 @@ File: gmp.info,  Node: Known Build Problems,  Next: Performance optimization,  P
 2.5 Known Build Problems
 ========================
 
-You might find more up-to-date information at `http://gmplib.org/'.
+You might find more up-to-date information at `https://gmplib.org/'.
 
 Compiler link options
      The version of libtool currently in use rather aggressively strips
@@ -1179,10 +1214,10 @@ parameters are only provided if `<stdio.h>' is included too.
      #include <stdio.h>
      #include <gmp.h>
 
-   Likewise `<stdarg.h>' (or `<varargs.h>') is required for prototypes
-with `va_list' parameters, such as `gmp_vprintf'.  And `<obstack.h>'
-for prototypes with `struct obstack' parameters, such as
-`gmp_obstack_printf', when available.
+   Likewise `<stdarg.h>' is required for prototypes with `va_list'
+parameters, such as `gmp_vprintf'.  And `<obstack.h>' for prototypes
+with `struct obstack' parameters, such as `gmp_obstack_printf', when
+available.
 
    All programs using GMP must link against the `libgmp' library.  On a
 typical Unix-like system this can be done with `-lgmp', for example
@@ -1453,11 +1488,11 @@ GMP is reentrant and thread-safe, with some exceptions:
      then the GMP I/O functions using them will not be reentrant either.
 
    * It's safe for two threads to read from the same GMP variable
-     simultaneously, but it's not safe for one to read while the
-     another might be writing, nor for two threads to write
-     simultaneously.  It's not safe for two threads to generate a
-     random number from the same `gmp_randstate_t' simultaneously,
-     since this involves an update of that variable.
+     simultaneously, but it's not safe for one to read while another
+     might be writing, nor for two threads to write simultaneously.
+     It's not safe for two threads to generate a random number from the
+     same `gmp_randstate_t' simultaneously, since this involves an
+     update of that variable.
 
 \1f
 File: gmp.info,  Node: Useful Macros and Constants,  Next: Compatibility with older versions,  Prev: Reentrancy,  Up: GMP Basics
@@ -1478,7 +1513,7 @@ File: gmp.info,  Node: Useful Macros and Constants,  Next: Compatibility with ol
 
  -- Global Constant: const char * const gmp_version
      The GMP version number, as a null-terminated string, in the form
-     "i.j.k".  This release is "5.1.3".  Note that the format "i.j" was
+     "i.j.k".  This release is "6.0.0".  Note that the format "i.j" was
      used, before version 4.3.0, when k was zero.
 
  -- Macro: __GMP_CC
@@ -1794,7 +1829,7 @@ Source File Paths
      path to the source directory.
 
           cd /my/build/dir
-          /my/source/dir/gmp-5.1.3/configure
+          /my/source/dir/gmp-6.0.0/configure
 
      This works via `VPATH', and might require GNU `make'.  Alternately
      it might be possible to change the `.c.lo' rules appropriately.
@@ -1836,7 +1871,7 @@ Maximum Debuggability
      For C++, add `--enable-cxx CXXFLAGS=-g'.
 
 Checker
-     The GCC checker (`http://savannah.nongnu.org/projects/checker/')
+     The GCC checker (`https://savannah.nongnu.org/projects/checker/')
      can be used with GMP.  It contains a stub library which means GMP
      applications compiled with checker can use a normal GMP build.
 
@@ -1985,7 +2020,7 @@ found, but an application that must have GMP would want to generate an
 error if not found.  For example,
 
      AC_CHECK_LIB(gmp, __gmpz_init, ,
-       [AC_MSG_ERROR([GNU MP not found, see http://gmplib.org/])])
+       [AC_MSG_ERROR([GNU MP not found, see https://gmplib.org/])])
 
    If functions added in some particular version of GMP are required,
 then one of those can be used when checking.  For example `mpz_mul_si'
@@ -1993,7 +2028,7 @@ was added in GMP 3.1,
 
      AC_CHECK_LIB(gmp, __gmpz_mul_si, ,
        [AC_MSG_ERROR(
-       [GNU MP not found, or not 3.1 or up, see http://gmplib.org/])])
+       [GNU MP not found, or not 3.1 or up, see https://gmplib.org/])])
 
    An alternative would be to test the version number in `gmp.h' using
 say `AC_EGREP_CPP'.  That would make it possible to test the exact
@@ -2043,8 +2078,8 @@ you, and it is not too much to ask you to report the bugs you find.
 
    Before you report a bug, check it's not already addressed in *note
 Known Build Problems::, or perhaps *note Notes for Particular
-Systems::.  You may also want to check `http://gmplib.org/' for patches
-for this release.
+Systems::.  You may also want to check `https://gmplib.org/' for
+patches for this release.
 
    Please include the following in any report,
 
@@ -3136,44 +3171,7 @@ applications will not need them.
 
  -- Function: void mpz_array_init (mpz_t INTEGER_ARRAY, mp_size_t
           ARRAY_SIZE, mp_size_t FIXED_NUM_BITS)
-     This is a special type of initialization.  *Fixed* space of
-     FIXED_NUM_BITS is allocated to each of the ARRAY_SIZE integers in
-     INTEGER_ARRAY.  There is no way to free the storage allocated by
-     this function.  Don't call `mpz_clear'!
-
-     The INTEGER_ARRAY parameter is the first `mpz_t' in the array.  For
-     example,
-
-          mpz_t  arr[20000];
-          mpz_array_init (arr[0], 20000, 512);
-
-     This function is only intended for programs that create a large
-     number of integers and need to reduce memory usage by avoiding the
-     overheads of allocating and reallocating lots of small blocks.  In
-     normal programs this function is not recommended.
-
-     The space allocated to each integer by this function will not be
-     automatically increased, unlike the normal `mpz_init', so an
-     application must ensure it is sufficient for any value stored.
-     The following space requirements apply to various routines,
-
-        * `mpz_abs', `mpz_neg', `mpz_set', `mpz_set_si' and
-          `mpz_set_ui' need room for the value they store.
-
-        * `mpz_add', `mpz_add_ui', `mpz_sub' and `mpz_sub_ui' need room
-          for the larger of the two operands, plus an extra
-          `mp_bits_per_limb'.
-
-        * `mpz_mul', `mpz_mul_ui' and `mpz_mul_si' need room for the sum
-          of the number of bits in their operands, but each rounded up
-          to a multiple of `mp_bits_per_limb'.
-
-        * `mpz_swap' can be used between two array variables, but not
-          between an array and a normal variable.
-
-     For other functions, or if in doubt, the suggestion is to
-     calculate in a regular `mpz_init' variable and copy the result to
-     an array variable with `mpz_set'.
+     *This is an obsolete function.  Do not use it.*
 
  -- Function: void * _mpz_realloc (mpz_t INTEGER, mp_size_t NEW_ALLOC)
      Change the space for INTEGER to NEW_ALLOC limbs.  The value in
@@ -3196,6 +3194,71 @@ applications will not need them.
      Return the size of OP measured in number of limbs.  If OP is zero,
      the returned value will be zero.
 
+ -- Function: const mp_limb_t * mpz_limbs_read (const mpz_t X)
+     Return a pointer to the limb array representing the absolute value
+     of X.  The size of the array is `mpz_size(X)'. Intended for read
+     access only.
+
+ -- Function: mp_limb_t * mpz_limbs_write (mpz_t X, mp_size_t N)
+ -- Function: mp_limb_t * mpz_limbs_modify (mpz_t X, mp_size_t N)
+     Return a pointer to the limb array, intended for write access. The
+     array is reallocated as needed, to make room for N limbs. Requires
+     N > 0. The `mpz_limbs_modify' function returns an array that holds
+     the old absolute value of X, while `mpz_limbs_write' may destroy
+     the old value and return an array with unspecified contents.
+
+ -- Function: void mpz_limbs_finish (mpz_t X, mp_size_t S)
+     Updates the internal size field of X. Used after writing to the
+     limb array pointer returned by `mpz_limbs_write' or
+     `mpz_limbs_modify' is completed. The array should contain abs(S)
+     valid limbs, representing the new absolute value for X, and the
+     sign of X is taken from the sign of S. This function never
+     reallocates X, so the limb pointer remains valid.
+
+     void foo (mpz_t x)
+     {
+       mp_size_t n, i;
+       mp_limb_t *xp;
+
+       n = mpz_size (x);
+       xp = mpz_limbs_modify(x, 2*n);
+       for (i = 0; i < n; i++)
+         xp[n+i] = xp[n-1-i];
+       mpz_limbs_finish (x, mpz_sgn (x) < 0 ? - 2*n : 2*n);
+     }
+
+ -- Function: mpz_srcptr mpz_roinit_n (mpz_t X, const mp_limb_t *XP,
+          mp_size_t XS)
+     Special initialization of X, using the given limb array and size.
+     X should be treated as read-only: it can be passed safely as input
+     to any mpz function, but not as an output. The array XP must point
+     to at least a readable limb, its size is abs(XS), and the sign of
+     X is the sign of XS. For convenience, the function returns X, but
+     cast to a const pointer type.
+
+     void foo (mpz_t x)
+     {
+       static const mp_limb_t y[3] = { 0x1, 0x2, 0x3 };
+       mpz_t tmp;
+       mpz_add (x, x, mpz_roinit_n (tmp, y, 3));
+     }
+
+ -- Macro: mpz_t MPZ_ROINIT_N (mp_limb_t *XP, mp_size_t XS)
+     This macro expands to an initializer which can be assigned to an
+     mpz_t variable. The limb array XP must point to at least a
+     readable limb, moreover, unlike the `mpz_roinit_n' function, the
+     array must be normalized: if XS is non-zero, then `XP[abs(XS)-1]'
+     must be non-zero. Intended primarily for constant values. Using it
+     for non-constant values requires a C compiler supporting C99.
+
+     void foo (mpz_t x)
+     {
+       static const mp_limb_t ya[3] = { 0x1, 0x2, 0x3 };
+       static const mpz_t y = MPZ_ROINIT_N ((mp_limb_t *) ya, 3);
+
+       mpz_add (x, x, y);
+     }
+
 \1f
 File: gmp.info,  Node: Rational Number Functions,  Next: Floating-point Functions,  Prev: Integer Functions,  Up: Top
 
@@ -3501,9 +3564,9 @@ that can be increased or decreased at any time.
 most systems.  In the current implementation the exponent is a count of
 limbs, so for example on a 32-bit system this means a range of roughly
 2^-68719476768 to 2^68719476736, or on a 64-bit system this will be
-greater.  Note however `mpf_get_str' can only return an exponent which
-fits an `mp_exp_t' and currently `mpf_set_str' doesn't accept exponents
-bigger than a `long'.
+greater.  Note however that `mpf_get_str' can only return an exponent
+which fits an `mp_exp_t' and currently `mpf_set_str' doesn't accept
+exponents bigger than a `long'.
 
    Each variable keeps a size for the mantissa data actually in use.
 This means that if a float is exactly represented in only a few bits
@@ -3516,22 +3579,21 @@ precision" followed by a truncation to the destination precision, but
 of course the work done is only what's needed to determine a result
 under that definition.
 
-   The precision selected for a variable is a minimum value, GMP may
-increase it a little to facilitate efficient calculation.  Currently
-this means rounding up to a whole limb, and then sometimes having a
-further partial limb, depending on the high limb of the mantissa.  But
-applications shouldn't be concerned by such details.
+   The precision selected by the user for a variable is a minimum
+value, GMP may increase it to facilitate efficient calculation.
+Currently this means rounding up to a whole limb, and then sometimes
+having a further partial limb, depending on the high limb of the
+mantissa.
 
-   The mantissa in stored in binary, as might be imagined from the fact
-precisions are expressed in bits.  One consequence of this is that
+   The mantissa is stored in binary.  One consequence of this is that
 decimal fractions like 0.1 cannot be represented exactly.  The same is
 true of plain IEEE `double' floats.  This makes both highly unsuitable
 for calculations involving money or other values that should be exact
 decimal fractions.  (Suitably scaled integers, or perhaps rationals,
 are better choices.)
 
-   `mpf' functions and variables have no special notion of infinity or
-not-a-number, and applications must take care not to overflow the
+   The `mpf' functions and variables have no special notion of infinity
+or not-a-number, and applications must take care not to overflow the
 exponent or results will be unpredictable.  This might change in a
 future release.
 
@@ -3540,6 +3602,10 @@ extension to IEEE P754 arithmetic.  In particular results obtained on
 one computer often differ from the results on a computer with a
 different word size.
 
+   The GMP extension library MPFR (`http://mpfr.org') is an alternative
+to GMP's `mpf' functions.  MPFR provides well-defined precision and
+accurate rounding, and thereby naturally extends IEEE P754.
+
 * Menu:
 
 * Initializing Floats::
@@ -4108,7 +4174,9 @@ For example, {S1P, S1N}.
  -- Function: mp_limb_t mpn_neg (mp_limb_t *RP, const mp_limb_t *SP,
           mp_size_t N)
      Perform the negation of {SP, N}, and write the result to {RP, N}.
-     Return carry-out.
+     This is equivalent to calling `mpn_sub_n' with a N-limb zero
+     minuend and passing {SP, N} as subtrahend.  Return borrow, either
+     0 or 1.
 
  -- Function: void mpn_mul_n (mp_limb_t *RP, const mp_limb_t *S1P,
           const mp_limb_t *S2P, mp_size_t N)
@@ -4136,7 +4204,7 @@ For example, {S1P, S1N}.
           mp_size_t N)
      Compute the square of {S1P, N} and write the 2*N-limb result to RP.
 
-     The destination has to have space for 2*N limbs, even if the
+     The destination has to have space for 2N limbs, even if the
      result's most significant limb is zero.  No overlap is permitted
      between the destination and the source.
 
@@ -4359,6 +4427,13 @@ For example, {S1P, S1N}.
      A return value of zero indicates a perfect square.  See also
      `mpn_perfect_square_p'.
 
+ -- Function: size_t mpn_sizeinbase (const mp_limb_t *XP, mp_size_t N,
+          int BASE)
+     Return the size of {XP,N} measured in number of digits in the
+     given BASE.  BASE can vary from 2 to 62.  Requires N > 0 and
+     XP[N-1] > 0.  The result will be either exact or 1 too big.  If
+     BASE is a power of 2, the result is always exact.
+
  -- Function: mp_size_t mpn_get_str (unsigned char *STR, int BASE,
           mp_limb_t *S1P, mp_size_t S1N)
      Convert {S1P, S1N} to a raw unsigned char array at STR in base
@@ -4378,20 +4453,21 @@ For example, {S1P, S1N}.
           *STR, size_t STRSIZE, int BASE)
      Convert bytes {STR,STRSIZE} in the given BASE to limbs at RP.
 
-     STR[0] is the most significant byte and STR[STRSIZE-1] is the
-     least significant.  Each byte should be a value in the range 0 to
-     BASE-1, not an ASCII character.  BASE can vary from 2 to 256.
+     STR[0] is the most significant input byte and STR[STRSIZE-1] is
+     the least significant input byte.  Each byte should be a value in
+     the range 0 to BASE-1, not an ASCII character.  BASE can vary from
+     2 to 256.
 
-     The return value is the number of limbs written to RP.  If the most
-     significant input byte is non-zero then the high limb at RP will be
-     non-zero, and only that exact number of limbs will be required
-     there.
+     The converted value is {RP,RN} where RN is the return value.  If
+     the most significant input byte STR[0] is non-zero, then RP[RN-1]
+     will be non-zero, else RP[RN-1] and some number of subsequent
+     limbs may be zero.
 
-     If the most significant input byte is zero then there may be high
-     zero limbs written to RP and included in the return value.
+     The area at RP has to have space for the largest possible number
+     with STRSIZE digits in the chosen base, plus one extra limb.
 
-     STRSIZE must be at least 1, and no overlap is permitted between
-     {STR,STRSIZE} and the result at RP.
+     The input must have at least one byte, and no overlap is permitted
+     between {STR,STRSIZE} and the result at RP.
 
  -- Function: mp_bitcnt_t mpn_scan0 (const mp_limb_t *S1P, mp_bitcnt_t
           BIT)
@@ -4491,7 +4567,176 @@ For example, {S1P, S1N}.
      Zero {RP, N}.
 
 
-8.1 Nails
+8.1 Low-level functions for cryptography
+========================================
+
+The functions prefixed with `mpn_sec_' and `mpn_cnd_' are designed to
+perform the exact same low-level operations and have the same cache
+access patterns for any two same-size arguments, assuming that function
+arguments are placed at the same position and that the machine state is
+identical upon function entry.  These functions are intended for
+cryptographic purposes, where resilience to side-channel attacks is
+desired.
+
+   These functions are less efficient than their "leaky" counterparts;
+their performance for operands of the sizes typically used for
+cryptographic applications is between 15% and 100% worse.  For larger
+operands, these functions might be inadequate, since they rely on
+asymptotically elementary algorithms.
+
+   These functions do not make any explicit allocations.  Those of
+these functions that need scratch space accept a scratch space operand.
+This convention allows callers to keep sensitive data in designated
+memory areas.  Note however that compilers may choose to spill scalar
+values used within these functions to their stack frame and that such
+scalars may contain sensitive data.
+
+   In addition to these specially crafted functions, the following `mpn'
+functions are naturally side-channel resistant: `mpn_add_n',
+`mpn_sub_n', `mpn_lshift', `mpn_rshift', `mpn_zero', `mpn_copyi',
+`mpn_copyd', `mpn_com', and the logical function (`mpn_and_n', etc).
+
+   There are some exceptions from the side-channel resilience: (1) Some
+assembly implementations of `mpn_lshift' identify shift-by-one as a
+special case.  This is a problem iff the shift count is a function of
+sensitive data.  (2) Alpha ev6 and Pentium4 using 64-bit limbs have
+leaky `mpn_add_n' and `mpn_sub_n'.  (3) Alpha ev6 has a leaky
+`mpn_mul_1' which also makes `mpn_sec_mul' on those systems unsafe.
+
+ -- Function: mp_limb_t mpn_cnd_add_n (mp_limb_t CND, mp_limb_t *RP,
+          const mp_limb_t *S1P, const mp_limb_t *S2P, mp_size_t N)
+ -- Function: mp_limb_t mpn_cnd_sub_n (mp_limb_t CND, mp_limb_t *RP,
+          const mp_limb_t *S1P, const mp_limb_t *S2P, mp_size_t N)
+     These functions do conditional addition and subtraction.  If CND is
+     non-zero, they produce the same result as a regular `mpn_add_n' or
+     `mpn_sub_n', and if CND is zero, they copy {S1P,N} to the result
+     area and return zero.  The functions are designed to have timing
+     and memory access patterns depending only on size and location of
+     the data areas, but independent of the condition CND.  Like for
+     `mpn_add_n' and `mpn_sub_n', on most machines, the timing will
+     also be independent of the actual limb values.
+
+ -- Function: mp_limb_t mpn_sec_add_1 (mp_limb_t *RP, const mp_limb_t
+          *AP, mp_size_t N, mp_limb_t B, mp_limb_t *TP)
+ -- Function: mp_limb_t mpn_sec_sub_1 (mp_limb_t *RP, const mp_limb_t
+          *AP, mp_size_t N, mp_limb_t B, mp_limb_t *TP)
+     Set R to A + B or A - B, respectively, where R = {RP,N}, A =
+     {AP,N}, and B is a single limb. Returns carry.
+
+     These functions take O(N) time, unlike the leaky functions
+     `mpn_add_1' which are O(1) on average. They require scratch space
+     of `mpn_sec_add_1_itch(N)' and `mpn_sec_sub_1_itch(N)' limbs,
+     respectively, to be passed in the TP parameter. The scratch space
+     requirements are guaranteed to increase monotonously in the
+     operand size.
+
+ -- Function: void mpn_sec_mul (mp_limb_t *RP, const mp_limb_t *AP,
+          mp_size_t AN, const mp_limb_t *BP, mp_size_t BN, mp_limb_t
+          *TP)
+ -- Function: mp_size_t mpn_sec_mul_itch (mp_size_t AN, mp_size_t BN)
+     Set R to A * B, where A = {AP,AN}, B = {BP,BN}, and R = {RP,AN+BN}.
+
+     It is required that AN >= BN > 0.
+
+     No overlapping between R and the input operands is allowed.  For A
+     = B, use `mpn_sec_sqr' for optimal performance.
+
+     This function requires scratch space of `mpn_sec_mul_itch(AN, BN)'
+     limbs to be passed in the TP parameter.  The scratch space
+     requirements are guaranteed to increase monotonously in the
+     operand sizes.
+
+ -- Function: void mpn_sec_sqr (mp_limb_t *RP, const mp_limb_t *AP,
+          mp_size_t AN, mp_limb_t *TP)
+ -- Function: mp_size_t mpn_sec_sqr_itch (mp_size_t AN)
+     Set R to A^2, where A = {AP,AN}, and R = {RP,2AN}.
+
+     It is required that AN > 0.
+
+     No overlapping between R and the input operands is allowed.
+
+     This function requires scratch space of `mpn_sec_sqr_itch(AN)'
+     limbs to be passed in the TP parameter.  The scratch space
+     requirements are guaranteed to increase monotonously in the
+     operand size.
+
+ -- Function: void mpn_sec_powm (mp_limb_t *RP, const mp_limb_t *BP,
+          mp_size_t BN, const mp_limb_t *EP, mp_bitcnt_t ENB, const
+          mp_limb_t *MP, mp_size_t N, mp_limb_t *TP)
+ -- Function: mp_size_t mpn_sec_powm_itch (mp_size_t BN, mp_bitcnt_t
+          ENB, size_t N)
+     Set R to (B raised to E) modulo M, where R = {RP,N}, M = {MP,N},
+     and E = {EP,ceil(ENB / `GMP_NUMB_BITS')}.
+
+     It is required that B > 0, that M > 0 is odd, and that E < 2^ENB.
+
+     No overlapping between R and the input operands is allowed.
+
+     This function requires scratch space of `mpn_sec_powm_itch(BN,
+     ENB, N)' limbs to be passed in the TP parameter.  The scratch
+     space requirements are guaranteed to increase monotonously in the
+     operand sizes.
+
+ -- Function: void mpn_sec_tabselect (mp_limb_t *RP, const mp_limb_t
+          *TAB, mp_size_t N, mp_size_t NENTS, mp_size_t WHICH)
+     Select entry WHICH from table TAB, which has NENTS entries, each N
+     limbs.  Store the selected entry at RP.
+
+     This function reads the entire table to avoid side-channel
+     information leaks.
+
+ -- Function: mp_limb_t mpn_sec_div_qr (mp_limb_t *QP, mp_limb_t *NP,
+          mp_size_t NN, const mp_limb_t *DP, mp_size_t DN, mp_limb_t
+          *TP)
+ -- Function: mp_size_t mpn_sec_div_qr_itch (mp_size_t NN, mp_size_t DN)
+     Set Q to the truncated quotient N / D and R to N modulo D, where N
+     = {NP,NN}, D = {DP,DN}, Q's most significant limb is the function
+     return value and the remaining limbs are {QP,NN-DN}, and R =
+     {NP,DN}.
+
+     It is required that NN >= DN >= 1, and that DP[DN-1] != 0.  This
+     does not imply that N >= D since N might be zero-padded.
+
+     Note the overlapping between N and R.  No other operand overlapping
+     is allowed.  The entire space occupied by N is overwritten.
+
+     This function requires scratch space of `mpn_sec_div_qr_itch(NN,
+     DN)' limbs to be passed in the TP parameter.
+
+ -- Function: void mpn_sec_div_r (mp_limb_t *NP, mp_size_t NN, const
+          mp_limb_t *DP, mp_size_t DN, mp_limb_t *TP)
+ -- Function: mp_size_t mpn_sec_div_r_itch (mp_size_t NN, mp_size_t DN)
+     Set R to N modulo D, where N = {NP,NN}, D = {DP,DN}, and R =
+     {NP,DN}.
+
+     It is required that NN >= DN >= 1, and that DP[DN-1] != 0.  This
+     does not imply that N >= D since N might be zero-padded.
+
+     Note the overlapping between N and R.  No other operand overlapping
+     is allowed.  The entire space occupied by N is overwritten.
+
+     This function requires scratch space of `mpn_sec_div_r_itch(NN,
+     DN)' limbs to be passed in the TP parameter.
+
+ -- Function: int mpn_sec_invert (mp_limb_t *RP, mp_limb_t *AP, const
+          mp_limb_t *MP, mp_size_t N, mp_bitcnt_t NBCNT, mp_limb_t *TP)
+ -- Function: mp_size_t mpn_sec_invert_itch (mp_size_t N)
+     Set R to the inverse of A modulo M, where R = {RP,N}, A = {AP,N},
+     and M = {MP,N}.  *This function's interface is preliminary.*
+
+     If an inverse exists, return 1, otherwise return 0 and leave R
+     undefined. In either case, the input A is destroyed.
+
+     It is required that M is odd, and that NBCNT >= ceil(log(A+1)) +
+     ceil(log(M+1)).  A safe choice is NBCNT = 2 * N * GMP_NUMB_BITS,
+     but a smaller value might improve performance if M or A are known
+     to have leading zero bits.
+
+     This function requires scratch space of `mpn_sec_invert_itch(N)'
+     limbs to be passed in the TP parameter.
+
+
+8.2 Nails
 =========
 
 *Everything in this section is highly experimental and may disappear or
@@ -4945,7 +5190,7 @@ The following functions are provided in `libgmpxx' (*note Headers and
 Libraries::), which is built if C++ support is enabled (*note Build
 Options::).  Prototypes are available from `<gmp.h>'.
 
- -- Function: ostream& operator<< (ostream& STREAM, mpz_t OP)
+ -- Function: ostream& operator<< (ostream& STREAM, const mpz_t OP)
      Print OP to STREAM, using its `ios' formatting settings.
      `ios::width' is reset to 0 after output, the same as the standard
      `ostream operator<<' routines do.
@@ -4954,7 +5199,7 @@ Options::).  Prototypes are available from `<gmp.h>'.
      decimal.  This is unlike the standard `operator<<' routines on
      `int' etc, which instead give twos complement.
 
- -- Function: ostream& operator<< (ostream& STREAM, mpq_t OP)
+ -- Function: ostream& operator<< (ostream& STREAM, const mpq_t OP)
      Print OP to STREAM, using its `ios' formatting settings.
      `ios::width' is reset to 0 after output, the same as the standard
      `ostream operator<<' routines do.
@@ -4967,7 +5212,7 @@ Options::).  Prototypes are available from `<gmp.h>'.
      on both the numerator and denominator (if the denominator is
      required).
 
- -- Function: ostream& operator<< (ostream& STREAM, mpf_t OP)
+ -- Function: ostream& operator<< (ostream& STREAM, const mpf_t OP)
      Print OP to STREAM, using its `ios' formatting settings.
      `ios::width' is reset to 0 after output, the same as the standard
      `ostream operator<<' routines do.
@@ -5260,8 +5505,7 @@ offers overloaded functions and operators which may be more convenient.
 
    Due to the implementation of this interface, a reasonably recent C++
 compiler is required, one supporting namespaces, partial specialization
-of templates and member templates.  For GCC this means version 2.91 or
-later.
+of templates and member templates.
 
    *Everything described in this chapter is to be considered preliminary
 and might be subject to incompatible changes if some unforeseen
@@ -5381,7 +5625,7 @@ File: gmp.info,  Node: C++ Interface Integers,  Next: C++ Interface Rationals,
      corresponding C function, for example `double' follows `mpz_set_d'
      (*note Assigning Integers::).
 
- -- Function: explicit mpz_class::mpz_class (mpz_t Z)
+ -- Function: explicit mpz_class::mpz_class (const mpz_t Z)
      Construct an `mpz_class' from an `mpz_t'.  The value in Z is
      copied into the new `mpz_class', there won't be any permanent
      association between it and Z.
@@ -5472,7 +5716,7 @@ called.
           mpq_class q (1.75);
           mpq_class q (1, 3);
 
- -- Function: explicit mpq_class::mpq_class (mpq_t Q)
+ -- Function: explicit mpq_class::mpq_class (const mpq_t Q)
      Construct an `mpq_class' from an `mpq_t'.  The value in Q is
      copied into the new `mpq_class', there won't be any permanent
      association between it and Q.
@@ -5573,8 +5817,8 @@ used if this doesn't suit.
           mpf_class f(-g, 1000);   // 1000 bits (at least)
           mpf_class f(x+y);        // greater of precisions of x and y
 
- -- Function: explicit mpf_class::mpf_class (mpf_t F)
- -- Function:  mpf_class::mpf_class (mpf_t F, mp_bitcnt_t PREC)
+ -- Function: explicit mpf_class::mpf_class (const mpf_t F)
+ -- Function:  mpf_class::mpf_class (const mpf_t F, mp_bitcnt_t PREC)
      Construct an `mpf_class' from an `mpf_t'.  The value in F is
      copied into the new `mpf_class', there won't be any permanent
      association between it and F.
@@ -5798,6 +6042,27 @@ Templated Expressions
             fun2 (f, T(f+g));  // Good
           }
 
+C++11
+     C++11 provides several new ways in which types can be inferred:
+     `auto', `decltype', etc. While they can be very convenient, they
+     don't mix well with expression templates. In this example, the
+     addition is performed twice, as if we had defined `sum' as a macro.
+
+          mpz_class z = 33;
+          auto sum = z + z;
+          mpz_class prod = sum * sum;
+
+     This other example may crash, though some compilers might make it
+     look like it is working, because the expression `z+z' goes out of
+     scope before it is evaluated.
+
+          mpz_class z = 33;
+          auto sum = z + z + z;
+          mpz_class prod = sum * 2;
+
+     It is thus strongly recommended to avoid `auto' anywhere a GMP C++
+     expression may appear.
+
 \1f
 File: gmp.info,  Node: Custom Allocation,  Next: Language Bindings,  Prev: C++ Class Interface,  Up: Top
 
@@ -5914,7 +6179,7 @@ C++
           Straightforward interface, expression templates to eliminate
           temporaries.
 
-        * ALP `http://www-sop.inria.fr/saga/logiciels/ALP/'
+        * ALP `https://www-sop.inria.fr/saga/logiciels/ALP/'
           Linear algebra and polynomials using templates.
 
         * Arithmos `http://cant.ua.ac.be/old/arithmos/'
@@ -5923,9 +6188,6 @@ C++
         * CLN `http://www.ginac.de/CLN/'
           High level classes for arithmetic.
 
-        * LiDIA `http://www.cdc.informatik.tu-darmstadt.de/TI/LiDIA/'
-          A C++ library for computational number theory.
-
         * Linbox `http://www.linalg.org/'
           Sparse vectors and matrices.
 
@@ -5935,20 +6197,14 @@ C++
 Eiffel
         * Eiffelroom `http://www.eiffelroom.org/node/442'
 
-Fortran
-        * Omni F77 `http://phase.hpcc.jp/Omni/home.html'
-          Arbitrary precision floats.
-
 Haskell
-        * Glasgow Haskell Compiler `http://www.haskell.org/ghc/'
+        * Glasgow Haskell Compiler `https://www.haskell.org/ghc/'
 
 Java
-        * Kaffe `http://www.kaffe.org/'
-
-        * Kissme `http://kissme.sourceforge.net/'
+        * Kaffe `https://github.com/kaffe/kaffe'
 
 Lisp
-        * GNU Common Lisp `http://www.gnu.org/software/gcl/gcl.html'
+        * GNU Common Lisp `https://www.gnu.org/software/gcl/gcl.html'
 
         * Librep `http://librep.sourceforge.net/'
 
@@ -5963,13 +6219,13 @@ ML
         * MLton compiler `http://mlton.org/'
 
 Objective Caml
-        * MLGMP `http://www.di.ens.fr/~monniaux/programmes.html.en'
+        * MLGMP `http://opam.ocamlpro.com/pkg/mlgmp.20120224.html'
 
         * Numerix `http://pauillac.inria.fr/~quercia/'
           Optionally using GMP.
 
 Oz
-        * Mozart `http://www.mozart-oz.org/'
+        * Mozart `http://mozart.github.io/'
 
 Pascal
         * GNU Pascal Compiler `http://www.gnu-pascal.de/'
@@ -5998,25 +6254,24 @@ Prolog
           Arbitrary precision floats.
 
 Python
-        * GMPY `http://code.google.com/p/gmpy/'
+        * GMPY `https://code.google.com/p/gmpy/'
 
 Ruby
         * http://rubygems.org/gems/gmp
 
 Scheme
-        * GNU Guile (upcoming 1.8)
-          `http://www.gnu.org/software/guile/guile.html'
+        * GNU Guile `https://www.gnu.org/software/guile/guile.html'
 
         * RScheme `http://www.rscheme.org/'
 
-        * STklos `http://www.stklos.org/'
+        * STklos `http://www.stklos.net/'
 
 Smalltalk
         * GNU Smalltalk
           `http://www.smalltalk.org/versions/GNUSmalltalk.html'
 
 Other
-        * Axiom `http://savannah.nongnu.org/projects/axiom'
+        * Axiom `https://savannah.nongnu.org/projects/axiom'
           Computer algebra using GCL.
 
         * DrGenius `http://drgenius.seul.org/'
@@ -6025,19 +6280,16 @@ Other
         * GiNaC `http://www.ginac.de/'
           C++ computer algebra using CLN.
 
-        * GOO `http://www.googoogaga.org/'
+        * GOO `https://www.eecs.berkeley.edu/~jrb/goo/'
           Dynamic object oriented language.
 
-        * Maxima `http://www.ma.utexas.edu/users/wfs/maxima.html'
+        * Maxima `https://www.ma.utexas.edu/users/wfs/maxima.html'
           Macsyma computer algebra using GCL.
 
-        * Q `http://q-lang.sourceforge.net/'
-          Equational programming system.
-
         * Regina `http://regina.sourceforge.net/'
           Topological calculator.
 
-        * Yacas `yacas.sourceforge.net'
+        * Yacas `http://yacas.sourceforge.net'
           Yet another computer algebra system.
 
 
@@ -6425,10 +6677,10 @@ degree Toom'n'half is used.
 
    Toom'n'half means that the existence of one more piece is considered
 for a single operand. It can be virtual, i.e. zero, or real, when the
-two operand are not exactly balanced. By chosing an even r, Toom-r+1/2
+two operand are not exactly balanced. By choosing an even r, Toom-r+1/2
 requires 2r points, a multiple of four.
 
-   The four-plets of points inlcude 0, inf, +1, -1 and +-2^i, +-2^-i .
+   The four-plets of points include 0, inf, +1, -1 and +-2^i, +-2^-i .
 Each of them giving shortcuts for the evaluation phase and for some
 steps in the interpolation phase. Further tricks are used to reduce the
 memory footprint of the whole multiplication algorithm to a memory
@@ -6814,262 +7066,6 @@ limb.  The multiplications don't need to be on the dependent chain, as
 long as the effect of the borrows is applied, which can help chips with
 pipelined multipliers.
 
-\1f
-File: gmp.info,  Node: Exact Remainder,  Next: Small Quotient Division,  Prev: Exact Division,  Up: Division Algorithms
-
-15.2.6 Exact Remainder
-----------------------
-
-If the exact division algorithm is done with a full subtraction at each
-stage and the dividend isn't a multiple of the divisor, then low zero
-limbs are produced but with a remainder in the high limbs.  For
-dividend a, divisor d, quotient q, and b = 2^mp_bits_per_limb, this
-remainder r is of the form
-
-     a = q*d + r*b^n
-
-   n represents the number of zero limbs produced by the subtractions,
-that being the number of limbs produced for q.  r will be in the range
-0<=r<d and can be viewed as a remainder, but one shifted up by a factor
-of b^n.
-
-   Carrying out full subtractions at each stage means the same number
-of cross products must be done as a normal division, but there's still
-some single limb divisions saved.  When d is a single limb some
-simplifications arise, providing good speedups on a number of
-processors.
-
-   The functions `mpn_divexact_by3', `mpn_modexact_1_odd' and the
-internal `mpn_redc_X' functions differ subtly in how they return r,
-leading to some negations in the above formula, but all are essentially
-the same.
-
-   Clearly r is zero when a is a multiple of d, and this leads to
-divisibility or congruence tests which are potentially more efficient
-than a normal division.
-
-   The factor of b^n on r can be ignored in a GCD when d is odd, hence
-the use of `mpn_modexact_1_odd' by `mpn_gcd_1' and `mpz_kronecker_ui'
-etc (*note Greatest Common Divisor Algorithms::).
-
-   Montgomery's REDC method for modular multiplications uses operands
-of the form of x*b^-n and y*b^-n and on calculating (x*b^-n)*(y*b^-n)
-uses the factor of b^n in the exact remainder to reach a product in the
-same form (x*y)*b^-n (*note Modular Powering Algorithm::).
-
-   Notice that r generally gives no useful information about the
-ordinary remainder a mod d since b^n mod d could be anything.  If
-however b^n == 1 mod d, then r is the negative of the ordinary
-remainder.  This occurs whenever d is a factor of b^n-1, as for example
-with 3 in `mpn_divexact_by3'.  For a 32 or 64 bit limb other such
-factors include 5, 17 and 257, but no particular use has been found for
-this.
-
-\1f
-File: gmp.info,  Node: Small Quotient Division,  Prev: Exact Remainder,  Up: Division Algorithms
-
-15.2.7 Small Quotient Division
-------------------------------
-
-An NxM division where the number of quotient limbs Q=N-M is small can
-be optimized somewhat.
-
-   An ordinary basecase division normalizes the divisor by shifting it
-to make the high bit set, shifting the dividend accordingly, and
-shifting the remainder back down at the end of the calculation.  This
-is wasteful if only a few quotient limbs are to be formed.  Instead a
-division of just the top 2*Q limbs of the dividend by the top Q limbs
-of the divisor can be used to form a trial quotient.  This requires
-only those limbs normalized, not the whole of the divisor and dividend.
-
-   A multiply and subtract then applies the trial quotient to the M-Q
-unused limbs of the divisor and N-Q dividend limbs (which includes Q
-limbs remaining from the trial quotient division).  The starting trial
-quotient can be 1 or 2 too big, but all cases of 2 too big and most
-cases of 1 too big are detected by first comparing the most significant
-limbs that will arise from the subtraction.  An addback is done if the
-quotient still turns out to be 1 too big.
-
-   This whole procedure is essentially the same as one step of the
-basecase algorithm done in a Q limb base, though with the trial
-quotient test done only with the high limbs, not an entire Q limb
-"digit" product.  The correctness of this weaker test can be
-established by following the argument of Knuth section 4.3.1 exercise
-20 but with the v2*q>b*r+u2 condition appropriately relaxed.
-
-\1f
-File: gmp.info,  Node: Greatest Common Divisor Algorithms,  Next: Powering Algorithms,  Prev: Division Algorithms,  Up: Algorithms
-
-15.3 Greatest Common Divisor
-============================
-
-* Menu:
-
-* Binary GCD::
-* Lehmer's Algorithm::
-* Subquadratic GCD::
-* Extended GCD::
-* Jacobi Symbol::
-
-\1f
-File: gmp.info,  Node: Binary GCD,  Next: Lehmer's Algorithm,  Prev: Greatest Common Divisor Algorithms,  Up: Greatest Common Divisor Algorithms
-
-15.3.1 Binary GCD
------------------
-
-At small sizes GMP uses an O(N^2) binary style GCD.  This is described
-in many textbooks, for example Knuth section 4.5.2 algorithm B.  It
-simply consists of successively reducing odd operands a and b using
-
-     a,b = abs(a-b),min(a,b)
-     strip factors of 2 from a
-
-   The Euclidean GCD algorithm, as per Knuth algorithms E and A,
-repeatedly computes the quotient q = floor(a/b) and replaces a,b by v,
-u - q v. The binary algorithm has so far been found to be faster than
-the Euclidean algorithm everywhere.  One reason the binary method does
-well is that the implied quotient at each step is usually small, so
-often only one or two subtractions are needed to get the same effect as
-a division.  Quotients 1, 2 and 3 for example occur 67.7% of the time,
-see Knuth section 4.5.3 Theorem E.
-
-   When the implied quotient is large, meaning b is much smaller than
-a, then a division is worthwhile.  This is the basis for the initial a
-mod b reductions in `mpn_gcd' and `mpn_gcd_1' (the latter for both Nx1
-and 1x1 cases).  But after that initial reduction, big quotients occur
-too rarely to make it worth checking for them.
-
-
-   The final 1x1 GCD in `mpn_gcd_1' is done in the generic C code as
-described above.  For two N-bit operands, the algorithm takes about
-0.68 iterations per bit.  For optimum performance some attention needs
-to be paid to the way the factors of 2 are stripped from a.
-
-   Firstly it may be noted that in twos complement the number of low
-zero bits on a-b is the same as b-a, so counting or testing can begin on
-a-b without waiting for abs(a-b) to be determined.
-
-   A loop stripping low zero bits tends not to branch predict well,
-since the condition is data dependent.  But on average there's only a
-few low zeros, so an option is to strip one or two bits arithmetically
-then loop for more (as done for AMD K6).  Or use a lookup table to get
-a count for several bits then loop for more (as done for AMD K7).  An
-alternative approach is to keep just one of a or b odd and iterate
-
-     a,b = abs(a-b), min(a,b)
-     a = a/2 if even
-     b = b/2 if even
-
-   This requires about 1.25 iterations per bit, but stripping of a
-single bit at each step avoids any branching.  Repeating the bit strip
-reduces to about 0.9 iterations per bit, which may be a worthwhile
-tradeoff.
-
-   Generally with the above approaches a speed of perhaps 6 cycles per
-bit can be achieved, which is still not terribly fast with for instance
-a 64-bit GCD taking nearly 400 cycles.  It's this sort of time which
-means it's not usually advantageous to combine a set of divisibility
-tests into a GCD.
-
-   Currently, the binary algorithm is used for GCD only when N < 3.
-
-\1f
-File: gmp.info,  Node: Lehmer's Algorithm,  Next: Subquadratic GCD,  Prev: Binary GCD,  Up: Greatest Common Divisor Algorithms
-
-15.3.2 Lehmer's algorithm
--------------------------
-
-Lehmer's improvement of the Euclidean algorithms is based on the
-observation that the initial part of the quotient sequence depends only
-on the most significant parts of the inputs. The variant of Lehmer's
-algorithm used in GMP splits off the most significant two limbs, as
-suggested, e.g., in "A Double-Digit Lehmer-Euclid Algorithm" by
-Jebelean (*note References::). The quotients of two double-limb inputs
-are collected as a 2 by 2 matrix with single-limb elements. This is
-done by the function `mpn_hgcd2'. The resulting matrix is applied to
-the inputs using `mpn_mul_1' and `mpn_submul_1'. Each iteration usually
-reduces the inputs by almost one limb. In the rare case of a large
-quotient, no progress can be made by examining just the most
-significant two limbs, and the quotient is computed using plain
-division.
-
-   The resulting algorithm is asymptotically O(N^2), just as the
-Euclidean algorithm and the binary algorithm. The quadratic part of the
-work are the calls to `mpn_mul_1' and `mpn_submul_1'. For small sizes,
-the linear work is also significant. There are roughly N calls to the
-`mpn_hgcd2' function. This function uses a couple of important
-optimizations:
-
-   * It uses the same relaxed notion of correctness as `mpn_hgcd' (see
-     next section). This means that when called with the most
-     significant two limbs of two large numbers, the returned matrix
-     does not always correspond exactly to the initial quotient
-     sequence for the two large numbers; the final quotient may
-     sometimes be one off.
-
-   * It takes advantage of the fact the quotients are usually small.
-     The division operator is not used, since the corresponding
-     assembler instruction is very slow on most architectures. (This
-     code could probably be improved further, it uses many branches
-     that are unfriendly to prediction).
-
-   * It switches from double-limb calculations to single-limb
-     calculations half-way through, when the input numbers have been
-     reduced in size from two limbs to one and a half.
-
-
-\1f
-File: gmp.info,  Node: Subquadratic GCD,  Next: Extended GCD,  Prev: Lehmer's Algorithm,  Up: Greatest Common Divisor Algorithms
-
-15.3.3 Subquadratic GCD
------------------------
-
-For inputs larger than `GCD_DC_THRESHOLD', GCD is computed via the HGCD
-(Half GCD) function, as a generalization to Lehmer's algorithm.
-
-   Let the inputs a,b be of size N limbs each. Put S = floor(N/2) + 1.
-Then HGCD(a,b) returns a transformation matrix T with non-negative
-elements, and reduced numbers (c;d) = T^-1 (a;b). The reduced numbers
-c,d must be larger than S limbs, while their difference abs(c-d) must
-fit in S limbs. The matrix elements will also be of size roughly N/2.
-
-   The HGCD base case uses Lehmer's algorithm, but with the above stop
-condition that returns reduced numbers and the corresponding
-transformation matrix half-way through. For inputs larger than
-`HGCD_THRESHOLD', HGCD is computed recursively, using the divide and
-conquer algorithm in "On Schönhage's algorithm and subquadratic integer
-GCD computation" by Möller (*note References::). The recursive
-algorithm consists of these main steps.
-
-   * Call HGCD recursively, on the most significant N/2 limbs. Apply the
-     resulting matrix T_1 to the full numbers, reducing them to a size
-     just above 3N/2.
-
-   * Perform a small number of division or subtraction steps to reduce
-     the numbers to size below 3N/2. This is essential mainly for the
-     unlikely case of large quotients.
-
-   * Call HGCD recursively, on the most significant N/2 limbs of the
-     reduced numbers. Apply the resulting matrix T_2 to the full
-     numbers, reducing them to a size just above N/2.
-
-   * Compute T = T_1 T_2.
-
-   * Perform a small number of division and subtraction steps to
-     satisfy the requirements, and return.
-
-   GCD is then implemented as a loop around HGCD, similarly to Lehmer's
-algorithm. Where Lehmer repeatedly chops off the top two limbs, calls
-`mpn_hgcd2', and applies the resulting matrix to the full numbers, the
-subquadratic GCD chops off the most significant third of the limbs (the
-proportion is a tuning parameter, and 1/3 seems to be more efficient
-than, e.g, 1/2), calls `mpn_hgcd', and applies the resulting matrix.
-Once the input numbers are reduced to size below `GCD_DC_THRESHOLD',
-Lehmer's algorithm is used for the rest of the work.
-
-   The asymptotic running time of both HGCD and GCD is O(M(N)*log(N)),
-where M(N) is the time for multiplying two N-limb numbers.
-
 
 \1f
 Local Variables:
index 52b884c99b61a03971568a5cc04cd95a3c636b20..9dd7c3440791dd1571072104a6d584f40958cd35 100644 (file)
@@ -2,11 +2,9 @@ This is ../../gmp/doc/gmp.info, produced by makeinfo version 4.13 from
 ../../gmp/doc/gmp.texi.
 
 This manual describes how to install and use the GNU multiple precision
-arithmetic library, version 5.1.3.
+arithmetic library, version 6.0.0.
 
-   Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
-2013 Free Software Foundation, Inc.
+   Copyright 1991, 1993-2014 Free Software Foundation, Inc.
 
    Permission is granted to copy, distribute and/or modify this
 document under the terms of the GNU Free Documentation License, Version
@@ -21,6 +19,262 @@ START-INFO-DIR-ENTRY
 * gmp: (gmp).                   GNU Multiple Precision Arithmetic Library.
 END-INFO-DIR-ENTRY
 
+\1f
+File: gmp.info,  Node: Exact Remainder,  Next: Small Quotient Division,  Prev: Exact Division,  Up: Division Algorithms
+
+15.2.6 Exact Remainder
+----------------------
+
+If the exact division algorithm is done with a full subtraction at each
+stage and the dividend isn't a multiple of the divisor, then low zero
+limbs are produced but with a remainder in the high limbs.  For
+dividend a, divisor d, quotient q, and b = 2^mp_bits_per_limb, this
+remainder r is of the form
+
+     a = q*d + r*b^n
+
+   n represents the number of zero limbs produced by the subtractions,
+that being the number of limbs produced for q.  r will be in the range
+0<=r<d and can be viewed as a remainder, but one shifted up by a factor
+of b^n.
+
+   Carrying out full subtractions at each stage means the same number
+of cross products must be done as a normal division, but there's still
+some single limb divisions saved.  When d is a single limb some
+simplifications arise, providing good speedups on a number of
+processors.
+
+   The functions `mpn_divexact_by3', `mpn_modexact_1_odd' and the
+internal `mpn_redc_X' functions differ subtly in how they return r,
+leading to some negations in the above formula, but all are essentially
+the same.
+
+   Clearly r is zero when a is a multiple of d, and this leads to
+divisibility or congruence tests which are potentially more efficient
+than a normal division.
+
+   The factor of b^n on r can be ignored in a GCD when d is odd, hence
+the use of `mpn_modexact_1_odd' by `mpn_gcd_1' and `mpz_kronecker_ui'
+etc (*note Greatest Common Divisor Algorithms::).
+
+   Montgomery's REDC method for modular multiplications uses operands
+of the form of x*b^-n and y*b^-n and on calculating (x*b^-n)*(y*b^-n)
+uses the factor of b^n in the exact remainder to reach a product in the
+same form (x*y)*b^-n (*note Modular Powering Algorithm::).
+
+   Notice that r generally gives no useful information about the
+ordinary remainder a mod d since b^n mod d could be anything.  If
+however b^n == 1 mod d, then r is the negative of the ordinary
+remainder.  This occurs whenever d is a factor of b^n-1, as for example
+with 3 in `mpn_divexact_by3'.  For a 32 or 64 bit limb other such
+factors include 5, 17 and 257, but no particular use has been found for
+this.
+
+\1f
+File: gmp.info,  Node: Small Quotient Division,  Prev: Exact Remainder,  Up: Division Algorithms
+
+15.2.7 Small Quotient Division
+------------------------------
+
+An NxM division where the number of quotient limbs Q=N-M is small can
+be optimized somewhat.
+
+   An ordinary basecase division normalizes the divisor by shifting it
+to make the high bit set, shifting the dividend accordingly, and
+shifting the remainder back down at the end of the calculation.  This
+is wasteful if only a few quotient limbs are to be formed.  Instead a
+division of just the top 2*Q limbs of the dividend by the top Q limbs
+of the divisor can be used to form a trial quotient.  This requires
+only those limbs normalized, not the whole of the divisor and dividend.
+
+   A multiply and subtract then applies the trial quotient to the M-Q
+unused limbs of the divisor and N-Q dividend limbs (which includes Q
+limbs remaining from the trial quotient division).  The starting trial
+quotient can be 1 or 2 too big, but all cases of 2 too big and most
+cases of 1 too big are detected by first comparing the most significant
+limbs that will arise from the subtraction.  An addback is done if the
+quotient still turns out to be 1 too big.
+
+   This whole procedure is essentially the same as one step of the
+basecase algorithm done in a Q limb base, though with the trial
+quotient test done only with the high limbs, not an entire Q limb
+"digit" product.  The correctness of this weaker test can be
+established by following the argument of Knuth section 4.3.1 exercise
+20 but with the v2*q>b*r+u2 condition appropriately relaxed.
+
+\1f
+File: gmp.info,  Node: Greatest Common Divisor Algorithms,  Next: Powering Algorithms,  Prev: Division Algorithms,  Up: Algorithms
+
+15.3 Greatest Common Divisor
+============================
+
+* Menu:
+
+* Binary GCD::
+* Lehmer's Algorithm::
+* Subquadratic GCD::
+* Extended GCD::
+* Jacobi Symbol::
+
+\1f
+File: gmp.info,  Node: Binary GCD,  Next: Lehmer's Algorithm,  Prev: Greatest Common Divisor Algorithms,  Up: Greatest Common Divisor Algorithms
+
+15.3.1 Binary GCD
+-----------------
+
+At small sizes GMP uses an O(N^2) binary style GCD.  This is described
+in many textbooks, for example Knuth section 4.5.2 algorithm B.  It
+simply consists of successively reducing odd operands a and b using
+
+     a,b = abs(a-b),min(a,b)
+     strip factors of 2 from a
+
+   The Euclidean GCD algorithm, as per Knuth algorithms E and A,
+repeatedly computes the quotient q = floor(a/b) and replaces a,b by v,
+u - q v. The binary algorithm has so far been found to be faster than
+the Euclidean algorithm everywhere.  One reason the binary method does
+well is that the implied quotient at each step is usually small, so
+often only one or two subtractions are needed to get the same effect as
+a division.  Quotients 1, 2 and 3 for example occur 67.7% of the time,
+see Knuth section 4.5.3 Theorem E.
+
+   When the implied quotient is large, meaning b is much smaller than
+a, then a division is worthwhile.  This is the basis for the initial a
+mod b reductions in `mpn_gcd' and `mpn_gcd_1' (the latter for both Nx1
+and 1x1 cases).  But after that initial reduction, big quotients occur
+too rarely to make it worth checking for them.
+
+
+   The final 1x1 GCD in `mpn_gcd_1' is done in the generic C code as
+described above.  For two N-bit operands, the algorithm takes about
+0.68 iterations per bit.  For optimum performance some attention needs
+to be paid to the way the factors of 2 are stripped from a.
+
+   Firstly it may be noted that in twos complement the number of low
+zero bits on a-b is the same as b-a, so counting or testing can begin on
+a-b without waiting for abs(a-b) to be determined.
+
+   A loop stripping low zero bits tends not to branch predict well,
+since the condition is data dependent.  But on average there's only a
+few low zeros, so an option is to strip one or two bits arithmetically
+then loop for more (as done for AMD K6).  Or use a lookup table to get
+a count for several bits then loop for more (as done for AMD K7).  An
+alternative approach is to keep just one of a or b odd and iterate
+
+     a,b = abs(a-b), min(a,b)
+     a = a/2 if even
+     b = b/2 if even
+
+   This requires about 1.25 iterations per bit, but stripping of a
+single bit at each step avoids any branching.  Repeating the bit strip
+reduces to about 0.9 iterations per bit, which may be a worthwhile
+tradeoff.
+
+   Generally with the above approaches a speed of perhaps 6 cycles per
+bit can be achieved, which is still not terribly fast with for instance
+a 64-bit GCD taking nearly 400 cycles.  It's this sort of time which
+means it's not usually advantageous to combine a set of divisibility
+tests into a GCD.
+
+   Currently, the binary algorithm is used for GCD only when N < 3.
+
+\1f
+File: gmp.info,  Node: Lehmer's Algorithm,  Next: Subquadratic GCD,  Prev: Binary GCD,  Up: Greatest Common Divisor Algorithms
+
+15.3.2 Lehmer's algorithm
+-------------------------
+
+Lehmer's improvement of the Euclidean algorithms is based on the
+observation that the initial part of the quotient sequence depends only
+on the most significant parts of the inputs. The variant of Lehmer's
+algorithm used in GMP splits off the most significant two limbs, as
+suggested, e.g., in "A Double-Digit Lehmer-Euclid Algorithm" by
+Jebelean (*note References::). The quotients of two double-limb inputs
+are collected as a 2 by 2 matrix with single-limb elements. This is
+done by the function `mpn_hgcd2'. The resulting matrix is applied to
+the inputs using `mpn_mul_1' and `mpn_submul_1'. Each iteration usually
+reduces the inputs by almost one limb. In the rare case of a large
+quotient, no progress can be made by examining just the most
+significant two limbs, and the quotient is computed using plain
+division.
+
+   The resulting algorithm is asymptotically O(N^2), just as the
+Euclidean algorithm and the binary algorithm. The quadratic part of the
+work are the calls to `mpn_mul_1' and `mpn_submul_1'. For small sizes,
+the linear work is also significant. There are roughly N calls to the
+`mpn_hgcd2' function. This function uses a couple of important
+optimizations:
+
+   * It uses the same relaxed notion of correctness as `mpn_hgcd' (see
+     next section). This means that when called with the most
+     significant two limbs of two large numbers, the returned matrix
+     does not always correspond exactly to the initial quotient
+     sequence for the two large numbers; the final quotient may
+     sometimes be one off.
+
+   * It takes advantage of the fact the quotients are usually small.
+     The division operator is not used, since the corresponding
+     assembler instruction is very slow on most architectures. (This
+     code could probably be improved further, it uses many branches
+     that are unfriendly to prediction).
+
+   * It switches from double-limb calculations to single-limb
+     calculations half-way through, when the input numbers have been
+     reduced in size from two limbs to one and a half.
+
+
+\1f
+File: gmp.info,  Node: Subquadratic GCD,  Next: Extended GCD,  Prev: Lehmer's Algorithm,  Up: Greatest Common Divisor Algorithms
+
+15.3.3 Subquadratic GCD
+-----------------------
+
+For inputs larger than `GCD_DC_THRESHOLD', GCD is computed via the HGCD
+(Half GCD) function, as a generalization to Lehmer's algorithm.
+
+   Let the inputs a,b be of size N limbs each. Put S = floor(N/2) + 1.
+Then HGCD(a,b) returns a transformation matrix T with non-negative
+elements, and reduced numbers (c;d) = T^-1 (a;b). The reduced numbers
+c,d must be larger than S limbs, while their difference abs(c-d) must
+fit in S limbs. The matrix elements will also be of size roughly N/2.
+
+   The HGCD base case uses Lehmer's algorithm, but with the above stop
+condition that returns reduced numbers and the corresponding
+transformation matrix half-way through. For inputs larger than
+`HGCD_THRESHOLD', HGCD is computed recursively, using the divide and
+conquer algorithm in "On Schönhage's algorithm and subquadratic integer
+GCD computation" by Möller (*note References::). The recursive
+algorithm consists of these main steps.
+
+   * Call HGCD recursively, on the most significant N/2 limbs. Apply the
+     resulting matrix T_1 to the full numbers, reducing them to a size
+     just above 3N/2.
+
+   * Perform a small number of division or subtraction steps to reduce
+     the numbers to size below 3N/2. This is essential mainly for the
+     unlikely case of large quotients.
+
+   * Call HGCD recursively, on the most significant N/2 limbs of the
+     reduced numbers. Apply the resulting matrix T_2 to the full
+     numbers, reducing them to a size just above N/2.
+
+   * Compute T = T_1 T_2.
+
+   * Perform a small number of division and subtraction steps to
+     satisfy the requirements, and return.
+
+   GCD is then implemented as a loop around HGCD, similarly to Lehmer's
+algorithm. Where Lehmer repeatedly chops off the top two limbs, calls
+`mpn_hgcd2', and applies the resulting matrix to the full numbers, the
+subquadratic GCD chops off the most significant third of the limbs (the
+proportion is a tuning parameter, and 1/3 seems to be more efficient
+than, e.g, 1/2), calls `mpn_hgcd', and applies the resulting matrix.
+Once the input numbers are reduced to size below `GCD_DC_THRESHOLD',
+Lehmer's algorithm is used for the rest of the work.
+
+   The asymptotic running time of both HGCD and GCD is O(M(N)*log(N)),
+where M(N) is the time for multiplying two N-limb numbers.
+
 \1f
 File: gmp.info,  Node: Extended GCD,  Next: Jacobi Symbol,  Prev: Subquadratic GCD,  Up: Greatest Common Divisor Algorithms
 
@@ -1391,7 +1645,10 @@ object" evaluating it,
 
      struct __gmp_binary_plus
      {
-       static void eval(mpf_t f, mpf_t g, mpf_t h) { mpf_add(f, g, h); }
+       static void eval(mpf_t f, const mpf_t g, const mpf_t h)
+       {
+         mpf_add(f, g, h);
+       }
      };
 
 And an "additive expression" object,
@@ -1579,6 +1836,13 @@ argument is a small compile-time constant, replace some heap
 allocations by stack allocations.  He also fixed the eofbit handling of
 C++ streams, and removed one division from `mpq/aors.c'.
 
+   David S Miller wrote assembly code for SPARC T3 and T4.
+
+   Mark Sofroniou cleaned up the types of mul_fft.c, letting it work
+for huge operands.
+
+   Ulrich Weigand ported GMP to the powerpc64le ABI.
+
    (This list is chronological, not ordered after significance.  If you
 have contributed to GMP but are not listed above, please tell
 <gmp-devel@gmplib.org> about the omission!)
@@ -1587,8 +1851,11 @@ have contributed to GMP but are not listed above, please tell
 supported in part by the ESPRIT-BRA (Basic Research Activities) 6846
 project POSSO (POlynomial System SOlving).
 
-   The development of GMP 2, 3, and 4 was supported in part by the IDA
-Center for Computing Sciences.
+   The development of GMP 2, 3, and 4.0 was supported in part by the
+IDA Center for Computing Sciences.
+
+   The development of GMP 4.3, 5.0, and 5.1 was supported in part by
+the Swedish Foundation for Strategic Research.
 
    Thanks go to Hans Thorsen for donating an SGI system for the GMP
 test system environment.
@@ -1627,8 +1894,8 @@ B.1 Books
 
    * Richard M. Stallman and the GCC Developer Community, "Using the
      GNU Compiler Collection", Free Software Foundation, 2008,
-     available online `http://gcc.gnu.org/onlinedocs/', and in the GCC
-     package `ftp://ftp.gnu.org/gnu/gcc/'
+     available online `https://gcc.gnu.org/onlinedocs/', and in the GCC
+     package `https://ftp.gnu.org/gnu/gcc/'
 
 B.2 Papers
 ==========
@@ -1645,11 +1912,11 @@ B.2 Papers
    * Torbjörn Granlund and Peter L. Montgomery, "Division by Invariant
      Integers using Multiplication", in Proceedings of the SIGPLAN
      PLDI'94 Conference, June 1994.  Also available
-     `http://gmplib.org/~tege/divcnst-pldi94.pdf'.
+     `https://gmplib.org/~tege/divcnst-pldi94.pdf'.
 
    * Niels Möller and Torbjörn Granlund, "Improved division by invariant
      integers", IEEE Transactions on Computers, 11 June 2010.
-     `http://gmplib.org/~tege/division-paper.pdf'
+     `https://gmplib.org/~tege/division-paper.pdf'
 
    * Torbjörn Granlund and Niels Möller, "Division of integers large and
      small", to appear.
@@ -1732,7 +1999,7 @@ Appendix C GNU Free Documentation License
 
                      Version 1.3, 3 November 2008
 
-     Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
+     Copyright (C) 2000-2002, 2007, 2008 Free Software Foundation, Inc.
      `http://fsf.org/'
 
      Everyone is permitted to copy and distribute verbatim copies
@@ -2133,7 +2400,7 @@ Appendix C GNU Free Documentation License
      the GNU Free Documentation License from time to time.  Such new
      versions will be similar in spirit to the present version, but may
      differ in detail to address new problems or concerns.  See
-     `http://www.gnu.org/copyleft/'.
+     `https://www.gnu.org/copyleft/'.
 
      Each version of the License is given a distinguishing version
      number.  If the Document specifies that a particular numbered
@@ -2222,14 +2489,14 @@ Concept Index
 * #include:                              Headers and Libraries.
                                                               (line   6)
 * --build:                               Build Options.       (line  52)
-* --disable-fft:                         Build Options.       (line 314)
+* --disable-fft:                         Build Options.       (line 313)
 * --disable-shared:                      Build Options.       (line  45)
 * --disable-static:                      Build Options.       (line  45)
-* --enable-alloca:                       Build Options.       (line 275)
-* --enable-assert:                       Build Options.       (line 320)
-* --enable-cxx:                          Build Options.       (line 227)
-* --enable-fat:                          Build Options.       (line 162)
-* --enable-profiling <1>:                Build Options.       (line 324)
+* --enable-alloca:                       Build Options.       (line 274)
+* --enable-assert:                       Build Options.       (line 319)
+* --enable-cxx:                          Build Options.       (line 226)
+* --enable-fat:                          Build Options.       (line 161)
+* --enable-profiling <1>:                Build Options.       (line 323)
 * --enable-profiling:                    Profiling.           (line   6)
 * --exec-prefix:                         Build Options.       (line  32)
 * --host:                                Build Options.       (line  66)
@@ -2237,21 +2504,21 @@ Concept Index
 * -finstrument-functions:                Profiling.           (line  66)
 * 2exp functions:                        Efficiency.          (line  43)
 * 68000:                                 Notes for Particular Systems.
-                                                              (line  80)
+                                                              (line  94)
 * 80x86:                                 Notes for Particular Systems.
-                                                              (line 127)
-* ABI <1>:                               Build Options.       (line 169)
+                                                              (line 150)
+* ABI <1>:                               Build Options.       (line 168)
 * ABI:                                   ABI and ISA.         (line   6)
-* About this manual:                     Introduction to GMP. (line  58)
+* About this manual:                     Introduction to GMP. (line  57)
 * AC_CHECK_LIB:                          Autoconf.            (line  11)
 * AIX <1>:                               Notes for Particular Systems.
                                                               (line   7)
-* AIX:                                   ABI and ISA.         (line 169)
+* AIX:                                   ABI and ISA.         (line 178)
 * Algorithms:                            Algorithms.          (line   6)
-* alloca:                                Build Options.       (line 275)
+* alloca:                                Build Options.       (line 274)
 * Allocation of memory:                  Custom Allocation.   (line   6)
 * AMD64:                                 ABI and ISA.         (line  44)
-* Anonymous FTP of latest version:       Introduction to GMP. (line  38)
+* Anonymous FTP of latest version:       Introduction to GMP. (line  37)
 * Application Binary Interface:          ABI and ISA.         (line   6)
 * Arithmetic functions <1>:              Rational Arithmetic. (line   6)
 * Arithmetic functions <2>:              Float Arithmetic.    (line   6)
@@ -2275,16 +2542,16 @@ Concept Index
                                                               (line   6)
 * Assembly writing guide:                Assembly Writing Guide.
                                                               (line   6)
-* Assertion checking <1>:                Build Options.       (line 320)
-* Assertion checking:                    Debugging.           (line  79)
+* Assertion checking <1>:                Debugging.           (line  79)
+* Assertion checking:                    Build Options.       (line 319)
 * Assignment functions <1>:              Assigning Integers.  (line   6)
 * Assignment functions <2>:              Initializing Rationals.
                                                               (line   6)
-* Assignment functions <3>:              Assigning Floats.    (line   6)
-* Assignment functions <4>:              Simultaneous Float Init & Assign.
+* Assignment functions <3>:              Simultaneous Float Init & Assign.
                                                               (line   6)
-* Assignment functions:                  Simultaneous Integer Init & Assign.
+* Assignment functions <4>:              Simultaneous Integer Init & Assign.
                                                               (line   6)
+* Assignment functions:                  Assigning Floats.    (line   6)
 * Autoconf:                              Autoconf.            (line   6)
 * Basics:                                GMP Basics.          (line   6)
 * Binomial coefficient algorithm:        Binomial Coefficients Algorithm.
@@ -2313,27 +2580,27 @@ Concept Index
 * Build system:                          Build Options.       (line  52)
 * Building GMP:                          Installing GMP.      (line   6)
 * Bus error:                             Debugging.           (line   7)
-* C compiler:                            Build Options.       (line 180)
-* C++ compiler:                          Build Options.       (line 251)
+* C compiler:                            Build Options.       (line 179)
+* C++ compiler:                          Build Options.       (line 250)
 * C++ interface:                         C++ Class Interface. (line   6)
 * C++ interface internals:               C++ Interface Internals.
                                                               (line   6)
 * C++ istream input:                     C++ Formatted Input. (line   6)
 * C++ ostream output:                    C++ Formatted Output.
                                                               (line   6)
-* C++ support:                           Build Options.       (line 227)
-* CC:                                    Build Options.       (line 180)
-* CC_FOR_BUILD:                          Build Options.       (line 214)
-* CFLAGS:                                Build Options.       (line 180)
+* C++ support:                           Build Options.       (line 226)
+* CC:                                    Build Options.       (line 179)
+* CC_FOR_BUILD:                          Build Options.       (line 213)
+* CFLAGS:                                Build Options.       (line 179)
 * Checker:                               Debugging.           (line 115)
 * checkergcc:                            Debugging.           (line 122)
 * Code organisation:                     Assembly Code Organisation.
                                                               (line   6)
 * Compaq C++:                            Notes for Particular Systems.
                                                               (line  25)
-* Comparison functions <1>:              Comparing Rationals. (line   6)
+* Comparison functions <1>:              Integer Comparisons. (line   6)
 * Comparison functions <2>:              Float Comparison.    (line   6)
-* Comparison functions:                  Integer Comparisons. (line   6)
+* Comparison functions:                  Comparing Rationals. (line   6)
 * Compatibility with older versions:     Compatibility with older versions.
                                                               (line   6)
 * Conditions for copying GNU MP:         Copying.             (line   6)
@@ -2352,15 +2619,16 @@ Concept Index
 * Conversion functions:                  Rational Conversions.
                                                               (line   6)
 * Copying conditions:                    Copying.             (line   6)
-* CPPFLAGS:                              Build Options.       (line 206)
+* CPPFLAGS:                              Build Options.       (line 205)
 * CPU types <1>:                         Introduction to GMP. (line  24)
 * CPU types:                             Build Options.       (line 108)
 * Cross compiling:                       Build Options.       (line  66)
+* Cryptography functions, low-level:     Low-level Functions. (line 495)
 * Custom allocation:                     Custom Allocation.   (line   6)
-* CXX:                                   Build Options.       (line 251)
-* CXXFLAGS:                              Build Options.       (line 251)
+* CXX:                                   Build Options.       (line 250)
+* CXXFLAGS:                              Build Options.       (line 250)
 * Cygwin:                                Notes for Particular Systems.
-                                                              (line  43)
+                                                              (line  57)
 * Darwin:                                Known Build Problems.
                                                               (line  51)
 * Debugging:                             Debugging.           (line   6)
@@ -2373,19 +2641,19 @@ Concept Index
 * Divisibility testing:                  Efficiency.          (line  91)
 * Division algorithms:                   Division Algorithms. (line   6)
 * Division functions <1>:                Rational Arithmetic. (line  24)
-* Division functions <2>:                Float Arithmetic.    (line  33)
-* Division functions:                    Integer Division.    (line   6)
+* Division functions <2>:                Integer Division.    (line   6)
+* Division functions:                    Float Arithmetic.    (line  33)
 * DJGPP <1>:                             Notes for Particular Systems.
-                                                              (line  43)
+                                                              (line  57)
 * DJGPP:                                 Known Build Problems.
                                                               (line  18)
 * DLLs:                                  Notes for Particular Systems.
-                                                              (line  56)
-* DocBook:                               Build Options.       (line 347)
-* Documentation formats:                 Build Options.       (line 340)
+                                                              (line  70)
+* DocBook:                               Build Options.       (line 346)
+* Documentation formats:                 Build Options.       (line 339)
 * Documentation license:                 GNU Free Documentation License.
                                                               (line   6)
-* DVI:                                   Build Options.       (line 343)
+* DVI:                                   Build Options.       (line 342)
 * Efficiency:                            Efficiency.          (line   6)
 * Emacs:                                 Emacs.               (line   6)
 * Exact division functions:              Integer Division.    (line 112)
@@ -2393,15 +2661,15 @@ Concept Index
 * Example programs:                      Demonstration Programs.
                                                               (line   6)
 * Exec prefix:                           Build Options.       (line  32)
-* Execution profiling <1>:               Profiling.           (line   6)
-* Execution profiling:                   Build Options.       (line 324)
+* Execution profiling <1>:               Build Options.       (line 323)
+* Execution profiling:                   Profiling.           (line   6)
 * Exponentiation functions <1>:          Float Arithmetic.    (line  41)
 * Exponentiation functions:              Integer Exponentiation.
                                                               (line   6)
 * Export:                                Integer Import and Export.
                                                               (line  45)
 * Expression parsing demo:               Demonstration Programs.
-                                                              (line  18)
+                                                              (line  15)
 * Extended GCD:                          Number Theoretic Functions.
                                                               (line  49)
 * Factor removal functions:              Number Theoretic Functions.
@@ -2412,9 +2680,9 @@ Concept Index
 * Factorization demo:                    Demonstration Programs.
                                                               (line  25)
 * Fast Fourier Transform:                FFT Multiplication.  (line   6)
-* Fat binary:                            Build Options.       (line 162)
-* FFT multiplication <1>:                Build Options.       (line 314)
-* FFT multiplication:                    FFT Multiplication.  (line   6)
+* Fat binary:                            Build Options.       (line 161)
+* FFT multiplication <1>:                FFT Multiplication.  (line   6)
+* FFT multiplication:                    Build Options.       (line 313)
 * Fibonacci number algorithm:            Fibonacci Numbers Algorithm.
                                                               (line   6)
 * Fibonacci sequence functions:          Number Theoretic Functions.
@@ -2450,9 +2718,11 @@ Concept Index
 * Formatted output:                      Formatted Output.    (line   6)
 * Free Documentation License:            GNU Free Documentation License.
                                                               (line   6)
+* FreeBSD:                               Notes for Particular Systems.
+                                                              (line  43)
 * frexp <1>:                             Converting Integers. (line  43)
 * frexp:                                 Converting Floats.   (line  24)
-* FTP of latest version:                 Introduction to GMP. (line  38)
+* FTP of latest version:                 Introduction to GMP. (line  37)
 * Function classes:                      Function Classes.    (line   6)
 * FunctionCheck:                         Profiling.           (line  77)
 * GCC Checker:                           Debugging.           (line 115)
@@ -2463,7 +2733,7 @@ Concept Index
 * GCD functions:                         Number Theoretic Functions.
                                                               (line  32)
 * GDB:                                   Debugging.           (line  58)
-* Generic C:                             Build Options.       (line 153)
+* Generic C:                             Build Options.       (line 152)
 * GMP Perl module:                       Demonstration Programs.
                                                               (line  35)
 * GMP version number:                    Useful Macros and Constants.
@@ -2487,27 +2757,27 @@ Concept Index
 * Headers:                               Headers and Libraries.
                                                               (line   6)
 * Heap problems:                         Debugging.           (line  24)
-* Home page:                             Introduction to GMP. (line  34)
+* Home page:                             Introduction to GMP. (line  33)
 * Host system:                           Build Options.       (line  66)
-* HP-UX:                                 ABI and ISA.         (line 107)
-* HPPA:                                  ABI and ISA.         (line  68)
-* I/O functions <1>:                     I/O of Floats.       (line   6)
-* I/O functions <2>:                     I/O of Rationals.    (line   6)
-* I/O functions:                         I/O of Integers.     (line   6)
+* HP-UX:                                 ABI and ISA.         (line  77)
+* HPPA:                                  ABI and ISA.         (line  77)
+* I/O functions <1>:                     I/O of Integers.     (line   6)
+* I/O functions <2>:                     I/O of Floats.       (line   6)
+* I/O functions:                         I/O of Rationals.    (line   6)
 * i386:                                  Notes for Particular Systems.
-                                                              (line 127)
-* IA-64:                                 ABI and ISA.         (line 107)
+                                                              (line 150)
+* IA-64:                                 ABI and ISA.         (line 116)
 * Import:                                Integer Import and Export.
                                                               (line  11)
 * In-place operations:                   Efficiency.          (line  57)
 * Include files:                         Headers and Libraries.
                                                               (line   6)
 * info-lookup-symbol:                    Emacs.               (line   6)
-* Initialization functions <1>:          Simultaneous Float Init & Assign.
-                                                              (line   6)
+* Initialization functions <1>:          Initializing Floats. (line   6)
 * Initialization functions <2>:          Random State Initialization.
                                                               (line   6)
-* Initialization functions <3>:          Initializing Floats. (line   6)
+* Initialization functions <3>:          Simultaneous Float Init & Assign.
+                                                              (line   6)
 * Initialization functions <4>:          Simultaneous Integer Init & Assign.
                                                               (line   6)
 * Initialization functions <5>:          Initializing Rationals.
@@ -2515,11 +2785,11 @@ Concept Index
 * Initialization functions:              Initializing Integers.
                                                               (line   6)
 * Initializing and clearing:             Efficiency.          (line  21)
-* Input functions <1>:                   I/O of Integers.     (line   6)
-* Input functions <2>:                   I/O of Rationals.    (line   6)
-* Input functions <3>:                   Formatted Input Functions.
+* Input functions <1>:                   Formatted Input Functions.
                                                               (line   6)
-* Input functions:                       I/O of Floats.       (line   6)
+* Input functions <2>:                   I/O of Rationals.    (line   6)
+* Input functions <3>:                   I/O of Floats.       (line   6)
+* Input functions:                       I/O of Integers.     (line   6)
 * Install prefix:                        Build Options.       (line  32)
 * Installing GMP:                        Installing GMP.      (line   6)
 * Instruction Set Architecture:          ABI and ISA.         (line   6)
@@ -2542,9 +2812,9 @@ Concept Index
 * Integer functions:                     Integer Functions.   (line   6)
 * Integer import:                        Integer Import and Export.
                                                               (line  11)
-* Integer initialization functions <1>:  Simultaneous Integer Init & Assign.
+* Integer initialization functions <1>:  Initializing Integers.
                                                               (line   6)
-* Integer initialization functions:      Initializing Integers.
+* Integer initialization functions:      Simultaneous Integer Init & Assign.
                                                               (line   6)
 * Integer input and output functions:    I/O of Integers.     (line   6)
 * Integer internals:                     Integer Internals.   (line   6)
@@ -2559,14 +2829,14 @@ Concept Index
 * Integer special functions:             Integer Special Functions.
                                                               (line   6)
 * Interix:                               Notes for Particular Systems.
-                                                              (line  51)
+                                                              (line  65)
 * Internals:                             Internals.           (line   6)
 * Introduction:                          Introduction to GMP. (line   6)
 * Inverse modulo functions:              Number Theoretic Functions.
                                                               (line  76)
-* IRIX <1>:                              Known Build Problems.
+* IRIX <1>:                              ABI and ISA.         (line 141)
+* IRIX:                                  Known Build Problems.
                                                               (line  38)
-* IRIX:                                  ABI and ISA.         (line 132)
 * ISA:                                   ABI and ISA.         (line   6)
 * istream input:                         C++ Formatted Input. (line   6)
 * Jacobi symbol algorithm:               Jacobi Symbol.       (line   6)
@@ -2579,7 +2849,7 @@ Concept Index
 * Kronecker symbol functions:            Number Theoretic Functions.
                                                               (line  95)
 * Language bindings:                     Language Bindings.   (line   6)
-* Latest version of GMP:                 Introduction to GMP. (line  38)
+* Latest version of GMP:                 Introduction to GMP. (line  37)
 * LCM functions:                         Number Theoretic Functions.
                                                               (line  70)
 * Least common multiple functions:       Number Theoretic Functions.
@@ -2610,13 +2880,14 @@ Concept Index
 * Logical functions:                     Integer Logic and Bit Fiddling.
                                                               (line   6)
 * Low-level functions:                   Low-level Functions. (line   6)
+* Low-level functions for cryptography:  Low-level Functions. (line 495)
 * Lucas number algorithm:                Lucas Numbers Algorithm.
                                                               (line   6)
 * Lucas number functions:                Number Theoretic Functions.
                                                               (line 147)
 * MacOS X:                               Known Build Problems.
                                                               (line  51)
-* Mailing lists:                         Introduction to GMP. (line  45)
+* Mailing lists:                         Introduction to GMP. (line  44)
 * Malloc debugger:                       Debugging.           (line  30)
 * Malloc problems:                       Debugging.           (line  24)
 * Memory allocation:                     Custom Allocation.   (line   6)
@@ -2626,28 +2897,30 @@ Concept Index
 * Mersenne twister random numbers:       Random State Initialization.
                                                               (line  13)
 * MINGW:                                 Notes for Particular Systems.
-                                                              (line  43)
-* MIPS:                                  ABI and ISA.         (line 132)
+                                                              (line  57)
+* MIPS:                                  ABI and ISA.         (line 141)
 * Miscellaneous float functions:         Miscellaneous Float Functions.
                                                               (line   6)
 * Miscellaneous integer functions:       Miscellaneous Integer Functions.
                                                               (line   6)
 * MMX:                                   Notes for Particular Systems.
-                                                              (line 133)
+                                                              (line 156)
 * Modular inverse functions:             Number Theoretic Functions.
                                                               (line  76)
 * Most significant bit:                  Miscellaneous Integer Functions.
                                                               (line  34)
-* MPN_PATH:                              Build Options.       (line 328)
+* MPN_PATH:                              Build Options.       (line 327)
 * MS Windows:                            Notes for Particular Systems.
-                                                              (line  43)
+                                                              (line  57)
 * MS-DOS:                                Notes for Particular Systems.
-                                                              (line  43)
+                                                              (line  57)
 * Multi-threading:                       Reentrancy.          (line   6)
 * Multiplication algorithms:             Multiplication Algorithms.
                                                               (line   6)
-* Nails:                                 Low-level Functions. (line 485)
+* Nails:                                 Low-level Functions. (line 664)
 * Native compilation:                    Build Options.       (line  52)
+* NetBSD:                                Notes for Particular Systems.
+                                                              (line 100)
 * NeXT:                                  Known Build Problems.
                                                               (line  57)
 * Next prime function:                   Number Theoretic Functions.
@@ -2664,7 +2937,7 @@ Concept Index
 * obstack output:                        Formatted Output Functions.
                                                               (line  81)
 * OpenBSD:                               Notes for Particular Systems.
-                                                              (line  86)
+                                                              (line 109)
 * Optimizing performance:                Performance optimization.
                                                               (line   6)
 * ostream output:                        C++ Formatted Output.
@@ -2673,19 +2946,19 @@ Concept Index
 * Output functions <1>:                  Formatted Output Functions.
                                                               (line   6)
 * Output functions <2>:                  I/O of Rationals.    (line   6)
-* Output functions <3>:                  I/O of Floats.       (line   6)
-* Output functions:                      I/O of Integers.     (line   6)
+* Output functions <3>:                  I/O of Integers.     (line   6)
+* Output functions:                      I/O of Floats.       (line   6)
 * Packaged builds:                       Notes for Package Builds.
                                                               (line   6)
 * Parameter conventions:                 Parameter Conventions.
                                                               (line   6)
 * Parsing expressions demo:              Demonstration Programs.
-                                                              (line  15)
+                                                              (line  21)
 * Particular systems:                    Notes for Particular Systems.
                                                               (line   6)
 * Past GMP versions:                     Compatibility with older versions.
                                                               (line   6)
-* PDF:                                   Build Options.       (line 343)
+* PDF:                                   Build Options.       (line 342)
 * Perfect power algorithm:               Perfect Power Algorithm.
                                                               (line   6)
 * Perfect power functions:               Integer Roots.       (line  28)
@@ -2696,16 +2969,16 @@ Concept Index
                                                               (line  35)
 * Perl module:                           Demonstration Programs.
                                                               (line  35)
-* Postscript:                            Build Options.       (line 343)
-* Power/PowerPC <1>:                     Notes for Particular Systems.
-                                                              (line  92)
-* Power/PowerPC:                         Known Build Problems.
+* Postscript:                            Build Options.       (line 342)
+* Power/PowerPC <1>:                     Known Build Problems.
                                                               (line  63)
+* Power/PowerPC:                         Notes for Particular Systems.
+                                                              (line 115)
 * Powering algorithms:                   Powering Algorithms. (line   6)
-* Powering functions <1>:                Integer Exponentiation.
+* Powering functions <1>:                Float Arithmetic.    (line  41)
+* Powering functions:                    Integer Exponentiation.
                                                               (line   6)
-* Powering functions:                    Float Arithmetic.    (line  41)
-* PowerPC:                               ABI and ISA.         (line 167)
+* PowerPC:                               ABI and ISA.         (line 176)
 * Precision of floats:                   Floating-point Functions.
                                                               (line   6)
 * Precision of hardware floating point:  Notes for Particular Systems.
@@ -2726,12 +2999,12 @@ Concept Index
                                                               (line   6)
 * Random number algorithms:              Random Number Algorithms.
                                                               (line   6)
-* Random number functions <1>:           Miscellaneous Float Functions.
-                                                              (line  27)
-* Random number functions <2>:           Random Number Functions.
+* Random number functions <1>:           Integer Random Numbers.
                                                               (line   6)
-* Random number functions:               Integer Random Numbers.
+* Random number functions <2>:           Random Number Functions.
                                                               (line   6)
+* Random number functions:               Miscellaneous Float Functions.
+                                                              (line  27)
 * Random number seeding:                 Random State Seeding.
                                                               (line   6)
 * Random number state:                   Random State Initialization.
@@ -2767,9 +3040,9 @@ Concept Index
 * Root extraction algorithm:             Nth Root Algorithm.  (line   6)
 * Root extraction algorithms:            Root Extraction Algorithms.
                                                               (line   6)
-* Root extraction functions <1>:         Integer Roots.       (line   6)
-* Root extraction functions:             Float Arithmetic.    (line  37)
-* Root testing functions:                Integer Roots.       (line  37)
+* Root extraction functions <1>:         Float Arithmetic.    (line  37)
+* Root extraction functions:             Integer Roots.       (line   6)
+* Root testing functions:                Integer Roots.       (line  28)
 * Rounding functions:                    Miscellaneous Float Functions.
                                                               (line   9)
 * Sample programs:                       Demonstration Programs.
@@ -2785,32 +3058,30 @@ Concept Index
 * Sequent Symmetry:                      Known Build Problems.
                                                               (line  68)
 * Services for Unix:                     Notes for Particular Systems.
-                                                              (line  51)
+                                                              (line  65)
 * Shared library versioning:             Notes for Package Builds.
                                                               (line   9)
-* Sign tests <1>:                        Integer Comparisons. (line  28)
-* Sign tests <2>:                        Comparing Rationals. (line  27)
-* Sign tests:                            Float Comparison.    (line  35)
+* Sign tests <1>:                        Comparing Rationals. (line  27)
+* Sign tests <2>:                        Float Comparison.    (line  35)
+* Sign tests:                            Integer Comparisons. (line  28)
 * Size in digits:                        Miscellaneous Integer Functions.
                                                               (line  23)
 * Small operands:                        Efficiency.          (line   7)
-* Solaris <1>:                           Known Build Problems.
-                                                              (line  72)
-* Solaris <2>:                           ABI and ISA.         (line 199)
+* Solaris <1>:                           ABI and ISA.         (line 208)
 * Solaris:                               Known Build Problems.
-                                                              (line  78)
+                                                              (line  72)
 * Sparc:                                 Notes for Particular Systems.
-                                                              (line 109)
-* Sparc V9:                              ABI and ISA.         (line 199)
+                                                              (line 127)
+* Sparc V9:                              ABI and ISA.         (line 208)
 * Special integer functions:             Integer Special Functions.
                                                               (line   6)
 * Square root algorithm:                 Square Root Algorithm.
                                                               (line   6)
 * SSE2:                                  Notes for Particular Systems.
-                                                              (line 133)
+                                                              (line 156)
 * Stack backtrace:                       Debugging.           (line  50)
-* Stack overflow <1>:                    Build Options.       (line 275)
-* Stack overflow:                        Debugging.           (line   7)
+* Stack overflow <1>:                    Debugging.           (line   7)
+* Stack overflow:                        Build Options.       (line 274)
 * Static linking:                        Efficiency.          (line  14)
 * stdarg.h:                              Headers and Libraries.
                                                               (line  17)
@@ -2818,22 +3089,22 @@ Concept Index
                                                               (line  11)
 * Stripped libraries:                    Known Build Problems.
                                                               (line  28)
-* Sun:                                   ABI and ISA.         (line 199)
+* Sun:                                   ABI and ISA.         (line 208)
 * SunOS:                                 Notes for Particular Systems.
-                                                              (line 121)
+                                                              (line 144)
 * Systems:                               Notes for Particular Systems.
                                                               (line   6)
-* Temporary memory:                      Build Options.       (line 275)
-* Texinfo:                               Build Options.       (line 340)
+* Temporary memory:                      Build Options.       (line 274)
+* Texinfo:                               Build Options.       (line 339)
 * Text input/output:                     Efficiency.          (line 153)
 * Thread safety:                         Reentrancy.          (line   6)
-* Toom multiplication <1>:               Other Multiplication.
+* Toom multiplication <1>:               Higher degree Toom'n'half.
                                                               (line   6)
-* Toom multiplication <2>:               Toom 3-Way Multiplication.
+* Toom multiplication <2>:               Other Multiplication.
                                                               (line   6)
-* Toom multiplication <3>:               Higher degree Toom'n'half.
+* Toom multiplication <3>:               Toom 4-Way Multiplication.
                                                               (line   6)
-* Toom multiplication:                   Toom 4-Way Multiplication.
+* Toom multiplication:                   Toom 3-Way Multiplication.
                                                               (line   6)
 * Types:                                 Nomenclature and Types.
                                                               (line   6)
@@ -2851,14 +3122,14 @@ Concept Index
                                                               (line   6)
 * Version number:                        Useful Macros and Constants.
                                                               (line  12)
-* Web page:                              Introduction to GMP. (line  34)
+* Web page:                              Introduction to GMP. (line  33)
 * Windows:                               Notes for Particular Systems.
-                                                              (line  56)
+                                                              (line  70)
 * x86:                                   Notes for Particular Systems.
-                                                              (line 127)
+                                                              (line 150)
 * x87:                                   Notes for Particular Systems.
                                                               (line  34)
-* XML:                                   Build Options.       (line 347)
+* XML:                                   Build Options.       (line 346)
 
 \1f
 File: gmp.info,  Node: Function Index,  Prev: Concept Index,  Up: Top
@@ -2880,7 +3151,7 @@ Function and Type Index
 * __GNU_MP_VERSION_PATCHLEVEL:           Useful Macros and Constants.
                                                               (line  12)
 * _mpz_realloc:                          Integer Special Functions.
-                                                              (line  51)
+                                                              (line  14)
 * abs <1>:                               C++ Interface Rationals.
                                                               (line  49)
 * abs <2>:                               C++ Interface Floats.
@@ -2889,14 +3160,16 @@ Function and Type Index
                                                               (line  47)
 * ceil:                                  C++ Interface Floats.
                                                               (line  84)
-* cmp <1>:                               C++ Interface Rationals.
+* cmp <1>:                               C++ Interface Floats.
+                                                              (line  86)
+* cmp <2>:                               C++ Interface Rationals.
                                                               (line  51)
-* cmp <2>:                               C++ Interface Integers.
-                                                              (line  49)
-* cmp <3>:                               C++ Interface Rationals.
+* cmp <3>:                               C++ Interface Floats.
+                                                              (line  85)
+* cmp <4>:                               C++ Interface Rationals.
                                                               (line  50)
-* cmp:                                   C++ Interface Floats.
-                                                              (line  86)
+* cmp:                                   C++ Interface Integers.
+                                                              (line  49)
 * floor:                                 C++ Interface Floats.
                                                               (line  93)
 * gmp_asprintf:                          Formatted Output Functions.
@@ -2911,12 +3184,12 @@ Function and Type Index
                                                               (line  29)
 * gmp_fscanf:                            Formatted Input Functions.
                                                               (line  25)
-* GMP_LIMB_BITS:                         Low-level Functions. (line 515)
-* GMP_NAIL_BITS:                         Low-level Functions. (line 513)
-* GMP_NAIL_MASK:                         Low-level Functions. (line 523)
-* GMP_NUMB_BITS:                         Low-level Functions. (line 514)
-* GMP_NUMB_MASK:                         Low-level Functions. (line 524)
-* GMP_NUMB_MAX:                          Low-level Functions. (line 532)
+* GMP_LIMB_BITS:                         Low-level Functions. (line 694)
+* GMP_NAIL_BITS:                         Low-level Functions. (line 692)
+* GMP_NAIL_MASK:                         Low-level Functions. (line 702)
+* GMP_NUMB_BITS:                         Low-level Functions. (line 693)
+* GMP_NUMB_MASK:                         Low-level Functions. (line 703)
+* GMP_NUMB_MAX:                          Low-level Functions. (line 711)
 * gmp_obstack_printf:                    Formatted Output Functions.
                                                               (line  79)
 * gmp_obstack_vprintf:                   Formatted Output Functions.
@@ -2930,13 +3203,13 @@ Function and Type Index
 * gmp_randclass:                         C++ Interface Random Numbers.
                                                               (line   7)
 * gmp_randclass::get_f:                  C++ Interface Random Numbers.
-                                                              (line  46)
+                                                              (line  45)
 * gmp_randclass::get_z_bits:             C++ Interface Random Numbers.
                                                               (line  38)
 * gmp_randclass::get_z_range:            C++ Interface Random Numbers.
                                                               (line  42)
 * gmp_randclass::gmp_randclass:          C++ Interface Random Numbers.
-                                                              (line  13)
+                                                              (line  27)
 * gmp_randclass::seed:                   C++ Interface Random Numbers.
                                                               (line  33)
 * gmp_randclear:                         Random State Initialization.
@@ -3043,7 +3316,7 @@ Function and Type Index
 * mpf_class::set_prec_raw:               C++ Interface Floats.
                                                               (line 117)
 * mpf_class::set_str:                    C++ Interface Floats.
-                                                              (line 101)
+                                                              (line 100)
 * mpf_class::swap:                       C++ Interface Floats.
                                                               (line 104)
 * mpf_clear:                             Initializing Floats. (line  37)
@@ -3129,52 +3402,70 @@ Function and Type Index
 * mpn_add:                               Low-level Functions. (line  69)
 * mpn_add_1:                             Low-level Functions. (line  64)
 * mpn_add_n:                             Low-level Functions. (line  54)
-* mpn_addmul_1:                          Low-level Functions. (line 148)
-* mpn_and_n:                             Low-level Functions. (line 427)
-* mpn_andn_n:                            Low-level Functions. (line 442)
-* mpn_cmp:                               Low-level Functions. (line 284)
-* mpn_com:                               Low-level Functions. (line 467)
-* mpn_copyd:                             Low-level Functions. (line 476)
-* mpn_copyi:                             Low-level Functions. (line 472)
-* mpn_divexact_by3:                      Low-level Functions. (line 229)
-* mpn_divexact_by3c:                     Low-level Functions. (line 231)
-* mpn_divmod:                            Low-level Functions. (line 224)
-* mpn_divmod_1:                          Low-level Functions. (line 208)
-* mpn_divrem:                            Low-level Functions. (line 182)
-* mpn_divrem_1:                          Low-level Functions. (line 206)
-* mpn_gcd:                               Low-level Functions. (line 289)
-* mpn_gcd_1:                             Low-level Functions. (line 299)
-* mpn_gcdext:                            Low-level Functions. (line 305)
-* mpn_get_str:                           Low-level Functions. (line 352)
-* mpn_hamdist:                           Low-level Functions. (line 416)
-* mpn_ior_n:                             Low-level Functions. (line 432)
-* mpn_iorn_n:                            Low-level Functions. (line 447)
-* mpn_lshift:                            Low-level Functions. (line 260)
-* mpn_mod_1:                             Low-level Functions. (line 255)
-* mpn_mul:                               Low-level Functions. (line 114)
-* mpn_mul_1:                             Low-level Functions. (line 133)
-* mpn_mul_n:                             Low-level Functions. (line 103)
-* mpn_nand_n:                            Low-level Functions. (line 452)
+* mpn_addmul_1:                          Low-level Functions. (line 150)
+* mpn_and_n:                             Low-level Functions. (line 437)
+* mpn_andn_n:                            Low-level Functions. (line 452)
+* mpn_cmp:                               Low-level Functions. (line 286)
+* mpn_cnd_add_n:                         Low-level Functions. (line 530)
+* mpn_cnd_sub_n:                         Low-level Functions. (line 532)
+* mpn_com:                               Low-level Functions. (line 477)
+* mpn_copyd:                             Low-level Functions. (line 486)
+* mpn_copyi:                             Low-level Functions. (line 482)
+* mpn_divexact_by3:                      Low-level Functions. (line 231)
+* mpn_divexact_by3c:                     Low-level Functions. (line 233)
+* mpn_divmod:                            Low-level Functions. (line 226)
+* mpn_divmod_1:                          Low-level Functions. (line 210)
+* mpn_divrem:                            Low-level Functions. (line 184)
+* mpn_divrem_1:                          Low-level Functions. (line 208)
+* mpn_gcd:                               Low-level Functions. (line 291)
+* mpn_gcd_1:                             Low-level Functions. (line 301)
+* mpn_gcdext:                            Low-level Functions. (line 307)
+* mpn_get_str:                           Low-level Functions. (line 361)
+* mpn_hamdist:                           Low-level Functions. (line 426)
+* mpn_ior_n:                             Low-level Functions. (line 442)
+* mpn_iorn_n:                            Low-level Functions. (line 457)
+* mpn_lshift:                            Low-level Functions. (line 262)
+* mpn_mod_1:                             Low-level Functions. (line 257)
+* mpn_mul:                               Low-level Functions. (line 116)
+* mpn_mul_1:                             Low-level Functions. (line 135)
+* mpn_mul_n:                             Low-level Functions. (line 105)
+* mpn_nand_n:                            Low-level Functions. (line 462)
 * mpn_neg:                               Low-level Functions. (line  98)
-* mpn_nior_n:                            Low-level Functions. (line 457)
-* mpn_perfect_square_p:                  Low-level Functions. (line 422)
-* mpn_popcount:                          Low-level Functions. (line 412)
-* mpn_random:                            Low-level Functions. (line 401)
-* mpn_random2:                           Low-level Functions. (line 402)
-* mpn_rshift:                            Low-level Functions. (line 272)
-* mpn_scan0:                             Low-level Functions. (line 386)
-* mpn_scan1:                             Low-level Functions. (line 394)
-* mpn_set_str:                           Low-level Functions. (line 367)
-* mpn_sqr:                               Low-level Functions. (line 125)
-* mpn_sqrtrem:                           Low-level Functions. (line 334)
+* mpn_nior_n:                            Low-level Functions. (line 467)
+* mpn_perfect_square_p:                  Low-level Functions. (line 432)
+* mpn_popcount:                          Low-level Functions. (line 422)
+* mpn_random:                            Low-level Functions. (line 411)
+* mpn_random2:                           Low-level Functions. (line 412)
+* mpn_rshift:                            Low-level Functions. (line 274)
+* mpn_scan0:                             Low-level Functions. (line 396)
+* mpn_scan1:                             Low-level Functions. (line 404)
+* mpn_sec_add_1:                         Low-level Functions. (line 543)
+* mpn_sec_div_qr:                        Low-level Functions. (line 613)
+* mpn_sec_div_qr_itch:                   Low-level Functions. (line 614)
+* mpn_sec_div_r:                         Low-level Functions. (line 630)
+* mpn_sec_div_r_itch:                    Low-level Functions. (line 631)
+* mpn_sec_invert:                        Low-level Functions. (line 645)
+* mpn_sec_invert_itch:                   Low-level Functions. (line 646)
+* mpn_sec_mul:                           Low-level Functions. (line 558)
+* mpn_sec_mul_itch:                      Low-level Functions. (line 559)
+* mpn_sec_powm:                          Low-level Functions. (line 588)
+* mpn_sec_powm_itch:                     Low-level Functions. (line 590)
+* mpn_sec_sqr:                           Low-level Functions. (line 573)
+* mpn_sec_sqr_itch:                      Low-level Functions. (line 574)
+* mpn_sec_sub_1:                         Low-level Functions. (line 545)
+* mpn_sec_tabselect:                     Low-level Functions. (line 604)
+* mpn_set_str:                           Low-level Functions. (line 376)
+* mpn_sizeinbase:                        Low-level Functions. (line 354)
+* mpn_sqr:                               Low-level Functions. (line 127)
+* mpn_sqrtrem:                           Low-level Functions. (line 336)
 * mpn_sub:                               Low-level Functions. (line  90)
 * mpn_sub_1:                             Low-level Functions. (line  85)
 * mpn_sub_n:                             Low-level Functions. (line  76)
-* mpn_submul_1:                          Low-level Functions. (line 159)
-* mpn_tdiv_qr:                           Low-level Functions. (line 171)
-* mpn_xnor_n:                            Low-level Functions. (line 462)
-* mpn_xor_n:                             Low-level Functions. (line 437)
-* mpn_zero:                              Low-level Functions. (line 479)
+* mpn_submul_1:                          Low-level Functions. (line 161)
+* mpn_tdiv_qr:                           Low-level Functions. (line 173)
+* mpn_xnor_n:                            Low-level Functions. (line 472)
+* mpn_xor_n:                             Low-level Functions. (line 447)
+* mpn_zero:                              Low-level Functions. (line 489)
 * mpq_abs:                               Rational Arithmetic. (line  34)
 * mpq_add:                               Rational Arithmetic. (line   8)
 * mpq_canonicalize:                      Rational Number Functions.
@@ -3198,9 +3489,9 @@ Function and Type Index
 * mpq_class::get_str:                    C++ Interface Rationals.
                                                               (line  53)
 * mpq_class::mpq_class:                  C++ Interface Rationals.
-                                                              (line  23)
+                                                              (line  12)
 * mpq_class::set_str:                    C++ Interface Rationals.
-                                                              (line  54)
+                                                              (line  55)
 * mpq_class::swap:                       C++ Interface Rationals.
                                                               (line  57)
 * mpq_clear:                             Initializing Rationals.
@@ -3308,7 +3599,7 @@ Function and Type Index
 * mpz_class::get_ui:                     C++ Interface Integers.
                                                               (line  59)
 * mpz_class::mpz_class:                  C++ Interface Integers.
-                                                              (line   7)
+                                                              (line  21)
 * mpz_class::set_str:                    C++ Interface Integers.
                                                               (line  60)
 * mpz_class::swap:                       C++ Interface Integers.
@@ -3381,7 +3672,7 @@ Function and Type Index
 * mpz_get_str:                           Converting Integers. (line  47)
 * mpz_get_ui:                            Converting Integers. (line  11)
 * mpz_getlimbn:                          Integer Special Functions.
-                                                              (line  60)
+                                                              (line  23)
 * mpz_hamdist:                           Integer Logic and Bit Fiddling.
                                                               (line  29)
 * mpz_import:                            Integer Import and Export.
@@ -3422,6 +3713,14 @@ Function and Type Index
                                                               (line  70)
 * mpz_legendre:                          Number Theoretic Functions.
                                                               (line  86)
+* mpz_limbs_finish:                      Integer Special Functions.
+                                                              (line  48)
+* mpz_limbs_modify:                      Integer Special Functions.
+                                                              (line  41)
+* mpz_limbs_read:                        Integer Special Functions.
+                                                              (line  35)
+* mpz_limbs_write:                       Integer Special Functions.
+                                                              (line  40)
 * mpz_lucnum2_ui:                        Number Theoretic Functions.
                                                               (line 147)
 * mpz_lucnum_ui:                         Number Theoretic Functions.
@@ -3465,6 +3764,10 @@ Function and Type Index
                                                               (line  57)
 * mpz_remove:                            Number Theoretic Functions.
                                                               (line 108)
+* mpz_roinit_n:                          Integer Special Functions.
+                                                              (line  69)
+* MPZ_ROINIT_N:                          Integer Special Functions.
+                                                              (line  84)
 * mpz_root:                              Integer Roots.       (line   8)
 * mpz_rootrem:                           Integer Roots.       (line  14)
 * mpz_rrandomb:                          Integer Random Numbers.
@@ -3486,7 +3789,7 @@ Function and Type Index
 * mpz_si_kronecker:                      Number Theoretic Functions.
                                                               (line  94)
 * mpz_size:                              Integer Special Functions.
-                                                              (line  68)
+                                                              (line  31)
 * mpz_sizeinbase:                        Miscellaneous Integer Functions.
                                                               (line  23)
 * mpz_sqrt:                              Integer Roots.       (line  18)
@@ -3520,10 +3823,10 @@ Function and Type Index
                                                               (line  23)
 * mpz_xor:                               Integer Logic and Bit Fiddling.
                                                               (line  17)
-* operator"" <1>:                        C++ Interface Integers.
-                                                              (line  30)
-* operator"" <2>:                        C++ Interface Floats.
+* operator"" <1>:                        C++ Interface Floats.
                                                               (line  56)
+* operator"" <2>:                        C++ Interface Integers.
+                                                              (line  30)
 * operator"":                            C++ Interface Rationals.
                                                               (line  38)
 * operator%:                             C++ Interface Integers.
@@ -3532,15 +3835,15 @@ Function and Type Index
                                                               (line  34)
 * operator<<:                            C++ Formatted Output.
                                                               (line  20)
-* operator>> <1>:                        C++ Interface Rationals.
+* operator>> <1>:                        C++ Formatted Input. (line  14)
+* operator>>:                            C++ Interface Rationals.
                                                               (line  85)
-* operator>>:                            C++ Formatted Input. (line  25)
-* sgn <1>:                               C++ Interface Rationals.
-                                                              (line  56)
+* sgn <1>:                               C++ Interface Floats.
+                                                              (line 102)
 * sgn <2>:                               C++ Interface Integers.
                                                               (line  62)
-* sgn:                                   C++ Interface Floats.
-                                                              (line 102)
+* sgn:                                   C++ Interface Rationals.
+                                                              (line  56)
 * sqrt <1>:                              C++ Interface Integers.
                                                               (line  63)
 * sqrt:                                  C++ Interface Floats.
index 2dce73976d7f215bcb80cf46f7505ee638e9b777..2896a19e477c873d2c336964efe86a9f7dcfb74f 100644 (file)
@@ -14,9 +14,7 @@
 This manual describes how to install and use the GNU multiple precision
 arithmetic library, version @value{VERSION}.
 
-Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software
-Foundation, Inc.
+Copyright 1991, 1993-2014 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document under
 the terms of the GNU Free Documentation License, Version 1.3 or any later
@@ -445,10 +443,19 @@ someone else and passed on, we want their recipients to know that what they
 have is not what we distributed, so that any problems introduced by others
 will not reflect on our reputation.@refill
 
-The precise conditions of the license for the GNU MP library are found in the
-Lesser General Public License version 3 that accompanies the source code,
-see @file{COPYING.LIB}.  Certain demonstration programs are provided under the
-terms of the plain General Public License version 3, see @file{COPYING}.
+More precisely, the GNU MP library is dual licensed, under the conditions of
+the GNU Lesser General Public License version 3 (see
+@file{COPYING.LESSERv3}), or the GNU General Public License version 2 (see
+@file{COPYINGv2}). This is the recipient's choice, and the recipient also has
+the additional option of applying later versions of these licenses. (The
+reason for this dual licensing is to make it possible to use the library with
+programs which are licensed under GPL version 2, but which for historical or
+other reasons do not allow use under later versions of the GPL).
+
+Programs which are not part of the library itself, such as demonstration
+programs and the GMP testsuite, are licensed under the terms of the GNU
+General Public License version 3 (see @file{COPYINGv3}), or any later
+version.
 
 
 @node Introduction to GMP, Installing GMP, Copying, Top
@@ -473,29 +480,17 @@ emphasis on speed (as opposed to simplicity or elegance).
 
 There is assembly code for these CPUs:
 @cindex CPU types
-ARM,
+ARM Cortex-A9, Cortex-A15, and generic ARM,
 DEC Alpha 21064, 21164, and 21264,
-AMD 29000,
-AMD K6, K6-2, Athlon, and Athlon64,
-Hitachi SuperH and SH-2,
-HPPA 1.0, 1.1 and 2.0,
-Intel Pentium, Pentium Pro/II/III, Pentium 4, generic x86,
-Intel IA-64, i960,
-Motorola MC68000, MC68020, MC88100, and MC88110,
-Motorola/IBM PowerPC 32 and 64,
-National NS32000,
-IBM POWER,
-MIPS R3000, R4000,
-SPARCv7, SuperSPARC, generic SPARCv8, UltraSPARC,
-DEC VAX,
-and
-Zilog Z8000.
-Some optimizations also for
-Cray vector systems,
-Clipper,
-IBM ROMP (RT),
-and
-Pyramid AP/XP.
+AMD K8 and K10 (sold under many brands, e.g. Athlon64, Phenom, Opteron)
+Bulldozer, and Bobcat,
+Intel Pentium, Pentium Pro/II/III, Pentium 4, Core2, Nehalem, Sandy bridge, Haswell, generic x86,
+Intel IA-64,
+Motorola/IBM PowerPC 32 and 64 such as POWER970, POWER5, POWER6, and POWER7,
+MIPS 32-bit and 64-bit,
+SPARC 32-bit ad 64-bit with special support for all UltraSPARC models.
+There is also assembly code for many obsolete CPUs.
+
 
 @cindex Home page
 @cindex Web page
@@ -503,7 +498,7 @@ Pyramid AP/XP.
 For up-to-date information on GMP, please see the GMP web pages at
 
 @display
-@uref{http://gmplib.org/}
+@uref{https://gmplib.org/}
 @end display
 
 @cindex Latest version of GMP
@@ -513,11 +508,11 @@ For up-to-date information on GMP, please see the GMP web pages at
 The latest version of the library is available at
 
 @display
-@uref{ftp://ftp.gnu.org/gnu/gmp/}
+@uref{https://ftp.gnu.org/gnu/gmp/}
 @end display
 
 Many sites around the world mirror @samp{ftp.gnu.org}, please use a mirror
-near you, see @uref{http://www.gnu.org/order/ftp.html} for a full list.
+near you, see @uref{https://www.gnu.org/order/ftp.html} for a full list.
 
 @cindex Mailing lists
 There are three public mailing lists of interest.  One for release
@@ -525,7 +520,7 @@ announcements, one for general questions and discussions about usage of the GMP
 library and one for bug reports.  For more information, see
 
 @display
-@uref{http://gmplib.org/mailman/listinfo/}.
+@uref{https://gmplib.org/mailman/listinfo/}.
 @end display
 
 The proper place for bug reports is @email{gmp-bugs@@gmplib.org}.  See
@@ -842,16 +837,10 @@ x86 family:
 
 @item
 Other:
-@nisamp{a29k},
 @nisamp{arm},
-@nisamp{clipper},
-@nisamp{i960},
-@nisamp{ns32k},
-@nisamp{pyramid},
 @nisamp{sh},
 @nisamp{sh2},
 @nisamp{vax},
-@nisamp{z8k}
 @end itemize
 
 CPUs not listed will use generic C code.
@@ -866,7 +855,7 @@ least make it possible to get something running if all else fails.
 
 @item Fat binary, @option{--enable-fat}
 @cindex Fat binary
-@cindex @option{--enable-fat}
+@cindex @code{--enable-fat}
 Using @option{--enable-fat} selects a ``fat binary'' build on x86, where
 optimized low level subroutines are chosen at runtime according to the CPU
 detected.  This means more code, but gives good performance on all x86 chips.
@@ -1160,6 +1149,16 @@ gcc  -m32
 @end example
 
 (In GCC 2.95 and earlier there's no @samp{-m32} option, it's the only mode.)
+
+@item @samp{ABI=x32}
+The x32 ABI uses 64-bit limbs but 32-bit pointers.  Like the 64-bit ABI, it
+makes full use of the chip's arithmetic capabilities.  This ABI is not
+supported by all operating systems.
+
+@example
+gcc  -mx32
+@end example
+
 @end table
 
 @sp 1
@@ -1512,6 +1511,21 @@ involving a @code{double} cannot be expected to operate to their full
 precision when the hardware is in single precision mode.  Of course this
 affects all code, including application code, not just GMP.
 
+@item FreeBSD 7.x, 8.x, 9.0, 9.1, 9.2
+@cindex FreeBSD
+@command{m4} in these releases of FreeBSD has an eval function which ignores
+its 2nd and 3rd arguments, which makes it unsuitable for @file{.asm} file
+processing.  @samp{./configure} will detect the problem and either abort or
+choose another m4 in the @env{PATH}.  The bug is fixed in FreeBSD 9.3 and 10.0,
+so either upgrade or use GNU m4.  Note that the FreeBSD package system installs
+GNU m4 under the name @samp{gm4}, which GMP cannot guess.
+
+@item FreeBSD 7.x, 8.x, 9.x
+@cindex FreeBSD
+GMP releases starting with 5.2 do not support @samp{ABI=32} on FreeBSD/amd64
+prior to release 10.0 of the system.  The cause is a broken @code{limits.h},
+which GMP no longer works around.
+
 @item MS-DOS and MS Windows
 @cindex MS-DOS
 @cindex MS Windows
@@ -1572,6 +1586,15 @@ performance boost on applicable CPUs.  @samp{m68360} can be used for CPU32
 series chips.  @samp{m68302} can be used for ``Dragonball'' series chips,
 though this is merely a synonym for @samp{m68000}.
 
+@item NetBSD 5.x
+@cindex NetBSD
+@command{m4} in these releases of NetBSD has an eval function which ignores its
+2nd and 3rd arguments, which makes it unsuitable for @file{.asm} file
+processing.  @samp{./configure} will detect the problem and either abort or
+choose another m4 in the @env{PATH}.  The bug is fixed in NetBSD 6, so either
+upgrade or use GNU m4.  Note that the NetBSD package system installs GNU m4
+under the name @samp{gm4}, which GMP cannot guess.
+
 @item OpenBSD 2.6
 @cindex OpenBSD
 @command{m4} in this release of OpenBSD has a bug in @code{eval} that makes it
@@ -1652,7 +1675,7 @@ Install a recent @command{gas} if MMX code is wanted on these systems.
 @c This section is more or less meant for known build problems that are not
 @c otherwise worked around and require some sort of manual intervention.
 
-You might find more up-to-date information at @uref{http://gmplib.org/}.
+You might find more up-to-date information at @uref{https://gmplib.org/}.
 
 @table @asis
 @item Compiler link options
@@ -1833,10 +1856,10 @@ are only provided if @code{<stdio.h>} is included too.
 @end example
 
 @cindex @code{stdarg.h}
-Likewise @code{<stdarg.h>} (or @code{<varargs.h>}) is required for prototypes
-with @code{va_list} parameters, such as @code{gmp_vprintf}.  And
-@code{<obstack.h>} for prototypes with @code{struct obstack} parameters, such
-as @code{gmp_obstack_printf}, when available.
+Likewise @code{<stdarg.h>} is required for prototypes with @code{va_list}
+parameters, such as @code{gmp_vprintf}.  And @code{<obstack.h>} for prototypes
+with @code{struct obstack} parameters, such as @code{gmp_obstack_printf}, when
+available.
 
 @cindex Libraries
 @cindex Linking
@@ -2153,7 +2176,7 @@ GMP I/O functions using them will not be reentrant either.
 
 @item
 It's safe for two threads to read from the same GMP variable simultaneously,
-but it's not safe for one to read while the another might be writing, nor for
+but it's not safe for one to read while another might be writing, nor for
 two threads to write simultaneously.  It's not safe for two threads to
 generate a random number from the same @code{gmp_randstate_t} simultaneously,
 since this involves an update of that variable.
@@ -2628,7 +2651,7 @@ For C++, add @samp{--enable-cxx CXXFLAGS=-g}.
 @item Checker
 @cindex Checker
 @cindex GCC Checker
-The GCC checker (@uref{http://savannah.nongnu.org/projects/checker/}) can be
+The GCC checker (@uref{https://savannah.nongnu.org/projects/checker/}) can be
 used with GMP@.  It contains a stub library which means GMP applications
 compiled with checker can use a normal GMP build.
 
@@ -2789,7 +2812,7 @@ found.  For example,
 
 @example
 AC_CHECK_LIB(gmp, __gmpz_init, ,
-  [AC_MSG_ERROR([GNU MP not found, see http://gmplib.org/])])
+  [AC_MSG_ERROR([GNU MP not found, see https://gmplib.org/])])
 @end example
 
 If functions added in some particular version of GMP are required, then one of
@@ -2799,7 +2822,7 @@ GMP 3.1,
 @example
 AC_CHECK_LIB(gmp, __gmpz_mul_si, ,
   [AC_MSG_ERROR(
-  [GNU MP not found, or not 3.1 or up, see http://gmplib.org/])])
+  [GNU MP not found, or not 3.1 or up, see https://gmplib.org/])])
 @end example
 
 An alternative would be to test the version number in @file{gmp.h} using say
@@ -2859,7 +2882,7 @@ much to ask you to report the bugs you find.
 
 Before you report a bug, check it's not already addressed in @ref{Known Build
 Problems}, or perhaps @ref{Notes for Particular Systems}.  You may also want
-to check @uref{http://gmplib.org/} for patches for this release.
+to check @uref{https://gmplib.org/} for patches for this release.
 
 Please include the following in any report,
 
@@ -3416,7 +3439,7 @@ If an inverse doesn't exist then a divide by zero is raised.
 @end deftypefun
 
 @deftypefun void mpz_powm_sec (mpz_t @var{rop}, const mpz_t @var{base}, const mpz_t @var{exp}, const mpz_t @var{mod})
-Set @var{rop} to @m{base^{exp} \bmod mod, (@var{base} raised to @var{exp})
+Set @var{rop} to @m{base^{exp} \bmod @var{mod}, (@var{base} raised to @var{exp})
 modulo @var{mod}}.
 
 It is required that @math{@var{exp} > 0} and that @var{mod} is odd.
@@ -4093,57 +4116,7 @@ The functions in this section are for various special purposes.  Most
 applications will not need them.
 
 @deftypefun void mpz_array_init (mpz_t @var{integer_array}, mp_size_t @var{array_size}, @w{mp_size_t @var{fixed_num_bits}})
-This is a special type of initialization.  @strong{Fixed} space of
-@var{fixed_num_bits} is allocated to each of the @var{array_size} integers in
-@var{integer_array}.  There is no way to free the storage allocated by this
-function.  Don't call @code{mpz_clear}!
-
-The @var{integer_array} parameter is the first @code{mpz_t} in the array.  For
-example,
-
-@example
-mpz_t  arr[20000];
-mpz_array_init (arr[0], 20000, 512);
-@end example
-
-@c  In case anyone's wondering, yes this parameter style is a bit anomalous,
-@c  it'd probably be nicer if it was "arr" instead of "arr[0]".  Obviously the
-@c  two differ only in the declaration, not the pointer value, but changing is
-@c  not possible since it'd provoke warnings or errors in existing sources.
-
-This function is only intended for programs that create a large number
-of integers and need to reduce memory usage by avoiding the overheads of
-allocating and reallocating lots of small blocks.  In normal programs this
-function is not recommended.
-
-The space allocated to each integer by this function will not be automatically
-increased, unlike the normal @code{mpz_init}, so an application must ensure it
-is sufficient for any value stored.  The following space requirements apply to
-various routines,
-
-@itemize @bullet
-@item
-@code{mpz_abs}, @code{mpz_neg}, @code{mpz_set}, @code{mpz_set_si} and
-@code{mpz_set_ui} need room for the value they store.
-
-@item
-@code{mpz_add}, @code{mpz_add_ui}, @code{mpz_sub} and @code{mpz_sub_ui} need
-room for the larger of the two operands, plus an extra
-@code{mp_bits_per_limb}.
-
-@item
-@code{mpz_mul}, @code{mpz_mul_ui} and @code{mpz_mul_si} need room for the sum
-of the number of bits in their operands, but each rounded up to a multiple of
-@code{mp_bits_per_limb}.
-
-@item
-@code{mpz_swap} can be used between two array variables, but not between an
-array and a normal variable.
-@end itemize
-
-For other functions, or if in doubt, the suggestion is to calculate in a
-regular @code{mpz_init} variable and copy the result to an array variable with
-@code{mpz_set}.
+@strong{This is an obsolete function.  Do not use it.}
 @end deftypefun
 
 @deftypefun {void *} _mpz_realloc (mpz_t @var{integer}, mp_size_t @var{new_alloc})
@@ -4171,6 +4144,82 @@ the returned value will be zero.
 @c (@xref{Nomenclature}, for an explanation of the concept @dfn{limb}.)
 @end deftypefun
 
+@deftypefun {const mp_limb_t *} mpz_limbs_read (const mpz_t @var{x})
+Return a pointer to the limb array representing the absolute value of @var{x}.
+The size of the array is @code{mpz_size(@var{x})}. Intended for read access
+only.
+@end deftypefun
+
+@deftypefun {mp_limb_t *} mpz_limbs_write (mpz_t @var{x}, mp_size_t @var{n})
+@deftypefunx {mp_limb_t *} mpz_limbs_modify (mpz_t @var{x}, mp_size_t @var{n})
+Return a pointer to the limb array, intended for write access. The array is
+reallocated as needed, to make room for @var{n} limbs. Requires @math{@var{n}
+> 0}. The @code{mpz_limbs_modify} function returns an array that holds the old
+absolute value of @var{x}, while @code{mpz_limbs_write} may destroy the old
+value and return an array with unspecified contents.
+@end deftypefun
+
+@deftypefun void mpz_limbs_finish (mpz_t @var{x}, mp_size_t @var{s})
+Updates the internal size field of @var{x}. Used after writing to the limb
+array pointer returned by @code{mpz_limbs_write} or @code{mpz_limbs_modify} is
+completed. The array should contain @math{@GMPabs{@var{s}}} valid limbs,
+representing the new absolute value for @var{x}, and the sign of @var{x} is
+taken from the sign of @var{s}. This function never reallocates @var{x}, so
+the limb pointer remains valid.
+@end deftypefun
+
+@c FIXME: Some more useful and less silly example?
+@example
+void foo (mpz_t x)
+@{
+  mp_size_t n, i;
+  mp_limb_t *xp;
+
+  n = mpz_size (x);
+  xp = mpz_limbs_modify(x, 2*n);
+  for (i = 0; i < n; i++)
+    xp[n+i] = xp[n-1-i];
+  mpz_limbs_finish (x, mpz_sgn (x) < 0 ? - 2*n : 2*n);
+@}
+@end example
+
+@deftypefun mpz_srcptr mpz_roinit_n (mpz_t @var{x}, const mp_limb_t *@var{xp}, mp_size_t @var{xs})
+Special initialization of @var{x}, using the given limb array and size.
+@var{x} should be treated as read-only: it can be passed safely as input to
+any mpz function, but not as an output. The array @var{xp} must point to at
+least a readable limb, its size is
+@math{@GMPabs{@var{xs}}}, and the sign of @var{x} is the sign of @var{xs}. For
+convenience, the function returns @var{x}, but cast to a const pointer type.
+@end deftypefun
+
+@example
+void foo (mpz_t x)
+@{
+  static const mp_limb_t y[3] = @{ 0x1, 0x2, 0x3 @};
+  mpz_t tmp;
+  mpz_add (x, x, mpz_roinit_n (tmp, y, 3));
+@}
+@end example
+
+@deftypefn Macro mpz_t MPZ_ROINIT_N (mp_limb_t *@var{xp}, mp_size_t @var{xs})
+This macro expands to an initializer which can be assigned to an mpz_t
+variable. The limb array @var{xp} must point to at least a readable limb,
+moreover, unlike the @code{mpz_roinit_n} function, the array must be
+normalized: if @var{xs} is non-zero, then
+@code{@var{xp}[@math{@GMPabs{@var{xs}}-1}]} must be non-zero. Intended
+primarily for constant values. Using it for non-constant values requires a C
+compiler supporting C99.
+@end deftypefn
+
+@example
+void foo (mpz_t x)
+@{
+  static const mp_limb_t ya[3] = @{ 0x1, 0x2, 0x3 @};
+  static const mpz_t y = MPZ_ROINIT_N ((mp_limb_t *) ya, 3);
+
+  mpz_add (x, x, y);
+@}
+@end example
 
 
 @node Rational Number Functions, Floating-point Functions, Integer Functions, Top
@@ -4510,7 +4559,7 @@ The exponent of each float is a fixed precision, one machine word on most
 systems.  In the current implementation the exponent is a count of limbs, so
 for example on a 32-bit system this means a range of roughly
 @math{2^@W{-68719476768}} to @math{2^@W{68719476736}}, or on a 64-bit system
-this will be greater.  Note however @code{mpf_get_str} can only return an
+this will be greater.  Note however that @code{mpf_get_str} can only return an
 exponent which fits an @code{mp_exp_t} and currently @code{mpf_set_str}
 doesn't accept exponents bigger than a @code{long}.
 
@@ -4523,21 +4572,19 @@ Each function is defined to calculate with ``infinite precision'' followed by
 a truncation to the destination precision, but of course the work done is only
 what's needed to determine a result under that definition.
 
-The precision selected for a variable is a minimum value, GMP may increase it
-a little to facilitate efficient calculation.  Currently this means rounding
-up to a whole limb, and then sometimes having a further partial limb,
-depending on the high limb of the mantissa.  But applications shouldn't be
-concerned by such details.
+The precision selected by the user for a variable is a minimum value, GMP may
+increase it to facilitate efficient calculation.  Currently this means
+rounding up to a whole limb, and then sometimes having a further partial limb,
+depending on the high limb of the mantissa.
 
-The mantissa in stored in binary, as might be imagined from the fact
-precisions are expressed in bits.  One consequence of this is that decimal
+The mantissa is stored in binary.  One consequence of this is that decimal
 fractions like @math{0.1} cannot be represented exactly.  The same is true of
 plain IEEE @code{double} floats.  This makes both highly unsuitable for
 calculations involving money or other values that should be exact decimal
 fractions.  (Suitably scaled integers, or perhaps rationals, are better
 choices.)
 
-@code{mpf} functions and variables have no special notion of infinity or
+The @code{mpf} functions and variables have no special notion of infinity or
 not-a-number, and applications must take care not to overflow the exponent or
 results will be unpredictable.  This might change in a future release.
 
@@ -4546,6 +4593,10 @@ extension to IEEE P754 arithmetic.  In particular results obtained on one
 computer often differ from the results on a computer with a different word
 size.
 
+The GMP extension library MPFR (@url{http://mpfr.org}) is an alternative to
+GMP's @code{mpf} functions.  MPFR provides well-defined precision and accurate
+rounding, and thereby naturally extends IEEE P754.
+
 @menu
 * Initializing Floats::
 * Assigning Floats::
@@ -4781,9 +4832,9 @@ Convert @var{op} to a @code{double}, truncating if necessary (i.e.@: rounding
 towards zero), and with an exponent returned separately.
 
 The return value is in the range @math{0.5@le{}@GMPabs{@var{d}}<1} and the
-exponent is stored to @code{*@var{exp}}.  @m{@var{d} * 2^{exp}, @var{d} *
-2^@var{exp}} is the (truncated) @var{op} value.  If @var{op} is zero, the
-return is @math{0.0} and 0 is stored to @code{*@var{exp}}.
+exponent is stored to @code{*@var{exp}}.  @m{@var{d} \times 2^{exp},
+@var{d} * 2^@var{exp}} is the (truncated) @var{op} value.  If @var{op} is zero,
+the return is @math{0.0} and 0 is stored to @code{*@var{exp}}.
 
 @cindex @code{frexp}
 This is similar to the standard C @code{frexp} function (@pxref{Normalization
@@ -5193,7 +5244,9 @@ This function requires that @var{s1n} is greater than or equal to
 
 @deftypefun mp_limb_t mpn_neg (mp_limb_t *@var{rp}, const mp_limb_t *@var{sp}, mp_size_t @var{n})
 Perform the negation of @{@var{sp}, @var{n}@}, and write the result to
-@{@var{rp}, @var{n}@}.  Return carry-out.
+@{@var{rp}, @var{n}@}.  This is equivalent to calling @code{mpn_sub_n} with a
+@var{n}-limb zero minuend and passing @{@var{sp}, @var{n}@} as subtrahend.
+Return borrow, either 0 or 1.
 @end deftypefun
 
 @deftypefun void mpn_mul_n (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, const mp_limb_t *@var{s2p}, mp_size_t @var{n})
@@ -5223,7 +5276,7 @@ This function requires that @var{s1n} is greater than or equal to @var{s2n}.
 Compute the square of @{@var{s1p}, @var{n}@} and write the 2*@var{n}-limb
 result to @var{rp}.
 
-The destination has to have space for 2*@var{n} limbs, even if the result's
+The destination has to have space for 2@var{n} limbs, even if the result's
 most significant limb is zero.  No overlap is permitted between the
 destination and the source.
 @end deftypefun
@@ -5449,6 +5502,13 @@ A return value of zero indicates a perfect square.  See also
 @code{mpn_perfect_square_p}.
 @end deftypefun
 
+@deftypefun size_t mpn_sizeinbase (const mp_limb_t *@var{xp}, mp_size_t @var{n}, int @var{base})
+Return the size of @{@var{xp},@var{n}@} measured in number of digits in the
+given @var{base}.  @var{base} can vary from 2 to 62.  Requires @math{@var{n} > 0}
+and @math{@var{xp}[@var{n}-1] > 0}.  The result will be either exact or
+1 too big.  If @var{base} is a power of 2, the result is always exact.
+@end deftypefun
+
 @deftypefun mp_size_t mpn_get_str (unsigned char *@var{str}, int @var{base}, mp_limb_t *@var{s1p}, mp_size_t @var{s1n})
 Convert @{@var{s1p}, @var{s1n}@} to a raw unsigned char array at @var{str} in
 base @var{base}, and return the number of characters produced.  There may be
@@ -5468,19 +5528,20 @@ represented by a @var{s1n} long limb array, plus one extra character.
 Convert bytes @{@var{str},@var{strsize}@} in the given @var{base} to limbs at
 @var{rp}.
 
-@math{@var{str}[0]} is the most significant byte and
-@math{@var{str}[@var{strsize}-1]} is the least significant.  Each byte should
-be a value in the range 0 to @math{@var{base}-1}, not an ASCII character.
-@var{base} can vary from 2 to 256.
+@math{@var{str}[0]} is the most significant input byte and
+@math{@var{str}[@var{strsize}-1]} is the least significant input byte.  Each
+byte should be a value in the range 0 to @math{@var{base}-1}, not an ASCII
+character.  @var{base} can vary from 2 to 256.
 
-The return value is the number of limbs written to @var{rp}.  If the most
-significant input byte is non-zero then the high limb at @var{rp} will be
-non-zero, and only that exact number of limbs will be required there.
+The converted value is @{@var{rp},@var{rn}@} where @var{rn} is the return
+value.  If the most significant input byte @math{@var{str}[0]} is non-zero,
+then @math{@var{rp}[@var{rn}-1]} will be non-zero, else
+@math{@var{rp}[@var{rn}-1]} and some number of subsequent limbs may be zero.
 
-If the most significant input byte is zero then there may be high zero limbs
-written to @var{rp} and included in the return value.
+The area at @var{rp} has to have space for the largest possible number with
+@var{strsize} digits in the chosen base, plus one extra limb.
 
-@var{strsize} must be at least 1, and no overlap is permitted between
+The input must have at least one byte, and no overlap is permitted between
 @{@var{str},@var{strsize}@} and the result at @var{rp}.
 @end deftypefun
 
@@ -5584,6 +5645,185 @@ Copy from @{@var{s1p}, @var{n}@} to @{@var{rp}, @var{n}@}, decreasingly.
 Zero @{@var{rp}, @var{n}@}.
 @end deftypefun
 
+@sp 1
+@section Low-level functions for cryptography
+@cindex Low-level functions for cryptography
+@cindex Cryptography functions, low-level
+
+The functions prefixed with @code{mpn_sec_} and @code{mpn_cnd_} are designed to
+perform the exact same low-level operations and have the same cache access
+patterns for any two same-size arguments, assuming that function arguments are
+placed at the same position and that the machine state is identical upon
+function entry.  These functions are intended for cryptographic purposes, where
+resilience to side-channel attacks is desired.
+
+These functions are less efficient than their ``leaky'' counterparts; their
+performance for operands of the sizes typically used for cryptographic
+applications is between 15% and 100% worse.  For larger operands, these
+functions might be inadequate, since they rely on asymptotically elementary
+algorithms.
+
+These functions do not make any explicit allocations.  Those of these functions
+that need scratch space accept a scratch space operand.  This convention allows
+callers to keep sensitive data in designated memory areas.  Note however that
+compilers may choose to spill scalar values used within these functions to
+their stack frame and that such scalars may contain sensitive data.
+
+In addition to these specially crafted functions, the following @code{mpn}
+functions are naturally side-channel resistant: @code{mpn_add_n},
+@code{mpn_sub_n}, @code{mpn_lshift}, @code{mpn_rshift}, @code{mpn_zero},
+@code{mpn_copyi}, @code{mpn_copyd}, @code{mpn_com}, and the logical function
+(@code{mpn_and_n}, etc).
+
+There are some exceptions from the side-channel resilience: (1) Some assembly
+implementations of @code{mpn_lshift} identify shift-by-one as a special case.
+This is a problem iff the shift count is a function of sensitive data.  (2)
+Alpha ev6 and Pentium4 using 64-bit limbs have leaky @code{mpn_add_n} and
+@code{mpn_sub_n}.  (3) Alpha ev6 has a leaky @code{mpn_mul_1} which also makes
+@code{mpn_sec_mul} on those systems unsafe.
+
+@deftypefun mp_limb_t mpn_cnd_add_n (mp_limb_t @var{cnd}, mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, const mp_limb_t *@var{s2p}, mp_size_t @var{n})
+@deftypefunx mp_limb_t mpn_cnd_sub_n (mp_limb_t @var{cnd}, mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, const mp_limb_t *@var{s2p}, mp_size_t @var{n})
+These functions do conditional addition and subtraction.  If @var{cnd} is
+non-zero, they produce the same result as a regular @code{mpn_add_n} or
+@code{mpn_sub_n}, and if @var{cnd} is zero, they copy @{@var{s1p},@var{n}@} to
+the result area and return zero.  The functions are designed to have timing and
+memory access patterns depending only on size and location of the data areas,
+but independent of the condition @var{cnd}.  Like for @code{mpn_add_n} and
+@code{mpn_sub_n}, on most machines, the timing will also be independent of the
+actual limb values.
+@end deftypefun
+
+@deftypefun mp_limb_t mpn_sec_add_1 (mp_limb_t *@var{rp}, const mp_limb_t *@var{ap}, mp_size_t @var{n}, mp_limb_t @var{b}, mp_limb_t *@var{tp})
+@deftypefunx mp_limb_t mpn_sec_sub_1 (mp_limb_t *@var{rp}, const mp_limb_t *@var{ap}, mp_size_t @var{n}, mp_limb_t @var{b}, mp_limb_t *@var{tp})
+Set @var{R} to @var{A} + @var{b} or @var{A} - @var{b}, respectively, where
+@var{R} = @{@var{rp},@var{n}@}, @var{A} = @{@var{ap},@var{n}@}, and @var{b} is
+a single limb. Returns carry.
+
+These functions take @math{O(N)} time, unlike the leaky functions
+@code{mpn_add_1} which are @math{O(1)} on average. They require scratch space
+of @code{mpn_sec_add_1_itch(@var{n})} and @code{mpn_sec_sub_1_itch(@var{n})}
+limbs, respectively, to be passed in the @var{tp} parameter. The scratch space
+requirements are guaranteed to increase monotonously in the operand size.
+@end deftypefun
+
+@deftypefun void mpn_sec_mul (mp_limb_t *@var{rp}, const mp_limb_t *@var{ap}, mp_size_t @var{an}, const mp_limb_t *@var{bp}, mp_size_t @var{bn}, mp_limb_t *@var{tp})
+@deftypefunx mp_size_t mpn_sec_mul_itch (mp_size_t @var{an}, mp_size_t @var{bn})
+Set @var{R} to @math{A @times{} B}, where @var{A} = @{@var{ap},@var{an}@},
+@var{B} = @{@var{bp},@var{bn}@}, and @var{R} =
+@{@var{rp},@math{@var{an}+@var{bn}}@}.
+
+It is required that @math{@var{an} @ge @var{bn} > 0}.
+
+No overlapping between @var{R} and the input operands is allowed.  For
+@math{@var{A} = @var{B}}, use @code{mpn_sec_sqr} for optimal performance.
+
+This function requires scratch space of @code{mpn_sec_mul_itch(@var{an},
+@var{bn})} limbs to be passed in the @var{tp} parameter.  The scratch space
+requirements are guaranteed to increase monotonously in the operand sizes.
+@end deftypefun
+
+
+@deftypefun void mpn_sec_sqr (mp_limb_t *@var{rp}, const mp_limb_t *@var{ap}, mp_size_t @var{an}, mp_limb_t *@var{tp})
+@deftypefunx mp_size_t mpn_sec_sqr_itch (mp_size_t @var{an})
+Set @var{R} to @math{A^2}, where @var{A} = @{@var{ap},@var{an}@}, and @var{R} =
+@{@var{rp},@math{2@var{an}}@}.
+
+It is required that @math{@var{an} > 0}.
+
+No overlapping between @var{R} and the input operands is allowed.
+
+This function requires scratch space of @code{mpn_sec_sqr_itch(@var{an})} limbs
+to be passed in the @var{tp} parameter.  The scratch space requirements are
+guaranteed to increase monotonously in the operand size.
+@end deftypefun
+
+
+@deftypefun void mpn_sec_powm (mp_limb_t *@var{rp}, const mp_limb_t *@var{bp}, mp_size_t @var{bn}, const mp_limb_t *@var{ep}, mp_bitcnt_t @var{enb},  const mp_limb_t *@var{mp}, mp_size_t @var{n}, mp_limb_t *@var{tp})
+@deftypefunx mp_size_t mpn_sec_powm_itch (mp_size_t @var{bn}, mp_bitcnt_t @var{enb}, size_t @var{n})
+Set @var{R} to @m{B^E \bmod @var{M}, (@var{B} raised to @var{E}) modulo
+@var{M}}, where @var{R} = @{@var{rp},@var{n}@}, @var{M} = @{@var{mp},@var{n}@},
+and @var{E} = @{@var{ep},@math{@GMPceil{@var{enb} /
+@code{GMP\_NUMB\_BITS}}}@}.
+
+It is required that @math{@var{B} > 0}, that @math{@var{M} > 0} is odd, and
+that @m{@var{E} < 2@GMPraise{@var{enb}}, @var{E} < 2^@var{enb}}.
+
+No overlapping between @var{R} and the input operands is allowed.
+
+This function requires scratch space of @code{mpn_sec_powm_itch(@var{bn},
+@var{enb}, @var{n})} limbs to be passed in the @var{tp} parameter.  The scratch
+space requirements are guaranteed to increase monotonously in the operand
+sizes.
+@end deftypefun
+
+@deftypefun void mpn_sec_tabselect (mp_limb_t *@var{rp}, const mp_limb_t *@var{tab}, mp_size_t @var{n}, mp_size_t @var{nents}, mp_size_t @var{which})
+Select entry @var{which} from table @var{tab}, which has @var{nents} entries, each @var{n}
+limbs.  Store the selected entry at @var{rp}.
+
+This function reads the entire table to avoid side-channel information leaks.
+@end deftypefun
+
+@deftypefun mp_limb_t mpn_sec_div_qr (mp_limb_t *@var{qp}, mp_limb_t *@var{np}, mp_size_t @var{nn}, const mp_limb_t *@var{dp}, mp_size_t @var{dn}, mp_limb_t *@var{tp})
+@deftypefunx mp_size_t mpn_sec_div_qr_itch (mp_size_t @var{nn}, mp_size_t @var{dn})
+
+Set @var{Q} to @m{\lfloor @var{N} / @var{D}\rfloor, the truncated quotient
+@var{N} / @var{D}} and @var{R} to @m{@var{N} \bmod @var{D}, @var{N} modulo
+@var{D}}, where @var{N} = @{@var{np},@var{nn}@}, @var{D} =
+@{@var{dp},@var{dn}@}, @var{Q}'s most significant limb is the function return
+value and the remaining limbs are @{@var{qp},@var{nn-dn}@}, and @var{R} =
+@{@var{np},@var{dn}@}.
+
+It is required that @math{@var{nn} @ge @var{dn} @ge 1}, and that
+@m{@var{dp}[@var{dn}-1] @neq 0, @var{dp}[@var{dn}-1] != 0}.  This does not
+imply that @math{@var{N} @ge @var{D}} since @var{N} might be zero-padded.
+
+Note the overlapping between @var{N} and @var{R}.  No other operand overlapping
+is allowed.  The entire space occupied by @var{N} is overwritten.
+
+This function requires scratch space of @code{mpn_sec_div_qr_itch(@var{nn},
+@var{dn})} limbs to be passed in the @var{tp} parameter.
+@end deftypefun
+
+@deftypefun void mpn_sec_div_r (mp_limb_t *@var{np}, mp_size_t @var{nn}, const mp_limb_t *@var{dp}, mp_size_t @var{dn}, mp_limb_t *@var{tp})
+@deftypefunx mp_size_t mpn_sec_div_r_itch (mp_size_t @var{nn}, mp_size_t @var{dn})
+
+Set @var{R} to @m{@var{N} \bmod @var{D}, @var{N} modulo @var{D}}, where @var{N}
+= @{@var{np},@var{nn}@}, @var{D} = @{@var{dp},@var{dn}@}, and @var{R} =
+@{@var{np},@var{dn}@}.
+
+It is required that @math{@var{nn} @ge @var{dn} @ge 1}, and that
+@m{@var{dp}[@var{dn}-1] @neq 0, @var{dp}[@var{dn}-1] != 0}.  This does not
+imply that @math{@var{N} @ge @var{D}} since @var{N} might be zero-padded.
+
+Note the overlapping between @var{N} and @var{R}.  No other operand overlapping
+is allowed.  The entire space occupied by @var{N} is overwritten.
+
+This function requires scratch space of @code{mpn_sec_div_r_itch(@var{nn},
+@var{dn})} limbs to be passed in the @var{tp} parameter.
+@end deftypefun
+
+@deftypefun int mpn_sec_invert (mp_limb_t *@var{rp}, mp_limb_t *@var{ap}, const mp_limb_t *@var{mp}, mp_size_t @var{n}, mp_bitcnt_t @var{nbcnt}, mp_limb_t *@var{tp})
+@deftypefunx mp_size_t mpn_sec_invert_itch (mp_size_t @var{n})
+Set @var{R} to @m{@var{A}^{-1} \bmod @var{M}, the inverse of @var{A} modulo
+@var{M}}, where @var{R} = @{@var{rp},@var{n}@}, @var{A} = @{@var{ap},@var{n}@},
+and @var{M} = @{@var{mp},@var{n}@}.  @strong{This function's interface is
+preliminary.}
+
+If an inverse exists, return 1, otherwise return 0 and leave @var{R}
+undefined. In either case, the input @var{A} is destroyed.
+
+It is required that @var{M} is odd, and that @math{@var{nbcnt} @ge
+@GMPceil{\log(@var{A}+1)} + @GMPceil{\log(@var{M}+1)}}.  A safe choice is
+@m{@var{nbcnt} = 2@var{n} @times{} @code{GMP\_NUMB\_BITS}, @var{nbcnt} = 2
+@times{} @var{n} @times{} GMP_NUMB_BITS}, but a smaller value might improve
+performance if @var{M} or @var{A} are known to have leading zero bits.
+
+This function requires scratch space of @code{mpn_sec_invert_itch(@var{n})}
+limbs to be passed in the @var{tp} parameter.
+@end deftypefun
+
+
 @sp 1
 @section Nails
 @cindex Nails
@@ -6067,7 +6307,7 @@ The following functions are provided in @file{libgmpxx} (@pxref{Headers and
 Libraries}), which is built if C++ support is enabled (@pxref{Build Options}).
 Prototypes are available from @code{<gmp.h>}.
 
-@deftypefun ostream& operator<< (ostream& @var{stream}, mpz_t @var{op})
+@deftypefun ostream& operator<< (ostream& @var{stream}, const mpz_t @var{op})
 Print @var{op} to @var{stream}, using its @code{ios} formatting settings.
 @code{ios::width} is reset to 0 after output, the same as the standard
 @code{ostream operator<<} routines do.
@@ -6077,7 +6317,7 @@ decimal.  This is unlike the standard @code{operator<<} routines on @code{int}
 etc, which instead give twos complement.
 @end deftypefun
 
-@deftypefun ostream& operator<< (ostream& @var{stream}, mpq_t @var{op})
+@deftypefun ostream& operator<< (ostream& @var{stream}, const mpq_t @var{op})
 Print @var{op} to @var{stream}, using its @code{ios} formatting settings.
 @code{ios::width} is reset to 0 after output, the same as the standard
 @code{ostream operator<<} routines do.
@@ -6090,7 +6330,7 @@ decimal.  If @code{ios::showbase} is set then a base indicator is shown on
 both the numerator and denominator (if the denominator is required).
 @end deftypefun
 
-@deftypefun ostream& operator<< (ostream& @var{stream}, mpf_t @var{op})
+@deftypefun ostream& operator<< (ostream& @var{stream}, const mpf_t @var{op})
 Print @var{op} to @var{stream}, using its @code{ios} formatting settings.
 @code{ios::width} is reset to 0 after output, the same as the standard
 @code{ostream operator<<} routines do.
@@ -6411,7 +6651,7 @@ overloaded functions and operators which may be more convenient.
 
 Due to the implementation of this interface, a reasonably recent C++ compiler
 is required, one supporting namespaces, partial specialization of templates
-and member templates.  For GCC this means version 2.91 or later.
+and member templates.
 
 @strong{Everything described in this chapter is to be considered preliminary
 and might be subject to incompatible changes if some unforeseen difficulty
@@ -6543,7 +6783,7 @@ function, for example @code{double} follows @code{mpz_set_d}
 (@pxref{Assigning Integers}).
 @end deftypefun
 
-@deftypefun explicit mpz_class::mpz_class (mpz_t @var{z})
+@deftypefun explicit mpz_class::mpz_class (const mpz_t @var{z})
 Construct an @code{mpz_class} from an @code{mpz_t}.  The value in @var{z} is
 copied into the new @code{mpz_class}, there won't be any permanent association
 between it and @var{z}.
@@ -6643,7 +6883,7 @@ mpq_class q (1, 3);
 @end example
 @end deftypefun
 
-@deftypefun explicit mpq_class::mpq_class (mpq_t @var{q})
+@deftypefun explicit mpq_class::mpq_class (const mpq_t @var{q})
 Construct an @code{mpq_class} from an @code{mpq_t}.  The value in @var{q} is
 copied into the new @code{mpq_class}, there won't be any permanent association
 between it and @var{q}.
@@ -6752,8 +6992,8 @@ mpf_class f(x+y);        // greater of precisions of x and y
 @end example
 @end deftypefun
 
-@deftypefun explicit mpf_class::mpf_class (mpf_t @var{f})
-@deftypefunx {} mpf_class::mpf_class (mpf_t @var{f}, mp_bitcnt_t @var{prec})
+@deftypefun explicit mpf_class::mpf_class (const mpf_t @var{f})
+@deftypefunx {} mpf_class::mpf_class (const mpf_t @var{f}, mp_bitcnt_t @var{prec})
 Construct an @code{mpf_class} from an @code{mpf_t}.  The value in @var{f} is
 copied into the new @code{mpf_class}, there won't be any permanent association
 between it and @var{f}.
@@ -7001,6 +7241,31 @@ void fun (T f, T g)
   fun2 (f, T(f+g));  // Good
 @}
 @end example
+
+@item C++11
+C++11 provides several new ways in which types can be inferred: @code{auto},
+@code{decltype}, etc. While they can be very convenient, they don't mix well
+with expression templates. In this example, the addition is performed twice,
+as if we had defined @code{sum} as a macro.
+
+@example
+mpz_class z = 33;
+auto sum = z + z;
+mpz_class prod = sum * sum;
+@end example
+
+This other example may crash, though some compilers might make it look like
+it is working, because the expression @code{z+z} goes out of scope before it
+is evaluated.
+
+@example
+mpz_class z = 33;
+auto sum = z + z + z;
+mpz_class prod = sum * 2;
+@end example
+
+It is thus strongly recommended to avoid @code{auto} anywhere a GMP C++
+expression may appear.
 @end table
 
 
@@ -7133,7 +7398,7 @@ than C, though perhaps with varying levels of functionality and efficiency.
 GMP C++ class interface, @pxref{C++ Class Interface} @* Straightforward
 interface, expression templates to eliminate temporaries.
 @item
-ALP @spaceuref{http://www-sop.inria.fr/saga/logiciels/ALP/} @* Linear algebra and
+ALP @spaceuref{https://www-sop.inria.fr/saga/logiciels/ALP/} @* Linear algebra and
 polynomials using templates.
 @item
 Arithmos @spaceuref{http://cant.ua.ac.be/old/arithmos/} @* Rationals
@@ -7141,9 +7406,6 @@ with infinities and square roots.
 @item
 CLN @spaceuref{http://www.ginac.de/CLN/} @* High level classes for arithmetic.
 @item
-LiDIA @spaceuref{http://www.cdc.informatik.tu-darmstadt.de/TI/LiDIA/} @* A C++
-library for computational number theory.
-@item
 Linbox @spaceuref{http://www.linalg.org/} @* Sparse vectors and matrices.
 @item
 NTL @spaceuref{http://www.shoup.net/ntl/} @* A C++ number theory library.
@@ -7161,31 +7423,29 @@ NTL @spaceuref{http://www.shoup.net/ntl/} @* A C++ number theory library.
 Eiffelroom @spaceuref{http://www.eiffelroom.org/node/442}
 @end itemize
 
-@item Fortran
-@itemize @bullet
-@item
-Omni F77 @spaceuref{http://phase.hpcc.jp/Omni/home.html} @* Arbitrary
-precision floats.
-@end itemize
+@c @item Fortran
+@c @itemize @bullet
+@c @item
+@c Omni F77 @spaceuref{http://phase.hpcc.jp/Omni/home.html} @* Arbitrary
+@c precision floats.
+@c @end itemize
 
 @item Haskell
 @itemize @bullet
 @item
-Glasgow Haskell Compiler @spaceuref{http://www.haskell.org/ghc/}
+Glasgow Haskell Compiler @spaceuref{https://www.haskell.org/ghc/}
 @end itemize
 
 @item Java
 @itemize @bullet
 @item
-Kaffe @spaceuref{http://www.kaffe.org/}
-@item
-Kissme @spaceuref{http://kissme.sourceforge.net/}
+Kaffe @spaceuref{https://github.com/kaffe/kaffe}
 @end itemize
 
 @item Lisp
 @itemize @bullet
 @item
-GNU Common Lisp @spaceuref{http://www.gnu.org/software/gcl/gcl.html}
+GNU Common Lisp @spaceuref{https://www.gnu.org/software/gcl/gcl.html}
 @item
 Librep @spaceuref{http://librep.sourceforge.net/}
 @item
@@ -7213,7 +7473,7 @@ MLton compiler @spaceuref{http://mlton.org/}
 @item Objective Caml
 @itemize @bullet
 @item
-MLGMP @spaceuref{http://www.di.ens.fr/~monniaux/programmes.html.en}
+MLGMP @spaceuref{http://opam.ocamlpro.com/pkg/mlgmp.20120224.html}
 @item
 Numerix @spaceuref{http://pauillac.inria.fr/~quercia/} @* Optionally using
 GMP.
@@ -7222,7 +7482,7 @@ GMP.
 @item Oz
 @itemize @bullet
 @item
-Mozart @spaceuref{http://www.mozart-oz.org/}
+Mozart @spaceuref{http://mozart.github.io/}
 @end itemize
 
 @item Pascal
@@ -7265,7 +7525,7 @@ Arbitrary precision floats.
 @item Python
 @itemize @bullet
 @item
-GMPY @uref{http://code.google.com/p/gmpy/}
+GMPY @uref{https://code.google.com/p/gmpy/}
 @end itemize
 
 @item Ruby
@@ -7277,11 +7537,11 @@ http://rubygems.org/gems/gmp
 @item Scheme
 @itemize @bullet
 @item
-GNU Guile (upcoming 1.8) @spaceuref{http://www.gnu.org/software/guile/guile.html}
+GNU Guile @spaceuref{https://www.gnu.org/software/guile/guile.html}
 @item
 RScheme @spaceuref{http://www.rscheme.org/}
 @item
-STklos @spaceuref{http://www.stklos.org/}
+STklos @spaceuref{http://www.stklos.net/}
 @c
 @c  For reference, MzScheme uses some of gmp, but (as of version 205) it only
 @c  has copies of some of the generic C code, and we don't consider that a
@@ -7298,7 +7558,7 @@ GNU Smalltalk @spaceuref{http://www.smalltalk.org/versions/GNUSmalltalk.html}
 @item Other
 @itemize @bullet
 @item
-Axiom @uref{http://savannah.nongnu.org/projects/axiom} @* Computer algebra
+Axiom @uref{https://savannah.nongnu.org/projects/axiom} @* Computer algebra
 using GCL.
 @item
 DrGenius @spaceuref{http://drgenius.seul.org/} @* Geometry system and
@@ -7306,17 +7566,17 @@ mathematical programming language.
 @item
 GiNaC @spaceuref{http://www.ginac.de/} @* C++ computer algebra using CLN.
 @item
-GOO @spaceuref{http://www.googoogaga.org/} @* Dynamic object oriented
+GOO @spaceuref{https://www.eecs.berkeley.edu/~jrb/goo/} @* Dynamic object oriented
 language.
 @item
-Maxima @uref{http://www.ma.utexas.edu/users/wfs/maxima.html} @* Macsyma
+Maxima @uref{https://www.ma.utexas.edu/users/wfs/maxima.html} @* Macsyma
 computer algebra using GCL.
-@item
-Q @spaceuref{http://q-lang.sourceforge.net/} @* Equational programming system.
+@c @item
+@c Q @spaceuref{http://q-lang.sourceforge.net/} @* Equational programming system.
 @item
 Regina @spaceuref{http://regina.sourceforge.net/} @* Topological calculator.
 @item
-Yacas @spaceuref{yacas.sourceforge.net} @* Yet another computer algebra system.
+Yacas @spaceuref{http://yacas.sourceforge.net} @* Yet another computer algebra system.
 @end itemize
 
 @end table
@@ -7929,10 +8189,10 @@ a multiple of 4 points, that's why for higher degree Toom'n'half is used.
 
 Toom'n'half means that the existence of one more piece is considered for a
 single operand. It can be virtual, i.e. zero, or real, when the two operand
-are not exactly balanced. By chosing an even @math{r},
+are not exactly balanced. By choosing an even @math{r},
 Toom-@m{r{1\over2},r+1/2} requires @math{2r} points, a multiple of four.
 
-The four-plets of points inlcude 0, @m{\infty,inf}, +1, -1 and
+The four-plets of points include 0, @m{\infty,inf}, +1, -1 and
 @m{\pm2^i,+-2^i}, @m{\pm2^{-i},+-2^-i} . Each of them giving shortcuts for the
 evaluation phase and for some steps in the interpolation phase. Further tricks
 are used to reduce the memory footprint of the whole multiplication algorithm
@@ -10220,7 +10480,10 @@ evaluating it,
 @example
 struct __gmp_binary_plus
 @{
-  static void eval(mpf_t f, mpf_t g, mpf_t h) @{ mpf_add(f, g, h); @}
+  static void eval(mpf_t f, const mpf_t g, const mpf_t h)
+  @{
+    mpf_add(f, g, h);
+  @}
 @};
 @end example
 
@@ -10413,6 +10676,13 @@ operations where one argument is a small compile-time constant, replace
 some heap allocations by stack allocations.  He also fixed the eofbit
 handling of C++ streams, and removed one division from @file{mpq/aors.c}.
 
+David S Miller wrote assembly code for SPARC T3 and T4.
+
+Mark Sofroniou cleaned up the types of mul_fft.c, letting it work for huge
+operands.
+
+Ulrich Weigand ported GMP to the powerpc64le ABI.
+
 (This list is chronological, not ordered after significance.  If you have
 contributed to GMP but are not listed above, please tell
 @email{gmp-devel@@gmplib.org} about the omission!)
@@ -10421,8 +10691,11 @@ The development of floating point functions of GNU MP 2, were supported in part
 by the ESPRIT-BRA (Basic Research Activities) 6846 project POSSO (POlynomial
 System SOlving).
 
-The development of GMP 2, 3, and 4 was supported in part by the IDA Center for
-Computing Sciences.
+The development of GMP 2, 3, and 4.0 was supported in part by the IDA Center
+for Computing Sciences.
+
+The development of GMP 4.3, 5.0, and 5.1 was supported in part by the Swedish
+Foundation for Strategic Research.
 
 Thanks go to Hans Thorsen for donating an SGI system for the GMP test system
 environment.
@@ -10472,8 +10745,8 @@ Applied Cryptography'', @uref{http://www.cacr.math.uwaterloo.ca/hac/}
 @item
 Richard M. Stallman and the GCC Developer Community, ``Using the GNU Compiler
 Collection'', Free Software Foundation, 2008, available online
-@uref{http://gcc.gnu.org/onlinedocs/}, and in the GCC package
-@uref{ftp://ftp.gnu.org/gnu/gcc/}
+@uref{https://gcc.gnu.org/onlinedocs/}, and in the GCC package
+@uref{https://ftp.gnu.org/gnu/gcc/}
 @end itemize
 
 @section Papers
@@ -10493,12 +10766,12 @@ Max-Planck-Institut fuer Informatik Research Report MPI-I-98-1-022,
 @item
 Torbj@"orn Granlund and Peter L. Montgomery, ``Division by Invariant Integers
 using Multiplication'', in Proceedings of the SIGPLAN PLDI'94 Conference, June
-1994.  Also available @uref{http://gmplib.org/~tege/divcnst-pldi94.pdf}.
+1994.  Also available @uref{https://gmplib.org/~tege/divcnst-pldi94.pdf}.
 
 @item
 Niels M@"oller and Torbj@"orn Granlund, ``Improved division by invariant
 integers'', IEEE Transactions on Computers, 11 June 2010.
-@uref{http://gmplib.org/~tege/division-paper.pdf}
+@uref{https://gmplib.org/~tege/division-paper.pdf}
 
 @item
 Torbj@"orn Granlund and Niels M@"oller, ``Division of integers large and
index 753589d9b56873e9b64dec3ea36f7954f86f1f44..7e1430d3d31231f88ebc3b95f681ee78ad0742ef 100644 (file)
@@ -3,17 +3,28 @@ Copyright 2000 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index 8941738a4acf0a9b4b99ab192c3ade48a5a4814e..60dc485a37847f65428d846fcf694d940cfb071f 100755 (executable)
@@ -1,9 +1,10 @@
 #!/bin/sh
 # Get modification time of a file or directory and pretty-print it.
 
-scriptversion=2003-11-09.00
+scriptversion=2010-08-21.06; # UTC
 
-# Copyright (C) 1995, 1996, 1997, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005, 2007, 2009, 2010
+# Free Software Foundation, Inc.
 # written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
 #
 # This program is free software; you can redistribute it and/or modify
@@ -17,8 +18,7 @@ scriptversion=2003-11-09.00
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -29,6 +29,15 @@ scriptversion=2003-11-09.00
 # bugs to <bug-automake@gnu.org> or send patches to
 # <automake-patches@gnu.org>.
 
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+fi
+
 case $1 in
   '')
      echo "$0: No file.  Try \`$0 --help' for more information." 1>&2
@@ -38,18 +47,26 @@ case $1 in
     cat <<\EOF
 Usage: mdate-sh [--help] [--version] FILE
 
-Pretty-print the modification time of FILE.
+Pretty-print the modification day of FILE, in the format:
+1 January 1970
 
 Report bugs to <bug-automake@gnu.org>.
 EOF
-    exit 0
+    exit $?
     ;;
   -v | --v*)
     echo "mdate-sh $scriptversion"
-    exit 0
+    exit $?
     ;;
 esac
 
+error ()
+{
+  echo "$0: $1" >&2
+  exit 1
+}
+
+
 # Prevent date giving response in another language.
 LANG=C
 export LANG
@@ -58,13 +75,15 @@ export LC_ALL
 LC_TIME=C
 export LC_TIME
 
-# GNU ls changes its time format in response to the TIME_STYLE variable, but
-# we cannot unset it since the V7 shell did not have an "unset" command.
-# The documentation says that the default is "posix-long-iso".
-#
-test "${TIME_STYLE+set}" = set && TIME_STYLE=posix-long-iso
+# GNU ls changes its time format in response to the TIME_STYLE
+# variable.  Since we cannot assume `unset' works, revert this
+# variable to its documented default.
+if test "${TIME_STYLE+set}" = set; then
+  TIME_STYLE=posix-long-iso
+  export TIME_STYLE
+fi
 
-save_arg1="$1"
+save_arg1=$1
 
 # Find out how to get the extended ls output of a file or directory.
 if ls -L /dev/null 1>/dev/null 2>&1; then
@@ -72,6 +91,10 @@ if ls -L /dev/null 1>/dev/null 2>&1; then
 else
   ls_command='ls -l -d'
 fi
+# Avoid user/group names that might have spaces, when possible.
+if ls -n /dev/null 1>/dev/null 2>&1; then
+  ls_command="$ls_command -n"
+fi
 
 # A `ls -l' line looks as follows on OS/2.
 #  drwxrwx---        0 Aug 11  2001 foo
@@ -86,13 +109,14 @@ fi
 # words should be skipped to get the date.
 
 # On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
-set x`$ls_command /`
+set x`$ls_command /`
 
 # Find which argument is the month.
 month=
 command=
 until test $month
 do
+  test $# -gt 0 || error "failed parsing \`$ls_command /' output"
   shift
   # Add another shift to the command.
   command="$command shift;"
@@ -112,14 +136,35 @@ do
   esac
 done
 
+test -n "$month" || error "failed parsing \`$ls_command /' output"
+
 # Get the extended ls output of the file or directory.
-set - x`eval "$ls_command \"\$save_arg1\""`
+set dummy x`eval "$ls_command \"\\\$save_arg1\""`
 
 # Remove all preceding arguments
 eval $command
 
-# Get the month.  Next argument is day, followed by the year or time.
-case $1 in
+# Because of the dummy argument above, month is in $2.
+#
+# On a POSIX system, we should have
+#
+# $# = 5
+# $1 = file size
+# $2 = month
+# $3 = day
+# $4 = year or time
+# $5 = filename
+#
+# On Darwin 7.7.0 and 7.6.0, we have
+#
+# $# = 4
+# $1 = day
+# $2 = month
+# $3 = year or time
+# $4 = filename
+
+# Get the month.
+case $2 in
   Jan) month=January; nummonth=1;;
   Feb) month=February; nummonth=2;;
   Mar) month=March; nummonth=3;;
@@ -134,7 +179,10 @@ case $1 in
   Dec) month=December; nummonth=12;;
 esac
 
-day=$2
+case $3 in
+  ???*) day=$1;;
+  *) day=$3; shift;;
+esac
 
 # Here we have to deal with the problem that the ls output gives either
 # the time of day or the year.
@@ -172,5 +220,6 @@ echo $day $month $year
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
index 35caf59fa7e668f9faf624219f478c7e7956ffe4..4a105142b0e5fe636633081f680e2a0e7a3956c5 100644 (file)
@@ -4,7 +4,7 @@
   <title>GMP Development Projects</title>
   <link rel="shortcut icon" href="favicon.ico">
   <link rel="stylesheet" href="gmp.css">
-  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 </head>
 
 <center>
 
 <font size=-1>
 <pre>
-Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011
-Free Software Foundation, Inc.
+Copyright 2000-2006, 2008-2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 </pre>
 </font>
 
 <hr>
 <!-- NB. timestamp updated automatically by emacs -->
-  This file current as of 5 Dec 2011.  An up-to-date version is available at
-  <a href="http://gmplib.org/projects.html">http://gmplib.org/projects.html</a>.
+  This file current as of 29 Jan 2014.  An up-to-date version is available at
+  <a href="https://gmplib.org/projects.html">https://gmplib.org/projects.html</a>.
   Please send comments about this page to gmp-devel<font>@</font>gmplib.org.
 
 <p> This file lists projects suitable for volunteers.  Please see the
@@ -72,7 +82,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
         lose in more expensive CRT. <br><br>
 
         <p> [We now have two implementations of this algorithm, one by Tommy
-        Färnqvist and one by Niels Möller.]
+        Färnqvist and one by Niels Möller.]
 
     <li> Work on short products.  Our mullo and mulmid are probably K, but we
          lack mulhi.
@@ -151,7 +161,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
 
   <p> Add more functions to the set of fat functions.
 
-  <p> The speed of multipliciaton is today highly dependent on combination
+  <p> The speed of multiplication is today highly dependent on combination
   functions like <code>addlsh1_n</code>.  A fat binary will never use any such
   functions, since they are classified as optional.  Ideally, we should use
   them, but making the current compile-time selections of optional functions
@@ -320,17 +330,6 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
       <code>gmp_restrict</code>.
 
 
-
-<li> <strong>Factorial</strong>
-
-  <p> Rewrite for simplicty and speed.  Work is in progress.
-
-
-<li> <strong>Binomial Coefficients</strong>
-
-  <p> Rewrite for simplicty and speed.  Work is in progress.
-
-
 <li> <strong>Prime Testing</strong>
 
   <p> GMP is not really a number theory library and probably shouldn't have
index 5d81d9c6ebaa61bc085d9b8a628800c55f263728..3fbde2e7d4d57a789d46c400205e33e3e993eae2 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 30 September 2013
-@set UPDATED-MONTH September 2013
-@set EDITION 5.1.3
-@set VERSION 5.1.3
+@set UPDATED 24 March 2014
+@set UPDATED-MONTH March 2014
+@set EDITION 6.0.0
+@set VERSION 6.0.0
index da4dfe0142cce51837486b9a843d209fdb94c289..9a25bef1a3eb53df3a837eff3a81d9b2a8ffa5d9 100644 (file)
@@ -4,7 +4,7 @@
   <title>GMP Itemized Development Tasks</title>
   <link rel="shortcut icon" href="favicon.ico">
   <link rel="stylesheet" href="gmp.css">
-  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 </head>
 
 <center>
 
 <font size=-1>
 <pre>
-Copyright 2000, 2001, 2002, 2003, 2004, 2006, 2008, 2009 Free Software
-Foundation, Inc.
+Copyright 2000-2004, 2006, 2008, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 </pre>
 </font>
 
 <hr>
 <!-- NB. timestamp updated automatically by emacs -->
-  This file current as of 5 Dec 2011.  An up-to-date version is available at
-  <a href="http://gmplib.org/tasks.html">http://gmplib.org/tasks.html</a>.
+  This file current as of 29 Jan 2014.  An up-to-date version is available at
+  <a href="https://gmplib.org/tasks.html">https://gmplib.org/tasks.html</a>.
   Please send comments about this page to gmp-devel<font>@</font>gmplib.org.
 
 <p> These are itemized GMP development tasks.  Not all the tasks
@@ -477,7 +487,7 @@ either already been taken care of, or have become irrelevant.
      Set <code>ALLOC(var)</code> to 0 to indicate nothing allocated, and let
      <code>_mpz_realloc</code> do the initial alloc.  Set
      <code>z-&gt;_mp_d</code> to a dummy that <code>mpz_get_ui</code> and
-     similar can unconditionally fetch from.  Niels Möller has had a go at
+     similar can unconditionally fetch from.  Niels Möller has had a go at
      this.
      <br>
      The advantages of the lazy scheme would be:
@@ -514,7 +524,7 @@ either already been taken care of, or have become irrelevant.
      if they could share code with the current such functions (which should be
      possible).
 <li> <code>mpz_and_ui</code> etc might be of use sometimes.  Suggested by
-     Niels Möller.
+     Niels Möller.
 <li> <code>mpf_set_str</code> and <code>mpf_inp_str</code> could usefully
      accept 0x, 0b etc when base==0.  Perhaps the exponent could default to
      decimal in this case, with a further 0x, 0b etc allowed there.
@@ -704,7 +714,7 @@ either already been taken care of, or have become irrelevant.
      Consider making these variant <code>mpz_set_str</code> etc forms
      available for <code>mpz_t</code> too, not just <code>mpz_class</code>
      etc.
-<li> <code>mpq_class operator+=</code>: Don't emit an unnecssary
+<li> <code>mpq_class operator+=</code>: Don't emit an unnecessary
      <code>mpq_set(q,q)</code> before <code>mpz_addmul</code> etc.
 <li> Put various bits of gmpxx.h into libgmpxx, to avoid excessive inlining.
      Candidates for this would be,
index 9f14cc5bdd849450f18a8f95576574f10c4606a3..85f184cc4cbbe2bd2bd347079cd5248212acaea8 100644 (file)
@@ -1,13 +1,13 @@
 % texinfo.tex -- TeX macros to handle Texinfo files.
-%
+% 
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2009-11-15.11}
+\def\texinfoversion{2013-02-01.11}
 %
-% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
+% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-% 2007, 2008 Free Software Foundation, Inc.
+% 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
 %
 % This texinfo.tex file is free software: you can redistribute it and/or
 % modify it under the terms of the GNU General Public License as
 %
 % As a special exception, when this file is read by TeX when processing
 % a Texinfo source document, you may use the result without
-% restriction.  (This has been our intent since Texinfo was invented.)
+% restriction. This Exception is an additional permission under section 7
+% of the GNU General Public License, version 3 ("GPLv3").
 %
 % Please try the latest version of texinfo.tex before submitting bug
 % reports; you can get the latest version from:
-%   http://www.gnu.org/software/texinfo/ (the Texinfo home page), or
-%   ftp://tug.org/tex/texinfo.tex
-%     (and all CTAN mirrors, see http://www.ctan.org).
+%   http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
+%   http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
+%   http://www.gnu.org/software/texinfo/ (the Texinfo home page)
 % The texinfo.tex in any given distribution could well be out
 % of date, so if that's what you're using, please check.
 %
@@ -65,7 +66,6 @@
 \everyjob{\message{[Texinfo version \texinfoversion]}%
   \catcode`+=\active \catcode`\_=\active}
 
-
 \chardef\other=12
 
 % We never want plain's \outer definition of \+ in Texinfo.
 \let\ptexnewwrite\newwrite
 \let\ptexnoindent=\noindent
 \let\ptexplus=+
+\let\ptexraggedright=\raggedright
 \let\ptexrbrace=\}
 \let\ptexslash=\/
 \let\ptexstar=\*
 \let\ptext=\t
 \let\ptextop=\top
+{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
 
 % If this character appears in an error message or help string, it
 % starts a new line in the output.
 % Set up fixed words for English if not already set.
 \ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
 \ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
+\ifx\putworderror\undefined     \gdef\putworderror{error}\fi
 \ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
 \ifx\putwordin\undefined        \gdef\putwordin{in}\fi
-\ifx\putwordIndexIsEmpty\undefined     \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
-\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
+\ifx\putwordIndexIsEmpty\undefined       \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
+\ifx\putwordIndexNonexistent\undefined   \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
 \ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
 \ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
 \def\spaceisspace{\catcode`\ =\spacecat}
 
 % sometimes characters are active, so we need control sequences.
+\chardef\ampChar   = `\&
 \chardef\colonChar = `\:
 \chardef\commaChar = `\,
 \chardef\dashChar  = `\-
 \chardef\dotChar   = `\.
 \chardef\exclamChar= `\!
+\chardef\hashChar  = `\#
 \chardef\lquoteChar= `\`
 \chardef\questChar = `\?
 \chardef\rquoteChar= `\'
 \chardef\semiChar  = `\;
+\chardef\slashChar = `\/
 \chardef\underChar = `\_
 
 % Ignore a token.
 % that mark overfull boxes (in case you have decided
 % that the text looks ok even though it passes the margin).
 %
-\def\finalout{\overfullrule=0pt}
-
-% @| inserts a changebar to the left of the current line.  It should
-% surround any changed text.  This approach does *not* work if the
-% change spans more than two lines of output.  To handle that, we would
-% have adopt a much more difficult approach (putting marks into the main
-% vertical list for the beginning and end of each change).
-%
-\def\|{%
-  % \vadjust can only be used in horizontal mode.
-  \leavevmode
-  %
-  % Append this vertical mode material after the current line in the output.
-  \vadjust{%
-    % We want to insert a rule with the height and depth of the current
-    % leading; that is exactly what \strutbox is supposed to record.
-    \vskip-\baselineskip
-    %
-    % \vadjust-items are inserted at the left edge of the type.  So
-    % the \llap here moves out into the left-hand margin.
-    \llap{%
-      %
-      % For a thicker or thinner bar, change the `1pt'.
-      \vrule height\baselineskip width1pt
-      %
-      % This is the space between the bar and the text.
-      \hskip 12pt
-    }%
-  }%
-}
+\def\finalout{\overfullrule=0pt }
 
 % Sometimes it is convenient to have everything in the transcript file
 % and nothing on the terminal.  We don't just call \tracingall here,
   \tracingmacros2
   \tracingrestores1
   \showboxbreadth\maxdimen \showboxdepth\maxdimen
-  \ifx\eTeXversion\undefined\else % etex gives us more logging
+  \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
     \tracingscantokens1
     \tracingifs1
     \tracinggroups1
   \errorcontextlines16
 }%
 
+% @errormsg{MSG}.  Do the index-like expansions on MSG, but if things
+% aren't perfect, it's not the end of the world, being an error message,
+% after all.
+% 
+\def\errormsg{\begingroup \indexnofonts \doerrormsg}
+\def\doerrormsg#1{\errmessage{#1}}
+
 % add check for \lastpenalty to plain's definitions.  If the last thing
 % we did was a \nobreak, we don't want to insert more space.
 %
 \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
   \removelastskip\penalty-200\bigskip\fi\fi}
 
-% For @cropmarks command.
 % Do @cropmarks to get crop marks.
 %
 \newif\ifcropmarks
                % We don't want .vr (or whatever) entries like this:
                % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}}
                % "\acronym" won't work when it's read back in;
-               % it needs to be 
+               % it needs to be
                % {\code {{\tt \backslashcurfont }acronym}
     \shipout\vbox{%
       % Do this early so pdf references go to the beginning of the page.
 }
 \def\inenvironment#1{%
   \ifx#1\empty
-    out of any environment%
+    outside of any environment%
   \else
     in environment \expandafter\string#1%
   \fi
 \parseargdef\end{%
   \if 1\csname iscond.#1\endcsname
   \else
-    % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03
+    % The general wording of \badenverr may not be ideal.
     \expandafter\checkenv\csname#1\endcsname
     \csname E#1\endcsname
     \endgroup
 \newhelp\EMsimple{Press RETURN to continue.}
 
 
-%% Simple single-character @ commands
-
-% @@ prints an @
-% Kludge this until the fonts are right (grr).
-\def\@{{\tt\char64}}
-
-% This is turned off because it was never documented
-% and you can use @w{...} around a quote to suppress ligatures.
-%% Define @` and @' to be the same as ` and '
-%% but suppressing ligatures.
-%\def\`{{`}}
-%\def\'{{'}}
-
-% Used to generate quoted braces.
-\def\mylbrace {{\tt\char123}}
-\def\myrbrace {{\tt\char125}}
-\let\{=\mylbrace
-\let\}=\myrbrace
-\begingroup
-  % Definitions to produce \{ and \} commands for indices,
-  % and @{ and @} for the aux/toc files.
-  \catcode`\{ = \other \catcode`\} = \other
-  \catcode`\[ = 1 \catcode`\] = 2
-  \catcode`\! = 0 \catcode`\\ = \other
-  !gdef!lbracecmd[\{]%
-  !gdef!rbracecmd[\}]%
-  !gdef!lbraceatcmd[@{]%
-  !gdef!rbraceatcmd[@}]%
-!endgroup
-
-% @comma{} to avoid , parsing problems.
-\let\comma = ,
-
-% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
-% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
-\let\, = \c
-\let\dotaccent = \.
-\def\ringaccent#1{{\accent23 #1}}
-\let\tieaccent = \t
-\let\ubaraccent = \b
-\let\udotaccent = \d
-
-% Other special characters: @questiondown @exclamdown @ordf @ordm
-% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
-\def\questiondown{?`}
-\def\exclamdown{!`}
-\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
-\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
-
-% Dotless i and dotless j, used for accents.
-\def\imacro{i}
-\def\jmacro{j}
-\def\dotless#1{%
-  \def\temp{#1}%
-  \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
-  \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
-  \else \errmessage{@dotless can be used only with i or j}%
-  \fi\fi
-}
-
-% The \TeX{} logo, as in plain, but resetting the spacing so that a
-% period following counts as ending a sentence.  (Idea found in latex.)
-%
-\edef\TeX{\TeX \spacefactor=1000 }
-
-% @LaTeX{} logo.  Not quite the same results as the definition in
-% latex.ltx, since we use a different font for the raised A; it's most
-% convenient for us to use an explicitly smaller font, rather than using
-% the \scriptstyle font (since we don't reset \scriptstyle and
-% \scriptscriptstyle).
-%
-\def\LaTeX{%
-  L\kern-.36em
-  {\setbox0=\hbox{T}%
-   \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}%
-  \kern-.15em
-  \TeX
-}
-
 % Be sure we're in horizontal mode when doing a tie, since we make space
 % equivalent to this in @example-like environments. Otherwise, a space
 % at the beginning of a line will start with \penalty -- and
 \def\:{\spacefactor=1000 }
 
 % @* forces a line break.
-\def\*{\hfil\break\hbox{}\ignorespaces}
+\def\*{\unskip\hfil\break\hbox{}\ignorespaces}
 
 % @/ allows a line break.
 \let\/=\allowbreak
 \def\?{?\spacefactor=\endofsentencespacefactor\space}
 
 % @frenchspacing on|off  says whether to put extra space after punctuation.
-% 
+%
 \def\onword{on}
 \def\offword{off}
 %
   \else\ifx\temp\offword \plainnonfrenchspacing
   \else
     \errhelp = \EMsimple
-    \errmessage{Unknown @frenchspacing option `\temp', must be on/off}%
+    \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
   \fi\fi
 }
 
@@ -798,15 +702,6 @@ where each line of input produces a line of output.}
 
 \newdimen\mil  \mil=0.001in
 
-% Old definition--didn't work.
-%\parseargdef\need{\par %
-%% This method tries to make TeX break the page naturally
-%% if the depth of the box does not fit.
-%{\baselineskip=0pt%
-%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
-%\prevdepth=-1000pt
-%}}
-
 \parseargdef\need{%
   % Ensure vertical mode, so we don't make a big box in the middle of a
   % paragraph.
@@ -870,7 +765,7 @@ where each line of input produces a line of output.}
 
 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
 % paragraph.  For more general purposes, use the \margin insertion
-% class.  WHICH is `l' or `r'.
+% class.  WHICH is `l' or `r'.  Not documented, written for gawk manual.
 %
 \newskip\inmarginspacing \inmarginspacing=1cm
 \def\strutdepth{\dp\strutbox}
@@ -917,6 +812,36 @@ where each line of input produces a line of output.}
   \temp
 }
 
+% @| inserts a changebar to the left of the current line.  It should
+% surround any changed text.  This approach does *not* work if the
+% change spans more than two lines of output.  To handle that, we would
+% have adopt a much more difficult approach (putting marks into the main
+% vertical list for the beginning and end of each change).  This command
+% is not documented, not supported, and doesn't work.
+%
+\def\|{%
+  % \vadjust can only be used in horizontal mode.
+  \leavevmode
+  %
+  % Append this vertical mode material after the current line in the output.
+  \vadjust{%
+    % We want to insert a rule with the height and depth of the current
+    % leading; that is exactly what \strutbox is supposed to record.
+    \vskip-\baselineskip
+    %
+    % \vadjust-items are inserted at the left edge of the type.  So
+    % the \llap here moves out into the left-hand margin.
+    \llap{%
+      %
+      % For a thicker or thinner bar, change the `1pt'.
+      \vrule height\baselineskip width1pt
+      %
+      % This is the space between the bar and the text.
+      \hskip 12pt
+    }%
+  }%
+}
+
 % @include FILE -- \input text of FILE.
 %
 \def\include{\parseargusing\filenamecatcodes\includezzz}
@@ -926,6 +851,8 @@ where each line of input produces a line of output.}
   {%
     \makevalueexpandable  % we want to expand any @value in FILE.
     \turnoffactive        % and allow special characters in the expansion
+    \indexnofonts         % Allow `@@' and other weird things in file names.
+    \wlog{texinfo.tex: doing @include of #1^^J}%
     \edef\temp{\noexpand\input #1 }%
     %
     % This trickery is to read FILE outside of a group, in case it makes
@@ -944,6 +871,8 @@ where each line of input produces a line of output.}
   \catcode`>=\other
   \catcode`+=\other
   \catcode`-=\other
+  \catcode`\`=\other
+  \catcode`\'=\other
 }
 
 \def\pushthisfilestack{%
@@ -959,7 +888,7 @@ where each line of input produces a line of output.}
 \def\popthisfilestack{\errthisfilestackempty}
 \def\errthisfilestackempty{\errmessage{Internal error:
   the stack of filenames is empty.}}
-
+%
 \def\thisfile{}
 
 % @center line
@@ -967,36 +896,46 @@ where each line of input produces a line of output.}
 %
 \parseargdef\center{%
   \ifhmode
-    \let\next\centerH
+    \let\centersub\centerH
   \else
-    \let\next\centerV
+    \let\centersub\centerV
   \fi
-  \next{\hfil \ignorespaces#1\unskip \hfil}%
+  \centersub{\hfil \ignorespaces#1\unskip \hfil}%
+  \let\centersub\relax % don't let the definition persist, just in case
 }
-\def\centerH#1{%
-  {%
-    \hfil\break
-    \advance\hsize by -\leftskip
-    \advance\hsize by -\rightskip
-    \line{#1}%
-    \break
-  }%
+\def\centerH#1{{%
+  \hfil\break
+  \advance\hsize by -\leftskip
+  \advance\hsize by -\rightskip
+  \line{#1}%
+  \break
+}}
+%
+\newcount\centerpenalty
+\def\centerV#1{%
+  % The idea here is the same as in \startdefun, \cartouche, etc.: if
+  % @center is the first thing after a section heading, we need to wipe
+  % out the negative parskip inserted by \sectionheading, but still
+  % prevent a page break here.
+  \centerpenalty = \lastpenalty
+  \ifnum\centerpenalty>10000 \vskip\parskip \fi
+  \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
+  \line{\kern\leftskip #1\kern\rightskip}%
 }
-\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}}
 
 % @sp n   outputs n lines of vertical space
-
+%
 \parseargdef\sp{\vskip #1\baselineskip}
 
 % @comment ...line which is ignored...
 % @c is the same as @comment
 % @ignore ... @end ignore  is another way to write a comment
-
+%
 \def\comment{\begingroup \catcode`\^^M=\other%
 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
 \commentxxx}
 {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
-
+%
 \let\c=\comment
 
 % @paragraphindent NCHARS
@@ -1089,107 +1028,6 @@ where each line of input produces a line of output.}
 }
 
 
-% @asis just yields its argument.  Used with @table, for example.
-%
-\def\asis#1{#1}
-
-% @math outputs its argument in math mode.
-%
-% One complication: _ usually means subscripts, but it could also mean
-% an actual _ character, as in @math{@var{some_variable} + 1}.  So make
-% _ active, and distinguish by seeing if the current family is \slfam,
-% which is what @var uses.
-{
-  \catcode`\_ = \active
-  \gdef\mathunderscore{%
-    \catcode`\_=\active
-    \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
-  }
-}
-% Another complication: we want \\ (and @\) to output a \ character.
-% FYI, plain.tex uses \\ as a temporary control sequence (why?), but
-% this is not advertised and we don't care.  Texinfo does not
-% otherwise define @\.
-%
-% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
-\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
-%
-\def\math{%
-  \tex
-  \mathunderscore
-  \let\\ = \mathbackslash
-  \mathactive
-  % make the texinfo accent commands work in math mode
-  \let\"=\ddot
-  \let\'=\acute
-  \let\==\bar
-  \let\^=\hat
-  \let\`=\grave
-  \let\u=\breve
-  \let\v=\check
-  \let\~=\tilde
-  \let\dotaccent=\dot
-  $\finishmath
-}
-\def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
-
-% Some active characters (such as <) are spaced differently in math.
-% We have to reset their definitions in case the @math was an argument
-% to a command which sets the catcodes (such as @item or @section).
-%
-{
-  \catcode`^ = \active
-  \catcode`< = \active
-  \catcode`> = \active
-  \catcode`+ = \active
-  \gdef\mathactive{%
-    \let^ = \ptexhat
-    \let< = \ptexless
-    \let> = \ptexgtr
-    \let+ = \ptexplus
-  }
-}
-
-% Some math mode symbols.
-\def\bullet{$\ptexbullet$}
-\def\geq{\ifmmode \ge\else $\ge$\fi}
-\def\leq{\ifmmode \le\else $\le$\fi}
-\def\minus{\ifmmode -\else $-$\fi}
-
-% @dots{} outputs an ellipsis using the current font.
-% We do .5em per period so that it has the same spacing in the cm
-% typewriter fonts as three actual period characters; on the other hand,
-% in other typewriter fonts three periods are wider than 1.5em.  So do
-% whichever is larger.
-%
-\def\dots{%
-  \leavevmode
-  \setbox0=\hbox{...}% get width of three periods
-  \ifdim\wd0 > 1.5em
-    \dimen0 = \wd0
-  \else
-    \dimen0 = 1.5em
-  \fi
-  \hbox to \dimen0{%
-    \hskip 0pt plus.25fil
-    .\hskip 0pt plus1fil
-    .\hskip 0pt plus1fil
-    .\hskip 0pt plus.5fil
-  }%
-}
-
-% @enddots{} is an end-of-sentence ellipsis.
-%
-\def\enddots{%
-  \dots
-  \spacefactor=\endofsentencespacefactor
-}
-
-% @comma{} is so commas can be inserted into text without messing up
-% Texinfo's parsing.
-%
-\let\comma = ,
-
 % @refill is a no-op.
 \let\refill=\relax
 
@@ -1254,9 +1092,8 @@ where each line of input produces a line of output.}
 \newif\ifpdfmakepagedest
 
 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
-% can be set).  So we test for \relax and 0 as well as \undefined,
-% borrowed from ifpdf.sty.
-\ifx\pdfoutput\undefined
+% can be set).  So we test for \relax and 0 as well as being undefined.
+\ifx\pdfoutput\thisisundefined
 \else
   \ifx\pdfoutput\relax
   \else
@@ -1271,50 +1108,24 @@ where each line of input produces a line of output.}
 % for display in the outlines, and in other places.  Thus, we have to
 % double any backslashes.  Otherwise, a name like "\node" will be
 % interpreted as a newline (\n), followed by o, d, e.  Not good.
-% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html
-% (and related messages, the final outcome is that it is up to the TeX
-% user to double the backslashes and otherwise make the string valid, so
-% that's what we do).
-
-% double active backslashes.
 % 
-{\catcode`\@=0 \catcode`\\=\active
- @gdef@activebackslashdouble{%
-   @catcode`@\=@active
-   @let\=@doublebackslash}
-}
-
-% To handle parens, we must adopt a different approach, since parens are
-% not active characters.  hyperref.dtx (which has the same problem as
-% us) handles it with this amazing macro to replace tokens, with minor
-% changes for Texinfo.  It is included here under the GPL by permission
-% from the author, Heiko Oberdiek.
-% 
-% #1 is the tokens to replace.
-% #2 is the replacement.
-% #3 is the control sequence with the string.
-% 
-\def\HyPsdSubst#1#2#3{%
-  \def\HyPsdReplace##1#1##2\END{%
-    ##1%
-    \ifx\\##2\\%
-    \else
-      #2%
-      \HyReturnAfterFi{%
-        \HyPsdReplace##2\END
-      }%
-    \fi
-  }%
-  \xdef#3{\expandafter\HyPsdReplace#3#1\END}%
-}
-\long\def\HyReturnAfterFi#1\fi{\fi#1}
-
-% #1 is a control sequence in which to do the replacements.
-\def\backslashparens#1{%
-  \xdef#1{#1}% redefine it as its expansion; the definition is simply
-             % \lastnode when called from \setref -> \pdfmkdest.
-  \HyPsdSubst{(}{\realbackslash(}{#1}%
-  \HyPsdSubst{)}{\realbackslash)}{#1}%
+% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
+% related messages.  The final outcome is that it is up to the TeX user
+% to double the backslashes and otherwise make the string valid, so
+% that's what we do.  pdftex 1.30.0 (ca.2005) introduced a primitive to
+% do this reliably, so we use it.
+
+% #1 is a control sequence in which to do the replacements,
+% which we \xdef.
+\def\txiescapepdf#1{%
+  \ifx\pdfescapestring\thisisundefined
+    % No primitive available; should we give a warning or log?
+    % Many times it won't matter.
+  \else
+    % The expandable \pdfescapestring primitive escapes parentheses,
+    % backslashes, and other special chars.
+    \xdef#1{\pdfescapestring{#1}}%
+  \fi
 }
 
 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
@@ -1324,11 +1135,17 @@ output) for that.)}
 
 \ifpdf
   %
-  % Color manipulation macros based on pdfcolor.tex.
-  \def\cmykDarkRed{0.28 1 1 0.35}
-  \def\cmykBlack{0 0 0 1}
+  % Color manipulation macros based on pdfcolor.tex,
+  % except using rgb instead of cmyk; the latter is said to render as a
+  % very dark gray on-screen and a very dark halftone in print, instead
+  % of actual black.
+  \def\rgbDarkRed{0.50 0.09 0.12}
+  \def\rgbBlack{0 0 0}
+  %
+  % k sets the color for filling (usual text, etc.);
+  % K sets the color for stroking (thin rules, e.g., normal _'s).
+  \def\pdfsetcolor#1{\pdfliteral{#1 rg  #1 RG}}
   %
-  \def\pdfsetcolor#1{\pdfliteral{#1 k}}
   % Set color, and create a mark which defines \thiscolor accordingly,
   % so that \makeheadline knows which color to restore.
   \def\setcolor#1{%
@@ -1337,7 +1154,7 @@ output) for that.)}
     \pdfsetcolor{#1}%
   }
   %
-  \def\maincolor{\cmykBlack}
+  \def\maincolor{\rgbBlack}
   \pdfsetcolor{\maincolor}
   \edef\thiscolor{\maincolor}
   \def\lastcolordefs{}
@@ -1367,32 +1184,34 @@ output) for that.)}
   %
   % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
   \def\dopdfimage#1#2#3{%
-    \def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
-    \def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
+    \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
+    \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
     %
-    % pdftex (and the PDF format) support .png, .jpg, .pdf (among
-    % others).  Let's try in that order.
+    % pdftex (and the PDF format) support .pdf, .png, .jpg (among
+    % others).  Let's try in that order, PDF first since if
+    % someone has a scalable image, presumably better to use that than a
+    % bitmap.
     \let\pdfimgext=\empty
     \begingroup
-      \openin 1 #1.png \ifeof 1
-        \openin 1 #1.jpg \ifeof 1
-          \openin 1 #1.jpeg \ifeof 1
-            \openin 1 #1.JPG \ifeof 1
-              \openin 1 #1.pdf \ifeof 1
-                \openin 1 #1.PDF \ifeof 1
+      \openin 1 #1.pdf \ifeof 1
+        \openin 1 #1.PDF \ifeof 1
+          \openin 1 #1.png \ifeof 1
+            \openin 1 #1.jpg \ifeof 1
+              \openin 1 #1.jpeg \ifeof 1
+                \openin 1 #1.JPG \ifeof 1
                   \errhelp = \nopdfimagehelp
                   \errmessage{Could not find image file #1 for pdf}%
-                \else \gdef\pdfimgext{PDF}%
+                \else \gdef\pdfimgext{JPG}%
                 \fi
-              \else \gdef\pdfimgext{pdf}%
+              \else \gdef\pdfimgext{jpeg}%
               \fi
-            \else \gdef\pdfimgext{JPG}%
+            \else \gdef\pdfimgext{jpg}%
             \fi
-          \else \gdef\pdfimgext{jpeg}%
+          \else \gdef\pdfimgext{png}%
           \fi
-        \else \gdef\pdfimgext{jpg}%
+        \else \gdef\pdfimgext{PDF}%
         \fi
-      \else \gdef\pdfimgext{png}%
+      \else \gdef\pdfimgext{pdf}%
       \fi
       \closein 1
     \endgroup
@@ -1404,8 +1223,8 @@ output) for that.)}
     \else
       \immediate\pdfximage
     \fi
-      \ifdim \wd0 >0pt width \imagewidth \fi
-      \ifdim \wd2 >0pt height \imageheight \fi
+      \ifdim \wd0 >0pt width \pdfimagewidth \fi
+      \ifdim \wd2 >0pt height \pdfimageheight \fi
       \ifnum\pdftexversion<13
          #1.\pdfimgext
        \else
@@ -1420,10 +1239,9 @@ output) for that.)}
     % such as \, aren't expanded when present in a section title.
     \indexnofonts
     \turnoffactive
-    \activebackslashdouble
     \makevalueexpandable
     \def\pdfdestname{#1}%
-    \backslashparens\pdfdestname
+    \txiescapepdf\pdfdestname
     \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
   }}
   %
@@ -1432,8 +1250,8 @@ output) for that.)}
   %
   % by default, use a color that is dark enough to print on paper as
   % nearly black, but still distinguishable for online viewing.
-  \def\urlcolor{\cmykDarkRed}
-  \def\linkcolor{\cmykDarkRed}
+  \def\urlcolor{\rgbDarkRed}
+  \def\linkcolor{\rgbDarkRed}
   \def\endlink{\setcolor{\maincolor}\pdfendlink}
   %
   % Adding outlines to PDF; macros for calculating structure of outlines
@@ -1455,29 +1273,24 @@ output) for that.)}
     % page number.  We could generate a destination for the section
     % text in the case where a section has no node, but it doesn't
     % seem worth the trouble, since most documents are normally structured.
-    \def\pdfoutlinedest{#3}%
+    \edef\pdfoutlinedest{#3}%
     \ifx\pdfoutlinedest\empty
       \def\pdfoutlinedest{#4}%
     \else
-      % Doubled backslashes in the name.
-      {\activebackslashdouble \xdef\pdfoutlinedest{#3}%
-       \backslashparens\pdfoutlinedest}%
+      \txiescapepdf\pdfoutlinedest
     \fi
     %
-    % Also double the backslashes in the display string.
-    {\activebackslashdouble \xdef\pdfoutlinetext{#1}%
-     \backslashparens\pdfoutlinetext}%
+    % Also escape PDF chars in the display string.
+    \edef\pdfoutlinetext{#1}%
+    \txiescapepdf\pdfoutlinetext
     %
     \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
   }
   %
   \def\pdfmakeoutlines{%
     \begingroup
-      % Thanh's hack / proper braces in bookmarks
-      \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
-      \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
-      %
       % Read toc silently, to get counts of subentries for \pdfoutline.
+      \def\partentry##1##2##3##4{}% ignore parts in the outlines
       \def\numchapentry##1##2##3##4{%
        \def\thischapnum{##2}%
        \def\thissecnum{0}%
@@ -1531,25 +1344,41 @@ output) for that.)}
       % Latin 2 (0xea) gets translated to a | character.  Info from
       % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
       %
-      % xx to do this right, we have to translate 8-bit characters to
-      % their "best" equivalent, based on the @documentencoding.  Right
-      % now, I guess we'll just let the pdf reader have its way.
+      % TODO this right, we have to translate 8-bit characters to
+      % their "best" equivalent, based on the @documentencoding.  Too
+      % much work for too little return.  Just use the ASCII equivalents
+      % we use for the index sort strings.
+      % 
       \indexnofonts
       \setupdatafile
+      % We can have normal brace characters in the PDF outlines, unlike
+      % Texinfo index files.  So set that up.
+      \def\{{\lbracecharliteral}%
+      \def\}{\rbracecharliteral}%
       \catcode`\\=\active \otherbackslash
       \input \tocreadfilename
     \endgroup
   }
+  {\catcode`[=1 \catcode`]=2
+   \catcode`{=\other \catcode`}=\other
+   \gdef\lbracecharliteral[{]%
+   \gdef\rbracecharliteral[}]%
+  ]
   %
   \def\skipspaces#1{\def\PP{#1}\def\D{|}%
     \ifx\PP\D\let\nextsp\relax
     \else\let\nextsp\skipspaces
-      \ifx\p\space\else\addtokens{\filename}{\PP}%
-        \advance\filenamelength by 1
-      \fi
+      \addtokens{\filename}{\PP}%
+      \advance\filenamelength by 1
     \fi
     \nextsp}
-  \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
+  \def\getfilename#1{%
+    \filenamelength=0
+    % If we don't expand the argument now, \skipspaces will get
+    % snagged on things like "@value{foo}".
+    \edef\temp{#1}%
+    \expandafter\skipspaces\temp|\relax
+  }
   \ifnum\pdftexversion < 14
     \let \startlink \pdfannotlink
   \else
@@ -1562,11 +1391,15 @@ output) for that.)}
       % tried to figure out what each command should do in the context
       % of @url.  for now, just make @/ a no-op, that's the only one
       % people have actually reported a problem with.
-      % 
+      %
       \normalturnoffactive
       \def\@{@}%
       \let\/=\empty
       \makevalueexpandable
+      % do we want to go so far as to use \indexnofonts instead of just
+      % special-casing \var here?
+      \def\var##1{##1}%
+      %
       \leavevmode\setcolor{\urlcolor}%
       \startlink attr{/Border [0 0 0]}%
         user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
@@ -1597,6 +1430,7 @@ output) for that.)}
     \setcolor{\linkcolor}#1\endlink}
   \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
 \else
+  % non-pdf mode
   \let\pdfmkdest = \gobble
   \let\pdfurl = \gobble
   \let\endlink = \relax
@@ -1627,6 +1461,10 @@ output) for that.)}
 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
 \def\tt{\fam=\ttfam \setfontstyle{tt}}
 
+% Unfortunately, we have to override this for titles and the like, since
+% in those cases "rm" is bold.  Sigh.
+\def\rmisbold{\rm\def\curfontstyle{bf}}
+
 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
 % So we set up a \sf.
 \newfam\sffam
@@ -1637,9 +1475,6 @@ output) for that.)}
 \def\ttsl{\setfontstyle{ttsl}}
 
 
-% Default leading.
-\newdimen\textleading  \textleading = 13.2pt
-
 % Set the baselineskip to #1, and the lineskip and strut size
 % correspondingly.  There is no deep meaning behind these magic numbers
 % used as factors; they just match (closely enough) what Knuth defined.
@@ -1651,6 +1486,7 @@ output) for that.)}
 % can get a sort of poor man's double spacing by redefining this.
 \def\baselinefactor{1}
 %
+\newdimen\textleading
 \def\setleading#1{%
   \dimen0 = #1\relax
   \normalbaselineskip = \baselinefactor\dimen0
@@ -1672,7 +1508,7 @@ output) for that.)}
 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
 % (\pdffontattr was introduced many years ago, but people still run
 % older pdftex's; it's easy to conditionalize, so we do.)
-\ifpdf \ifx\pdffontattr\undefined \else
+\ifpdf \ifx\pdffontattr\thisisundefined \else
   \begingroup
     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
@@ -1923,28 +1759,34 @@ end
 \fi\fi
 
 
-% Set the font macro #1 to the font named #2, adding on the
-% specified font prefix (normally `cm').
+% Set the font macro #1 to the font named \fontprefix#2.
 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
-% encoding (currently only OT1, OT1IT and OT1TT are allowed, pass
-% empty to omit).
+% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
+% Example:
+% #1 = \textrm
+% #2 = \rmshape
+% #3 = 10
+% #4 = \mainmagstep
+% #5 = OT1
+%
 \def\setfont#1#2#3#4#5{%
   \font#1=\fontprefix#2#3 scaled #4
   \csname cmap#5\endcsname#1%
 }
 % This is what gets called when #5 of \setfont is empty.
 \let\cmap\gobble
-% emacs-page end of cmaps
+%
+% (end of cmaps)
 
 % Use cm as the default font prefix.
 % To specify the font prefix, you must define \fontprefix
 % before you read in texinfo.tex.
-\ifx\fontprefix\undefined
+\ifx\fontprefix\thisisundefined
 \def\fontprefix{cm}
 \fi
 % Support font families that don't use the same naming scheme as CM.
 \def\rmshape{r}
-\def\rmbshape{bx}               %where the normal face is bold
+\def\rmbshape{bx}               % where the normal face is bold
 \def\bfshape{b}
 \def\bxshape{bx}
 \def\ttshape{tt}
@@ -1959,9 +1801,8 @@ end
 \def\scshape{csc}
 \def\scbshape{csc}
 
-% Definitions for a main text size of 11pt.  This is the default in
-% Texinfo.
-% 
+% Definitions for a main text size of 11pt.  (The default in Texinfo.)
+%
 \def\definetextfontsizexi{%
 % Text fonts (11.2pt, magstep1).
 \def\textnominalsize{11pt}
@@ -2024,8 +1865,6 @@ end
 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
 \font\titlei=cmmi12 scaled \magstep3
 \font\titlesy=cmsy10 scaled \magstep4
-\def\authorrm{\secrm}
-\def\authortt{\sectt}
 \def\titleecsize{2074}
 
 % Chapter (and unnumbered) fonts (17.28pt).
@@ -2084,17 +1923,17 @@ end
 \font\reducedsy=cmsy10
 \def\reducedecsize{1000}
 
-% reset the current fonts
-\textfonts
+\textleading = 13.2pt % line spacing for 11pt CM
+\textfonts            % reset the current fonts
 \rm
-} % end of 11pt text font size definitions
+} % end of 11pt text font size definitions, \definetextfontsizexi
 
 
 % Definitions to make the main text be 10pt Computer Modern, with
 % section, chapter, etc., sizes following suit.  This is for the GNU
 % Press printing of the Emacs 22 manual.  Maybe other manuals in the
 % future.  Used with @smallbook, which sets the leading to 12pt.
-% 
+%
 \def\definetextfontsizex{%
 % Text fonts (10pt).
 \def\textnominalsize{10pt}
@@ -2157,8 +1996,6 @@ end
 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
 \font\titlei=cmmi12 scaled \magstep3
 \font\titlesy=cmsy10 scaled \magstep4
-\def\authorrm{\secrm}
-\def\authortt{\sectt}
 \def\titleecsize{2074}
 
 % Chapter fonts (14.4pt).
@@ -2185,7 +2022,7 @@ end
 \setfont\secsf\sfbshape{12}{1000}{OT1}
 \let\secbf\secrm
 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
-\font\seci=cmmi12 
+\font\seci=cmmi12
 \font\secsy=cmsy10 scaled \magstep1
 \def\sececsize{1200}
 
@@ -2217,29 +2054,28 @@ end
 \font\reducedsy=cmsy9
 \def\reducedecsize{0900}
 
-% reduce space between paragraphs
-\divide\parskip by 2
-
-% reset the current fonts
-\textfonts
+\divide\parskip by 2  % reduce space between paragraphs
+\textleading = 12pt   % line spacing for 10pt CM
+\textfonts            % reset the current fonts
 \rm
-} % end of 10pt text font size definitions
+} % end of 10pt text font size definitions, \definetextfontsizex
 
 
 % We provide the user-level command
 %   @fonttextsize 10
 % (or 11) to redefine the text font size.  pt is assumed.
-% 
-\def\xword{10}
+%
 \def\xiword{11}
+\def\xword{10}
+\def\xwordpt{10pt}
 %
 \parseargdef\fonttextsize{%
   \def\textsizearg{#1}%
-  \wlog{doing @fonttextsize \textsizearg}%
+  %\wlog{doing @fonttextsize \textsizearg}%
   %
   % Set \globaldefs so that documents can use this inside @tex, since
   % makeinfo 4.8 does not support it, but we need it nonetheless.
-  % 
+  %
  \begingroup \globaldefs=1
   \ifx\textsizearg\xword \definetextfontsizex
   \else \ifx\textsizearg\xiword \definetextfontsizexi
@@ -2289,8 +2125,8 @@ end
   \let\tenttsl=\titlettsl
   \def\curfontsize{title}%
   \def\lsize{chap}\def\lllsize{subsec}%
-  \resetmathfonts \setleading{25pt}}
-\def\titlefont#1{{\titlefonts\rm #1}}
+  \resetmathfonts \setleading{27pt}}
+\def\titlefont#1{{\titlefonts\rmisbold #1}}
 \def\chapfonts{%
   \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
   \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
@@ -2341,6 +2177,16 @@ end
   \def\lsize{smaller}\def\lllsize{smaller}%
   \resetmathfonts \setleading{9.5pt}}
 
+% Fonts for short table of contents.
+\setfont\shortcontrm\rmshape{12}{1000}{OT1}
+\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
+\setfont\shortcontsl\slshape{12}{1000}{OT1}
+\setfont\shortconttt\ttshape{12}{1000}{OT1TT}
+
+% Define these just so they can be easily changed for other fonts.
+\def\angleleft{$\langle$}
+\def\angleright{$\rangle$}
+
 % Set the fonts to use with the @small... environments.
 \let\smallexamplefonts = \smallfonts
 
@@ -2354,53 +2200,213 @@ end
 %
 % By the way, for comparison, here's what fits with @example (10pt):
 %   8.5x11=71  smallbook=60  a4=75  a5=58
-%
-% I wish the USA used A4 paper.
 % --karl, 24jan03.
 
-
 % Set up the default fonts, so we can use them for creating boxes.
 %
 \definetextfontsizexi
 
-% Define these so they can be easily changed for other fonts.
-\def\angleleft{$\langle$}
-\def\angleright{$\rangle$}
+
+\message{markup,}
+
+% Check if we are currently using a typewriter font.  Since all the
+% Computer Modern typewriter fonts have zero interword stretch (and
+% shrink), and it is reasonable to expect all typewriter fonts to have
+% this property, we can check that font parameter.
+%
+\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
+
+% Markup style infrastructure.  \defmarkupstylesetup\INITMACRO will
+% define and register \INITMACRO to be called on markup style changes.
+% \INITMACRO can check \currentmarkupstyle for the innermost
+% style and the set of \ifmarkupSTYLE switches for all styles
+% currently in effect.
+\newif\ifmarkupvar
+\newif\ifmarkupsamp
+\newif\ifmarkupkey
+%\newif\ifmarkupfile % @file == @samp.
+%\newif\ifmarkupoption % @option == @samp.
+\newif\ifmarkupcode
+\newif\ifmarkupkbd
+%\newif\ifmarkupenv % @env == @code.
+%\newif\ifmarkupcommand % @command == @code.
+\newif\ifmarkuptex % @tex (and part of @math, for now).
+\newif\ifmarkupexample
+\newif\ifmarkupverb
+\newif\ifmarkupverbatim
+
+\let\currentmarkupstyle\empty
+
+\def\setupmarkupstyle#1{%
+  \csname markup#1true\endcsname
+  \def\currentmarkupstyle{#1}%
+  \markupstylesetup
+}
+
+\let\markupstylesetup\empty
+
+\def\defmarkupstylesetup#1{%
+  \expandafter\def\expandafter\markupstylesetup
+    \expandafter{\markupstylesetup #1}%
+  \def#1%
+}
+
+% Markup style setup for left and right quotes.
+\defmarkupstylesetup\markupsetuplq{%
+  \expandafter\let\expandafter \temp
+    \csname markupsetuplq\currentmarkupstyle\endcsname
+  \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
+}
+
+\defmarkupstylesetup\markupsetuprq{%
+  \expandafter\let\expandafter \temp
+    \csname markupsetuprq\currentmarkupstyle\endcsname
+  \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
+}
+
+{
+\catcode`\'=\active
+\catcode`\`=\active
+
+\gdef\markupsetuplqdefault{\let`\lq}
+\gdef\markupsetuprqdefault{\let'\rq}
+
+\gdef\markupsetcodequoteleft{\let`\codequoteleft}
+\gdef\markupsetcodequoteright{\let'\codequoteright}
+}
+
+\let\markupsetuplqcode \markupsetcodequoteleft
+\let\markupsetuprqcode \markupsetcodequoteright
+%
+\let\markupsetuplqexample \markupsetcodequoteleft
+\let\markupsetuprqexample \markupsetcodequoteright
+%
+\let\markupsetuplqkbd     \markupsetcodequoteleft
+\let\markupsetuprqkbd     \markupsetcodequoteright
+%
+\let\markupsetuplqsamp \markupsetcodequoteleft
+\let\markupsetuprqsamp \markupsetcodequoteright
+%
+\let\markupsetuplqverb \markupsetcodequoteleft
+\let\markupsetuprqverb \markupsetcodequoteright
+%
+\let\markupsetuplqverbatim \markupsetcodequoteleft
+\let\markupsetuprqverbatim \markupsetcodequoteright
+
+% Allow an option to not use regular directed right quote/apostrophe
+% (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
+% The undirected quote is ugly, so don't make it the default, but it
+% works for pasting with more pdf viewers (at least evince), the
+% lilypond developers report.  xpdf does work with the regular 0x27.
+%
+\def\codequoteright{%
+  \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
+    \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
+      '%
+    \else \char'15 \fi
+  \else \char'15 \fi
+}
+%
+% and a similar option for the left quote char vs. a grave accent.
+% Modern fonts display ASCII 0x60 as a grave accent, so some people like
+% the code environments to do likewise.
+%
+\def\codequoteleft{%
+  \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
+    \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
+      % [Knuth] pp. 380,381,391
+      % \relax disables Spanish ligatures ?` and !` of \tt font.
+      \relax`%
+    \else \char'22 \fi
+  \else \char'22 \fi
+}
+
+% Commands to set the quote options.
+% 
+\parseargdef\codequoteundirected{%
+  \def\temp{#1}%
+  \ifx\temp\onword
+    \expandafter\let\csname SETtxicodequoteundirected\endcsname
+      = t%
+  \else\ifx\temp\offword
+    \expandafter\let\csname SETtxicodequoteundirected\endcsname
+      = \relax
+  \else
+    \errhelp = \EMsimple
+    \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
+  \fi\fi
+}
+%
+\parseargdef\codequotebacktick{%
+  \def\temp{#1}%
+  \ifx\temp\onword
+    \expandafter\let\csname SETtxicodequotebacktick\endcsname
+      = t%
+  \else\ifx\temp\offword
+    \expandafter\let\csname SETtxicodequotebacktick\endcsname
+      = \relax
+  \else
+    \errhelp = \EMsimple
+    \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
+  \fi\fi
+}
+
+% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
+\def\noligaturesquoteleft{\relax\lq}
 
 % Count depth in font-changes, for error checks
 \newcount\fontdepth \fontdepth=0
 
-% Fonts for short table of contents.
-\setfont\shortcontrm\rmshape{12}{1000}{OT1}
-\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
-\setfont\shortcontsl\slshape{12}{1000}{OT1}
-\setfont\shortconttt\ttshape{12}{1000}{OT1TT}
+% Font commands.
 
-%% Add scribe-like font environments, plus @l for inline lisp (usually sans
-%% serif) and @ii for TeX italic
+% #1 is the font command (\sl or \it), #2 is the text to slant.
+% If we are in a monospaced environment, however, 1) always use \ttsl,
+% and 2) do not add an italic correction.
+\def\dosmartslant#1#2{%
+  \ifusingtt 
+    {{\ttsl #2}\let\next=\relax}%
+    {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
+  \next
+}
+\def\smartslanted{\dosmartslant\sl}
+\def\smartitalic{\dosmartslant\it}
 
-% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
-% unless the following character is such as not to need one.
-\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else
-                    \ptexslash\fi\fi\fi}
-\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx}
-\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx}
+% Output an italic correction unless \next (presumed to be the following
+% character) is such as not to need one.
+\def\smartitaliccorrection{%
+  \ifx\next,%
+  \else\ifx\next-%
+  \else\ifx\next.%
+  \else\ptexslash
+  \fi\fi\fi
+  \aftersmartic
+}
 
-% like \smartslanted except unconditionally uses \ttsl.
-% @var is set to this for defun arguments.
-\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx}
+% Unconditional use \ttsl, and no ic.  @var is set to this for defuns.
+\def\ttslanted#1{{\ttsl #1}}
 
-% like \smartslanted except unconditionally use \sl.  We never want
+% @cite is like \smartslanted except unconditionally use \sl.  We never want
 % ttsl for book titles, do we?
-\def\cite#1{{\sl #1}\futurelet\next\smartitalicx}
+\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
+
+\def\aftersmartic{}
+\def\var#1{%
+  \let\saveaftersmartic = \aftersmartic
+  \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
+  \smartslanted{#1}%
+}
 
 \let\i=\smartitalic
 \let\slanted=\smartslanted
-\let\var=\smartslanted
 \let\dfn=\smartslanted
 \let\emph=\smartitalic
 
-% @b, explicit bold.
+% Explicit font changes: @r, @sc, undocumented @ii.
+\def\r#1{{\rm #1}}              % roman font
+\def\sc#1{{\smallcaps#1}}       % smallcaps font
+\def\ii#1{{\it #1}}             % italic font
+
+% @b, explicit bold.  Also @strong.
 \def\b#1{{\bf #1}}
 \let\strong=\b
 
@@ -2432,30 +2438,21 @@ end
 \catcode`@=\other
 \def\endofsentencespacefactor{3000}% default
 
+% @t, explicit typewriter.
 \def\t#1{%
   {\tt \rawbackslash \plainfrenchspacing #1}%
   \null
 }
-\def\samp#1{`\tclose{#1}'\null}
-\setfont\keyrm\rmshape{8}{1000}{OT1}
-\font\keysy=cmsy9
-\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
-  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
-    \vbox{\hrule\kern-0.4pt
-     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
-    \kern-0.4pt\hrule}%
-  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
-\def\key #1{{\nohyphenation \uppercase{#1}}\null}
-% The old definition, with no lozenge:
-%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
-\def\ctrl #1{{\tt \rawbackslash \hat}#1}
 
-% @file, @option are the same as @samp.
-\let\file=\samp
-\let\option=\samp
+% @samp.
+\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
+
+% @indicateurl is \samp, that is, with quotes.
+\let\indicateurl=\samp
 
-% @code is a modification of @t,
-% which makes spaces the same size as normal in the surrounding text.
+% @code (and similar) prints in typewriter, but with spaces the same
+% size as normal in the surrounding text, without hyphenation, etc.
+% This is a subroutine for that.
 \def\tclose#1{%
   {%
     % Change normal interword space to be same as for the current font.
@@ -2474,13 +2471,13 @@ end
     \plainfrenchspacing
     #1%
   }%
-  \null
+  \null % reset spacefactor to 1000
 }
 
 % We *must* turn on hyphenation at `-' and `_' in @code.
 % Otherwise, it is too hard to avoid overfull hboxes
 % in the Emacs manual, the Library manual, etc.
-
+%
 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
 % both hyphenation at - and hyphenation within words.
 % We must therefore turn them both off (\tclose does that)
@@ -2489,24 +2486,26 @@ end
 {
   \catcode`\-=\active \catcode`\_=\active
   \catcode`\'=\active \catcode`\`=\active
+  \global\let'=\rq \global\let`=\lq  % default definitions
   %
   \global\def\code{\begingroup
-    \catcode\rquoteChar=\active \catcode\lquoteChar=\active
-    \let'\codequoteright \let`\codequoteleft
-    %
+    \setupmarkupstyle{code}%
+    % The following should really be moved into \setupmarkupstyle handlers.
     \catcode\dashChar=\active  \catcode\underChar=\active
     \ifallowcodebreaks
      \let-\codedash
      \let_\codeunder
     \else
-     \let-\realdash
+     \let-\normaldash
      \let_\realunder
     \fi
     \codex
   }
 }
 
-\def\realdash{-}
+\def\codex #1{\tclose{#1}\endgroup}
+
+\def\normaldash{-}
 \def\codedash{-\discretionary{}{}{}}
 \def\codeunder{%
   % this is all so @math{@code{var_name}+1} can work.  In math mode, _
@@ -2519,13 +2518,12 @@ end
              \discretionary{}{}{}}%
             {\_}%
 }
-\def\codex #1{\tclose{#1}\endgroup}
 
 % An additional complication: the above will allow breaks after, e.g.,
-% each of the four underscores in __typeof__.  This is undesirable in
-% some manuals, especially if they don't have long identifiers in
-% general.  @allowcodebreaks provides a way to control this.
-% 
+% each of the four underscores in __typeof__.  This is bad.
+% @allowcodebreaks provides a document-level way to turn breaking at -
+% and _ on and off.
+%
 \newif\ifallowcodebreaks  \allowcodebreakstrue
 
 \def\keywordtrue{true}
@@ -2539,62 +2537,25 @@ end
     \allowcodebreaksfalse
   \else
     \errhelp = \EMsimple
-    \errmessage{Unknown @allowcodebreaks option `\txiarg'}%
+    \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
   \fi\fi
 }
 
-% @kbd is like @code, except that if the argument is just one @key command,
-% then @kbd has no effect.
-
-% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
-%   `example' (@kbd uses ttsl only inside of @example and friends),
-%   or `code' (@kbd uses normal tty font always).
-\parseargdef\kbdinputstyle{%
-  \def\txiarg{#1}%
-  \ifx\txiarg\worddistinct
-    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
-  \else\ifx\txiarg\wordexample
-    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
-  \else\ifx\txiarg\wordcode
-    \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
-  \else
-    \errhelp = \EMsimple
-    \errmessage{Unknown @kbdinputstyle option `\txiarg'}%
-  \fi\fi\fi
-}
-\def\worddistinct{distinct}
-\def\wordexample{example}
-\def\wordcode{code}
-
-% Default is `distinct.'
-\kbdinputstyle distinct
-
-\def\xkey{\key}
-\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
-\ifx\one\xkey\ifx\threex\three \key{#2}%
-\else{\tclose{\kbdfont\look}}\fi
-\else{\tclose{\kbdfont\look}}\fi}
-
-% For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
-\let\indicateurl=\code
-\let\env=\code
+% For @command, @env, @file, @option quotes seem unnecessary,
+% so use \code rather than \samp.
 \let\command=\code
-
-% @clicksequence{File @click{} Open ...}
-\def\clicksequence#1{\begingroup #1\endgroup}
-
-% @clickstyle @arrow   (by default)
-\parseargdef\clickstyle{\def\click{#1}}
-\def\click{\arrow}
+\let\env=\code
+\let\file=\code
+\let\option=\code
 
 % @uref (abbreviation for `urlref') takes an optional (comma-separated)
 % second argument specifying the text to display and an optional third
 % arg as text to display instead of (rather than in addition to) the url
-% itself.  First (mandatory) arg is the url.  Perhaps eventually put in
-% a hypertex \special here.
-%
-\def\uref#1{\douref #1,,,\finish}
-\def\douref#1,#2,#3,#4\finish{\begingroup
+% itself.  First (mandatory) arg is the url.
+% (This \urefnobreak definition isn't used now, leaving it for a while
+% for comparison.)
+\def\urefnobreak#1{\dourefnobreak #1,,,\finish}
+\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup
   \unsepspaces
   \pdfurl{#1}%
   \setbox0 = \hbox{\ignorespaces #3}%
@@ -2615,6 +2576,103 @@ end
   \endlink
 \endgroup}
 
+% This \urefbreak definition is the active one.
+\def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
+\let\uref=\urefbreak
+\def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
+\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
+  \unsepspaces
+  \pdfurl{#1}%
+  \setbox0 = \hbox{\ignorespaces #3}%
+  \ifdim\wd0 > 0pt
+    \unhbox0 % third arg given, show only that
+  \else
+    \setbox0 = \hbox{\ignorespaces #2}%
+    \ifdim\wd0 > 0pt
+      \ifpdf
+        \unhbox0             % PDF: 2nd arg given, show only it
+      \else
+        \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url
+      \fi
+    \else
+      \urefcode{#1}% only url given, so show it
+    \fi
+  \fi
+  \endlink
+\endgroup}
+
+% Allow line breaks around only a few characters (only).
+\def\urefcatcodes{%
+  \catcode\ampChar=\active   \catcode\dotChar=\active
+  \catcode\hashChar=\active  \catcode\questChar=\active
+  \catcode\slashChar=\active
+}
+{
+  \urefcatcodes
+  %
+  \global\def\urefcode{\begingroup
+    \setupmarkupstyle{code}%
+    \urefcatcodes
+    \let&\urefcodeamp
+    \let.\urefcodedot
+    \let#\urefcodehash
+    \let?\urefcodequest
+    \let/\urefcodeslash
+    \codex
+  }
+  %
+  % By default, they are just regular characters.
+  \global\def&{\normalamp}
+  \global\def.{\normaldot}
+  \global\def#{\normalhash}
+  \global\def?{\normalquest}
+  \global\def/{\normalslash}
+}
+
+% we put a little stretch before and after the breakable chars, to help
+% line breaking of long url's.  The unequal skips make look better in
+% cmtt at least, especially for dots.
+\def\urefprestretch{\urefprebreak \hskip0pt plus.13em }
+\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em }
+%
+\def\urefcodeamp{\urefprestretch \&\urefpoststretch}
+\def\urefcodedot{\urefprestretch .\urefpoststretch}
+\def\urefcodehash{\urefprestretch \#\urefpoststretch}
+\def\urefcodequest{\urefprestretch ?\urefpoststretch}
+\def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
+{
+  \catcode`\/=\active
+  \global\def\urefcodeslashfinish{%
+    \urefprestretch \slashChar
+    % Allow line break only after the final / in a sequence of
+    % slashes, to avoid line break between the slashes in http://.
+    \ifx\next/\else \urefpoststretch \fi
+  }
+}
+
+% One more complication: by default we'll break after the special
+% characters, but some people like to break before the special chars, so
+% allow that.  Also allow no breaking at all, for manual control.
+% 
+\parseargdef\urefbreakstyle{%
+  \def\txiarg{#1}%
+  \ifx\txiarg\wordnone
+    \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
+  \else\ifx\txiarg\wordbefore
+    \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
+  \else\ifx\txiarg\wordafter
+    \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
+  \else
+    \errhelp = \EMsimple
+    \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
+  \fi\fi\fi
+}
+\def\wordafter{after}
+\def\wordbefore{before}
+\def\wordnone{none}
+
+\urefbreakstyle after
+
 % @url synonym for @uref, since that's how everyone uses it.
 %
 \let\url=\uref
@@ -2636,34 +2694,81 @@ end
   \let\email=\uref
 \fi
 
-% Check if we are currently using a typewriter font.  Since all the
-% Computer Modern typewriter fonts have zero interword stretch (and
-% shrink), and it is reasonable to expect all typewriter fonts to have
-% this property, we can check that font parameter.
-%
-\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
+% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
+%   `example' (@kbd uses ttsl only inside of @example and friends),
+%   or `code' (@kbd uses normal tty font always).
+\parseargdef\kbdinputstyle{%
+  \def\txiarg{#1}%
+  \ifx\txiarg\worddistinct
+    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
+  \else\ifx\txiarg\wordexample
+    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
+  \else\ifx\txiarg\wordcode
+    \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
+  \else
+    \errhelp = \EMsimple
+    \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
+  \fi\fi\fi
+}
+\def\worddistinct{distinct}
+\def\wordexample{example}
+\def\wordcode{code}
+
+% Default is `distinct'.
+\kbdinputstyle distinct
+
+% @kbd is like @code, except that if the argument is just one @key command,
+% then @kbd has no effect.
+\def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
+
+\def\xkey{\key}
+\def\kbdsub#1#2#3\par{%
+  \def\one{#1}\def\three{#3}\def\threex{??}%
+  \ifx\one\xkey\ifx\threex\three \key{#2}%
+  \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
+  \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
+}
+
+% definition of @key that produces a lozenge.  Doesn't adjust to text size.
+%\setfont\keyrm\rmshape{8}{1000}{OT1}
+%\font\keysy=cmsy9
+%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
+%  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
+%    \vbox{\hrule\kern-0.4pt
+%     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
+%    \kern-0.4pt\hrule}%
+%  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
+
+% definition of @key with no lozenge.  If the current font is already
+% monospace, don't change it; that way, we respect @kbdinputstyle.  But
+% if it isn't monospace, then use \tt.
+%
+\def\key#1{{\setupmarkupstyle{key}%
+  \nohyphenation
+  \ifmonospace\else\tt\fi
+  #1}\null}
+
+% @clicksequence{File @click{} Open ...}
+\def\clicksequence#1{\begingroup #1\endgroup}
+
+% @clickstyle @arrow   (by default)
+\parseargdef\clickstyle{\def\click{#1}}
+\def\click{\arrow}
 
 % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
 %
 \def\dmn#1{\thinspace #1}
 
-\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
-
 % @l was never documented to mean ``switch to the Lisp font'',
 % and it is not used as such in any manual I can find.  We need it for
 % Polish suppressed-l.  --karl, 22sep96.
 %\def\l#1{{\li #1}\null}
 
-% Explicit font changes: @r, @sc, undocumented @ii.
-\def\r#1{{\rm #1}}              % roman font
-\def\sc#1{{\smallcaps#1}}       % smallcaps font
-\def\ii#1{{\it #1}}             % italic font
-
 % @acronym for "FBI", "NATO", and the like.
 % We print this one point size smaller, since it's intended for
 % all-uppercase.
-% 
+%
 \def\acronym#1{\doacronym #1,,\finish}
 \def\doacronym#1,#2,#3\finish{%
   {\selectfonts\lsize #1}%
@@ -2671,20 +2776,271 @@ end
   \ifx\temp\empty \else
     \space ({\unsepspaces \ignorespaces \temp \unskip})%
   \fi
+  \null % reset \spacefactor=1000
+}
+
+% @abbr for "Comput. J." and the like.
+% No font change, but don't do end-of-sentence spacing.
+%
+\def\abbr#1{\doabbr #1,,\finish}
+\def\doabbr#1,#2,#3\finish{%
+  {\plainfrenchspacing #1}%
+  \def\temp{#2}%
+  \ifx\temp\empty \else
+    \space ({\unsepspaces \ignorespaces \temp \unskip})%
+  \fi
+  \null % reset \spacefactor=1000
+}
+
+% @asis just yields its argument.  Used with @table, for example.
+%
+\def\asis#1{#1}
+
+% @math outputs its argument in math mode.
+%
+% One complication: _ usually means subscripts, but it could also mean
+% an actual _ character, as in @math{@var{some_variable} + 1}.  So make
+% _ active, and distinguish by seeing if the current family is \slfam,
+% which is what @var uses.
+{
+  \catcode`\_ = \active
+  \gdef\mathunderscore{%
+    \catcode`\_=\active
+    \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
+  }
+}
+% Another complication: we want \\ (and @\) to output a math (or tt) \.
+% FYI, plain.tex uses \\ as a temporary control sequence (for no
+% particular reason), but this is not advertised and we don't care.
+%
+% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
+\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
+%
+\def\math{%
+  \tex
+  \mathunderscore
+  \let\\ = \mathbackslash
+  \mathactive
+  % make the texinfo accent commands work in math mode
+  \let\"=\ddot
+  \let\'=\acute
+  \let\==\bar
+  \let\^=\hat
+  \let\`=\grave
+  \let\u=\breve
+  \let\v=\check
+  \let\~=\tilde
+  \let\dotaccent=\dot
+  $\finishmath
+}
+\def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
+
+% Some active characters (such as <) are spaced differently in math.
+% We have to reset their definitions in case the @math was an argument
+% to a command which sets the catcodes (such as @item or @section).
+%
+{
+  \catcode`^ = \active
+  \catcode`< = \active
+  \catcode`> = \active
+  \catcode`+ = \active
+  \catcode`' = \active
+  \gdef\mathactive{%
+    \let^ = \ptexhat
+    \let< = \ptexless
+    \let> = \ptexgtr
+    \let+ = \ptexplus
+    \let' = \ptexquoteright
+  }
+}
+
+% ctrl is no longer a Texinfo command, but leave this definition for fun.
+\def\ctrl #1{{\tt \rawbackslash \hat}#1}
+
+% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
+% Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
+% except specified as a normal braced arg, so no newlines to worry about.
+% 
+\def\outfmtnametex{tex}
+%
+\long\def\inlinefmt#1{\doinlinefmt #1,\finish}
+\long\def\doinlinefmt#1,#2,\finish{%
+  \def\inlinefmtname{#1}%
+  \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
+}
+% For raw, must switch into @tex before parsing the argument, to avoid
+% setting catcodes prematurely.  Doing it this way means that, for
+% example, @inlineraw{html, foo{bar} gets a parse error instead of being
+% ignored.  But this isn't important because if people want a literal
+% *right* brace they would have to use a command anyway, so they may as
+% well use a command to get a left brace too.  We could re-use the
+% delimiter character idea from \verb, but it seems like overkill.
+% 
+\long\def\inlineraw{\tex \doinlineraw}
+\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
+\def\doinlinerawtwo#1,#2,\finish{%
+  \def\inlinerawname{#1}%
+  \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
+  \endgroup % close group opened by \tex.
+}
+
+
+\message{glyphs,}
+% and logos.
+
+% @@ prints an @, as does @atchar{}.
+\def\@{\char64 }
+\let\atchar=\@
+
+% @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
+% Unless we're in typewriter, use \ecfont because the CM text fonts do
+% not have braces, and we don't want to switch into math.
+\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
+\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
+\let\{=\mylbrace \let\lbracechar=\{
+\let\}=\myrbrace \let\rbracechar=\}
+\begingroup
+  % Definitions to produce \{ and \} commands for indices,
+  % and @{ and @} for the aux/toc files.
+  \catcode`\{ = \other \catcode`\} = \other
+  \catcode`\[ = 1 \catcode`\] = 2
+  \catcode`\! = 0 \catcode`\\ = \other
+  !gdef!lbracecmd[\{]%
+  !gdef!rbracecmd[\}]%
+  !gdef!lbraceatcmd[@{]%
+  !gdef!rbraceatcmd[@}]%
+!endgroup
+
+% @comma{} to avoid , parsing problems.
+\let\comma = ,
+
+% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
+% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
+\let\, = \ptexc
+\let\dotaccent = \ptexdot
+\def\ringaccent#1{{\accent23 #1}}
+\let\tieaccent = \ptext
+\let\ubaraccent = \ptexb
+\let\udotaccent = \d
+
+% Other special characters: @questiondown @exclamdown @ordf @ordm
+% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
+\def\questiondown{?`}
+\def\exclamdown{!`}
+\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
+\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
+
+% Dotless i and dotless j, used for accents.
+\def\imacro{i}
+\def\jmacro{j}
+\def\dotless#1{%
+  \def\temp{#1}%
+  \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
+  \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
+  \else \errmessage{@dotless can be used only with i or j}%
+  \fi\fi
+}
+
+% The \TeX{} logo, as in plain, but resetting the spacing so that a
+% period following counts as ending a sentence.  (Idea found in latex.)
+%
+\edef\TeX{\TeX \spacefactor=1000 }
+
+% @LaTeX{} logo.  Not quite the same results as the definition in
+% latex.ltx, since we use a different font for the raised A; it's most
+% convenient for us to use an explicitly smaller font, rather than using
+% the \scriptstyle font (since we don't reset \scriptstyle and
+% \scriptscriptstyle).
+%
+\def\LaTeX{%
+  L\kern-.36em
+  {\setbox0=\hbox{T}%
+   \vbox to \ht0{\hbox{%
+     \ifx\textnominalsize\xwordpt
+       % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
+       % Revert to plain's \scriptsize, which is 7pt.
+       \count255=\the\fam $\fam\count255 \scriptstyle A$%
+     \else
+       % For 11pt, we can use our lllsize.
+       \selectfonts\lllsize A%
+     \fi
+     }%
+     \vss
+  }}%
+  \kern-.15em
+  \TeX
 }
 
-% @abbr for "Comput. J." and the like.
-% No font change, but don't do end-of-sentence spacing.
-% 
-\def\abbr#1{\doabbr #1,,\finish}
-\def\doabbr#1,#2,#3\finish{%
-  {\plainfrenchspacing #1}%
-  \def\temp{#2}%
-  \ifx\temp\empty \else
-    \space ({\unsepspaces \ignorespaces \temp \unskip})%
+% Some math mode symbols.
+\def\bullet{$\ptexbullet$}
+\def\geq{\ifmmode \ge\else $\ge$\fi}
+\def\leq{\ifmmode \le\else $\le$\fi}
+\def\minus{\ifmmode -\else $-$\fi}
+
+% @dots{} outputs an ellipsis using the current font.
+% We do .5em per period so that it has the same spacing in the cm
+% typewriter fonts as three actual period characters; on the other hand,
+% in other typewriter fonts three periods are wider than 1.5em.  So do
+% whichever is larger.
+%
+\def\dots{%
+  \leavevmode
+  \setbox0=\hbox{...}% get width of three periods
+  \ifdim\wd0 > 1.5em
+    \dimen0 = \wd0
+  \else
+    \dimen0 = 1.5em
   \fi
+  \hbox to \dimen0{%
+    \hskip 0pt plus.25fil
+    .\hskip 0pt plus1fil
+    .\hskip 0pt plus1fil
+    .\hskip 0pt plus.5fil
+  }%
+}
+
+% @enddots{} is an end-of-sentence ellipsis.
+%
+\def\enddots{%
+  \dots
+  \spacefactor=\endofsentencespacefactor
 }
 
+% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
+%
+% Since these characters are used in examples, they should be an even number of
+% \tt widths. Each \tt character is 1en, so two makes it 1em.
+%
+\def\point{$\star$}
+\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
+\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
+\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
+\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
+\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
+
+% The @error{} command.
+% Adapted from the TeXbook's \boxit.
+%
+\newbox\errorbox
+%
+{\tentt \global\dimen0 = 3em}% Width of the box.
+\dimen2 = .55pt % Thickness of rules
+% The text. (`r' is open on the right, `e' somewhat less so on the left.)
+\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
+%
+\setbox\errorbox=\hbox to \dimen0{\hfil
+   \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
+   \advance\hsize by -2\dimen2 % Rules.
+   \vbox{%
+      \hrule height\dimen2
+      \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
+         \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
+         \kern3pt\vrule width\dimen2}% Space to right.
+      \hrule height\dimen2}
+    \hfil}
+%
+\def\error{\leavevmode\lower.7ex\copy\errorbox}
+
 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
 %
 \def\pounds{{\it\$}}
@@ -2694,52 +3050,59 @@ end
 % Theiling, which support regular, slanted, bold and bold slanted (and
 % "outlined" (blackboard board, sort of) versions, which we don't need).
 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
-% 
+%
 % Although only regular is the truly official Euro symbol, we ignore
 % that.  The Euro is designed to be slightly taller than the regular
 % font height.
-% 
+%
 % feymr - regular
 % feymo - slanted
 % feybr - bold
 % feybo - bold slanted
-% 
+%
 % There is no good (free) typewriter version, to my knowledge.
 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
 % Hmm.
-% 
+%
 % Also doesn't work in math.  Do we need to do math with euro symbols?
 % Hope not.
-% 
-% 
+%
+%
 \def\euro{{\eurofont e}}
 \def\eurofont{%
   % We set the font at each command, rather than predefining it in
   % \textfonts and the other font-switching commands, so that
   % installations which never need the symbol don't have to have the
   % font installed.
-  % 
+  %
   % There is only one designed size (nominal 10pt), so we always scale
   % that to the current nominal size.
-  % 
+  %
   % By the way, simply using "at 1em" works for cmr10 and the like, but
   % does not work for cmbx10 and other extended/shrunken fonts.
-  % 
+  %
   \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
   %
-  \ifx\curfontstyle\bfstylename 
+  \ifx\curfontstyle\bfstylename
     % bold:
     \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
-  \else 
+  \else
     % regular:
     \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
   \fi
   \thiseurofont
 }
 
-% Hacks for glyphs from the EC fonts similar to \euro.  We don't
-% use \let for the aliases, because sometimes we redefine the original
-% macro, and the alias should reflect the redefinition.
+% Glyphs from the EC fonts.  We don't use \let for the aliases, because
+% sometimes we redefine the original macro, and the alias should reflect
+% the redefinition.
+%
+% Use LaTeX names for the Icelandic letters.
+\def\DH{{\ecfont \char"D0}} % Eth
+\def\dh{{\ecfont \char"F0}} % eth
+\def\TH{{\ecfont \char"DE}} % Thorn
+\def\th{{\ecfont \char"FE}} % thorn
+%
 \def\guillemetleft{{\ecfont \char"13}}
 \def\guillemotleft{\guillemetleft}
 \def\guillemetright{{\ecfont \char"14}}
@@ -2749,19 +3112,52 @@ end
 \def\quotedblbase{{\ecfont \char"12}}
 \def\quotesinglbase{{\ecfont \char"0D}}
 %
+% This positioning is not perfect (see the ogonek LaTeX package), but
+% we have the precomposed glyphs for the most common cases.  We put the
+% tests to use those glyphs in the single \ogonek macro so we have fewer
+% dummy definitions to worry about for index entries, etc.
+%
+% ogonek is also used with other letters in Lithuanian (IOU), but using
+% the precomposed glyphs for those is not so easy since they aren't in
+% the same EC font.
+\def\ogonek#1{{%
+  \def\temp{#1}%
+  \ifx\temp\macrocharA\Aogonek
+  \else\ifx\temp\macrochara\aogonek
+  \else\ifx\temp\macrocharE\Eogonek
+  \else\ifx\temp\macrochare\eogonek
+  \else
+    \ecfont \setbox0=\hbox{#1}%
+    \ifdim\ht0=1ex\accent"0C #1%
+    \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
+    \fi
+  \fi\fi\fi\fi
+  }%
+}
+\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
+\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
+\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
+\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
+%
+% Use the ec* fonts (cm-super in outline format) for non-CM glyphs.
 \def\ecfont{%
-  % We can't distinguish serif/sanserif and italic/slanted, but this
+  % We can't distinguish serif/sans and italic/slanted, but this
   % is used for crude hacks anyway (like adding French and German
   % quotes to documents typeset with CM, where we lose kerning), so
   % hopefully nobody will notice/care.
   \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
   \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
-  \ifx\curfontstyle\bfstylename
-    % bold:
-    \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
+  \ifmonospace
+    % typewriter:
+    \font\thisecfont = ectt\ecsize \space at \nominalsize
   \else
-    % regular:
-    \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
+    \ifx\curfontstyle\bfstylename
+      % bold:
+      \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
+    \else
+      % regular:
+      \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
+    \fi
   \fi
   \thisecfont
 }
@@ -2783,8 +3179,8 @@ end
 % Laurent Siebenmann reports \Orb undefined with:
 %  Textures 1.7.7 (preloaded format=plain 93.10.14)  (68K)  16 APR 2004 02:38
 % so we'll define it if necessary.
-% 
-\ifx\Orb\undefined
+%
+\ifx\Orb\thisisundefined
 \def\Orb{\mathhexbox20D}
 \fi
 
@@ -2812,8 +3208,9 @@ end
 \newif\ifsetshortcontentsaftertitlepage
  \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
 
-\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
-        \endgroup\page\hbox{}\page}
+\parseargdef\shorttitlepage{%
+  \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
+  \endgroup\page\hbox{}\page}
 
 \envdef\titlepage{%
   % Open one extra group, as we want to close it in the middle of \Etitlepage.
@@ -2873,17 +3270,28 @@ end
   \finishedtitlepagetrue
 }
 
-%%% Macros to be used within @titlepage:
+% Settings used for typesetting titles: no hyphenation, no indentation,
+% don't worry much about spacing, ragged right.  This should be used
+% inside a \vbox, and fonts need to be set appropriately first.  Because
+% it is always used for titles, nothing else, we call \rmisbold.  \par
+% should be specified before the end of the \vbox, since a vbox is a group.
+% 
+\def\raggedtitlesettings{%
+  \rmisbold
+  \hyphenpenalty=10000
+  \parindent=0pt
+  \tolerance=5000
+  \ptexraggedright
+}
+
+% Macros to be used within @titlepage:
 
 \let\subtitlerm=\tenrm
 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
 
-\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines
-               \let\tt=\authortt}
-
 \parseargdef\title{%
   \checkenv\titlepage
-  \leftline{\titlefonts\rm #1}
+  \vbox{\titlefonts \raggedtitlesettings #1\par}%
   % print a rule at the page bottom also.
   \finishedtitlepagefalse
   \vskip4pt \hrule height 4pt width \hsize \vskip4pt
@@ -2904,12 +3312,12 @@ end
   \else
     \checkenv\titlepage
     \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
-    {\authorfont \leftline{#1}}%
+    {\secfonts\rmisbold \leftline{#1}}%
   \fi
 }
 
 
-%%% Set up page headings and footings.
+% Set up page headings and footings.
 
 \let\thispage=\folio
 
@@ -3003,10 +3411,14 @@ end
 
 \def\headings #1 {\csname HEADINGS#1\endcsname}
 
-\def\HEADINGSoff{%
-\global\evenheadline={\hfil} \global\evenfootline={\hfil}
-\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
-\HEADINGSoff
+\def\headingsoff{% non-global headings elimination
+  \evenheadline={\hfil}\evenfootline={\hfil}%
+   \oddheadline={\hfil}\oddfootline={\hfil}%
+}
+
+\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
+\HEADINGSoff  % it's the default
+
 % When we turn headings on, set the page number to 1.
 % For double-sided printing, put current file name in lower left corner,
 % chapter name on inside top of right hand pages, document
@@ -3057,7 +3469,7 @@ end
 % This produces Day Month Year style of output.
 % Only define if not already defined, in case a txi-??.tex file has set
 % up a different format (e.g., txi-cs.tex does this).
-\ifx\today\undefined
+\ifx\today\thisisundefined
 \def\today{%
   \number\day\space
   \ifcase\month
@@ -3118,7 +3530,7 @@ end
     \begingroup
       \advance\leftskip by-\tableindent
       \advance\hsize by\tableindent
-      \advance\rightskip by0pt plus1fil
+      \advance\rightskip by0pt plus1fil\relax
       \leavevmode\unhbox0\par
     \endgroup
     %
@@ -3132,7 +3544,7 @@ end
     % cause the example and the item to crash together.  So we use this
     % bizarre value of 10001 as a signal to \aboveenvbreak to insert
     % \parskip glue after all.  Section titles are handled this way also.
-    % 
+    %
     \penalty 10001
     \endgroup
     \itemxneedsnegativevskipfalse
@@ -3226,9 +3638,18 @@ end
   \parindent=0pt
   \parskip=\smallskipamount
   \ifdim\parskip=0pt \parskip=2pt \fi
+  %
+  % Try typesetting the item mark that if the document erroneously says
+  % something like @itemize @samp (intending @table), there's an error
+  % right away at the @itemize.  It's not the best error message in the
+  % world, but it's better than leaving it to the @item.  This means if
+  % the user wants an empty mark, they have to say @w{} not just @w.
   \def\itemcontents{#1}%
+  \setbox0 = \hbox{\itemcontents}%
+  %
   % @itemize with no arg is equivalent to @itemize @bullet.
   \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
+  %
   \let\item=\itemizeitem
 }
 
@@ -3249,6 +3670,7 @@ end
    \ifnum\lastpenalty<10000 \parskip=0in \fi
    \noindent
    \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
+   %
    \vadjust{\penalty 1200}}% not good to break after first line of item.
   \flushcr
 }
@@ -3470,12 +3892,19 @@ end
 %
 % @headitem starts a heading row, which we typeset in bold.
 % Assignments have to be global since we are inside the implicit group
-% of an alignment entry.  Note that \everycr resets \everytab.
-\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}%
+% of an alignment entry.  \everycr resets \everytab so we don't have to
+% undo it ourselves.
+\def\headitemfont{\b}% for people to use in the template row; not changeable
+\def\headitem{%
+  \checkenv\multitable
+  \crcr
+  \global\everytab={\bf}% can't use \headitemfont since the parsing differs
+  \the\everytab % for the first item
+}%
 %
 % A \tab used to include \hskip1sp.  But then the space in a template
 % line is not enough.  That is bad.  So let's go back to just `&' until
-% we encounter the problem it was intended to solve again.
+% we again encounter the problem the 1sp was intended to solve.
 %                                      --karl, nathan@acm.org, 20apr99.
 \def\tab{\checkenv\multitable &\the\everytab}%
 
@@ -3587,18 +4016,18 @@ end
 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
 \global\advance\multitablelinespace by-\ht0
 \fi
-%% Test to see if parskip is larger than space between lines of
-%% table. If not, do nothing.
-%%        If so, set to same dimension as multitablelinespace.
+% Test to see if parskip is larger than space between lines of
+% table. If not, do nothing.
+%        If so, set to same dimension as multitablelinespace.
 \ifdim\multitableparskip>\multitablelinespace
 \global\multitableparskip=\multitablelinespace
-\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
-                                      %% than skip between lines in the table.
+\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
+                                      % than skip between lines in the table.
 \fi%
 \ifdim\multitableparskip=0pt
 \global\multitableparskip=\multitablelinespace
-\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
-                                      %% than skip between lines in the table.
+\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
+                                      % than skip between lines in the table.
 \fi}
 
 
@@ -3759,7 +4188,7 @@ end
     % ..., but we might end up with active ones in the argument if
     % we're called from @code, as @code{@value{foo-bar_}}, though.
     % So \let them to their normal equivalents.
-    \let-\realdash \let_\normalunderscore
+    \let-\normaldash \let_\normalunderscore
   }
 }
 
@@ -3799,7 +4228,7 @@ end
 }
 \def\ifsetfail{\doignore{ifset}}
 
-% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
+% @ifclear VAR ... @end executes the `...' iff VAR has never been
 % defined with @set, or has been undefined with @clear.
 %
 % The `\else' inside the `\doifset' parameter is a trick to reuse the
@@ -3810,6 +4239,35 @@ end
 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
 \def\ifclearfail{\doignore{ifclear}}
 
+% @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
+% without the @) is in fact defined.  We can only feasibly check at the
+% TeX level, so something like `mathcode' is going to considered
+% defined even though it is not a Texinfo command.
+% 
+\makecond{ifcommanddefined}
+\def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
+%
+\def\doifcmddefined#1#2{{%
+    \makevalueexpandable
+    \let\next=\empty
+    \expandafter\ifx\csname #2\endcsname\relax
+      #1% If not defined, \let\next as above.
+    \fi
+    \expandafter
+  }\next
+}
+\def\ifcmddefinedfail{\doignore{ifcommanddefined}}
+
+% @ifcommandnotdefined CMD ... handled similar to @ifclear above.
+\makecond{ifcommandnotdefined}
+\def\ifcommandnotdefined{%
+  \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
+\def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
+
+% Set the `txicommandconditionals' variable, so documents have a way to
+% test if the @ifcommand...defined conditionals are available.
+\set txicommandconditionals
+
 % @dircategory CATEGORY  -- specify a category of the dir file
 % which this file should belong to.  Ignore this in TeX.
 \let\dircategory=\comment
@@ -3874,11 +4332,11 @@ end
 \def\dosynindex#1#2#3{%
   % Only do \closeout if we haven't already done it, else we'll end up
   % closing the target index.
-  \expandafter \ifx\csname donesynindex#2\endcsname \undefined
+  \expandafter \ifx\csname donesynindex#2\endcsname \relax
     % The \closeout helps reduce unnecessary open files; the limit on the
     % Acorn RISC OS is a mere 16 files.
     \expandafter\closeout\csname#2indfile\endcsname
-    \expandafter\let\csname\donesynindex#2\endcsname = 1
+    \expandafter\let\csname donesynindex#2\endcsname = 1
   \fi
   % redefine \fooindfile:
   \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
@@ -3913,11 +4371,14 @@ end
   \def\@{@}% change to @@ when we switch to @ as escape char in index files.
   \def\ {\realbackslash\space }%
   %
-  % Need these in case \tex is in effect and \{ is a \delimiter again.
-  % But can't use \lbracecmd and \rbracecmd because texindex assumes
-  % braces and backslashes are used only as delimiters.
-  \let\{ = \mylbrace
-  \let\} = \myrbrace
+  % Need these unexpandable (because we define \tt as a dummy)
+  % definitions when @{ or @} appear in index entry text.  Also, more
+  % complicated, when \tex is in effect and \{ is a \delimiter again.
+  % We can't use \lbracecmd and \rbracecmd because texindex assumes
+  % braces and backslashes are used only as delimiters.  Perhaps we
+  % should define @lbrace and @rbrace commands a la @comma.
+  \def\{{{\tt\char123}}%
+  \def\}{{\tt\char125}}%
   %
   % I don't entirely understand this, but when an index entry is
   % generated from a macro call, the \endinput which \scanmacro inserts
@@ -3928,7 +4389,7 @@ end
   % processing continues to some further point.  On the other hand, it
   % seems \endinput does not hurt in the printed index arg, since that
   % is still getting written without apparent harm.
-  % 
+  %
   % Sample source (mac-idx3.tex, reported by Graham Percival to
   % help-texinfo, 22may06):
   % @macro funindex {WORD}
@@ -3936,12 +4397,12 @@ end
   % @end macro
   % ...
   % @funindex commtest
-  % 
+  %
   % The above is not enough to reproduce the bug, but it gives the flavor.
-  % 
+  %
   % Sample whatsit resulting:
   % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}}
-  % 
+  %
   % So:
   \let\endinput = \empty
   %
@@ -3970,7 +4431,7 @@ end
 \def\commondummies{%
   %
   % \definedummyword defines \#1 as \string\#1\space, thus effectively
-  % preventing its expansion.  This is used only for control% words,
+  % preventing its expansion.  This is used only for control words,
   % not control letters, because the \space would be incorrect for
   % control characters, but is needed to separate the control word
   % from whatever follows.
@@ -3989,23 +4450,28 @@ end
   \commondummiesnofonts
   %
   \definedummyletter\_%
+  \definedummyletter\-%
   %
   % Non-English letters.
   \definedummyword\AA
   \definedummyword\AE
+  \definedummyword\DH
   \definedummyword\L
-  \definedummyword\OE
   \definedummyword\O
+  \definedummyword\OE
+  \definedummyword\TH
   \definedummyword\aa
   \definedummyword\ae
+  \definedummyword\dh
+  \definedummyword\exclamdown
   \definedummyword\l
-  \definedummyword\oe
   \definedummyword\o
-  \definedummyword\ss
-  \definedummyword\exclamdown
-  \definedummyword\questiondown
+  \definedummyword\oe
   \definedummyword\ordf
   \definedummyword\ordm
+  \definedummyword\questiondown
+  \definedummyword\ss
+  \definedummyword\th
   %
   % Although these internal commands shouldn't show up, sometimes they do.
   \definedummyword\bf
@@ -4021,21 +4487,27 @@ end
   \definedummyword\TeX
   %
   % Assorted special characters.
+  \definedummyword\arrow
   \definedummyword\bullet
   \definedummyword\comma
   \definedummyword\copyright
   \definedummyword\registeredsymbol
   \definedummyword\dots
   \definedummyword\enddots
+  \definedummyword\entrybreak
   \definedummyword\equiv
   \definedummyword\error
   \definedummyword\euro
+  \definedummyword\expansion
+  \definedummyword\geq
   \definedummyword\guillemetleft
   \definedummyword\guillemetright
   \definedummyword\guilsinglleft
   \definedummyword\guilsinglright
-  \definedummyword\expansion
+  \definedummyword\lbracechar
+  \definedummyword\leq
   \definedummyword\minus
+  \definedummyword\ogonek
   \definedummyword\pounds
   \definedummyword\point
   \definedummyword\print
@@ -4045,6 +4517,7 @@ end
   \definedummyword\quoteleft
   \definedummyword\quoteright
   \definedummyword\quotesinglbase
+  \definedummyword\rbracechar
   \definedummyword\result
   \definedummyword\textdegree
   %
@@ -4079,6 +4552,7 @@ end
   \definedummyword\v
   \definedummyword\H
   \definedummyword\dotaccent
+  \definedummyword\ogonek
   \definedummyword\ringaccent
   \definedummyword\tieaccent
   \definedummyword\ubaraccent
@@ -4089,18 +4563,27 @@ end
   \definedummyword\b
   \definedummyword\i
   \definedummyword\r
+  \definedummyword\sansserif
   \definedummyword\sc
+  \definedummyword\slanted
   \definedummyword\t
   %
   % Commands that take arguments.
+  \definedummyword\abbr
   \definedummyword\acronym
+  \definedummyword\anchor
   \definedummyword\cite
   \definedummyword\code
   \definedummyword\command
   \definedummyword\dfn
+  \definedummyword\dmn
+  \definedummyword\email
   \definedummyword\emph
   \definedummyword\env
   \definedummyword\file
+  \definedummyword\image
+  \definedummyword\indicateurl
+  \definedummyword\inforef
   \definedummyword\kbd
   \definedummyword\key
   \definedummyword\math
@@ -4128,7 +4611,7 @@ end
   \def\definedummyaccent##1{\let##1\asis}%
   % We can just ignore other control letters.
   \def\definedummyletter##1{\let##1\empty}%
-  % Hopefully, all control words can become @asis.
+  % All control words become @asis by default; overrides below.
   \let\definedummyword\definedummyaccent
   %
   \commondummiesnofonts
@@ -4140,48 +4623,63 @@ end
   %
   \def\ { }%
   \def\@{@}%
-  % how to handle braces?
   \def\_{\normalunderscore}%
+  \def\-{}% @- shouldn't affect sorting
+  %
+  % Unfortunately, texindex is not prepared to handle braces in the
+  % content at all.  So for index sorting, we map @{ and @} to strings
+  % starting with |, since that ASCII character is between ASCII { and }.
+  \def\{{|a}%
+  \def\lbracechar{|a}%
+  %
+  \def\}{|b}%
+  \def\rbracechar{|b}%
   %
   % Non-English letters.
   \def\AA{AA}%
   \def\AE{AE}%
+  \def\DH{DZZ}%
   \def\L{L}%
   \def\OE{OE}%
   \def\O{O}%
+  \def\TH{ZZZ}%
   \def\aa{aa}%
   \def\ae{ae}%
+  \def\dh{dzz}%
+  \def\exclamdown{!}%
   \def\l{l}%
   \def\oe{oe}%
-  \def\o{o}%
-  \def\ss{ss}%
-  \def\exclamdown{!}%
-  \def\questiondown{?}%
   \def\ordf{a}%
   \def\ordm{o}%
+  \def\o{o}%
+  \def\questiondown{?}%
+  \def\ss{ss}%
+  \def\th{zzz}%
   %
   \def\LaTeX{LaTeX}%
   \def\TeX{TeX}%
   %
   % Assorted special characters.
   % (The following {} will end up in the sort string, but that's ok.)
+  \def\arrow{->}%
   \def\bullet{bullet}%
   \def\comma{,}%
   \def\copyright{copyright}%
-  \def\registeredsymbol{R}%
   \def\dots{...}%
   \def\enddots{...}%
   \def\equiv{==}%
   \def\error{error}%
   \def\euro{euro}%
+  \def\expansion{==>}%
+  \def\geq{>=}%
   \def\guillemetleft{<<}%
   \def\guillemetright{>>}%
   \def\guilsinglleft{<}%
   \def\guilsinglright{>}%
-  \def\expansion{==>}%
+  \def\leq{<=}%
   \def\minus{-}%
-  \def\pounds{pounds}%
   \def\point{.}%
+  \def\pounds{pounds}%
   \def\print{-|}%
   \def\quotedblbase{"}%
   \def\quotedblleft{"}%
@@ -4189,22 +4687,31 @@ end
   \def\quoteleft{`}%
   \def\quoteright{'}%
   \def\quotesinglbase{,}%
+  \def\registeredsymbol{R}%
   \def\result{=>}%
-  \def\textdegree{degrees}%
+  \def\textdegree{o}%
+  %
+  \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax
+  \else \indexlquoteignore \fi
   %
   % We need to get rid of all macros, leaving only the arguments (if present).
   % Of course this is not nearly correct, but it is the best we can do for now.
   % makeinfo does not expand macros in the argument to @deffn, which ends up
   % writing an index entry, and texindex isn't prepared for an index sort entry
   % that starts with \.
-  % 
+  %
   % Since macro invocations are followed by braces, we can just redefine them
   % to take a single TeX argument.  The case of a macro invocation that
   % goes to end-of-line is not handled.
-  % 
+  %
   \macrolist
 }
 
+% Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us
+% ignore left quotes in the sort term.
+{\catcode`\`=\active
+ \gdef\indexlquoteignore{\let`=\empty}}
+
 \let\indexbackslash=0  %overridden during \printindex.
 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
 
@@ -4302,10 +4809,9 @@ end
 %
 % ..., ready, GO:
 %
-\def\safewhatsit#1{%
-\ifhmode
+\def\safewhatsit#1{\ifhmode
   #1%
-\else
+ \else
   % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
   \whatsitskip = \lastskip
   \edef\lastskipmacro{\the\lastskip}%
@@ -4329,7 +4835,6 @@ end
     % to re-insert the same penalty (values >10000 are used for various
     % signals); since we just inserted a non-discardable item, any
     % following glue (such as a \parskip) would be a breakpoint.  For example:
-    % 
     %   @deffn deffn-whatever
     %   @vindex index-whatever
     %   Description.
@@ -4342,8 +4847,7 @@ end
     % (the whatsit from the \write), so we must insert a \nobreak.
     \nobreak\vskip\whatsitskip
   \fi
-\fi
-}
+\fi}
 
 % The index entry written in the file actually looks like
 %  \entry {sortstring}{page}{topic}
@@ -4462,7 +4966,6 @@ end
 % But this freezes the catcodes in the argument, and can cause problems to
 % @code, which sets - active.  This problem was fixed by a kludge---
 % ``-'' was active throughout whole index, but this isn't really right.
-%
 % The right solution is to prevent \entry from swallowing the whole text.
 %                                 --kasal, 21nov03
 \def\entry{%
@@ -4499,10 +5002,17 @@ end
     % columns.
     \vskip 0pt plus1pt
     %
+    % When reading the text of entry, convert explicit line breaks
+    % from @* into spaces.  The user might give these in long section
+    % titles, for instance.
+    \def\*{\unskip\space\ignorespaces}%
+    \def\entrybreak{\hfil\break}%
+    %
     % Swallow the left brace of the text (first parameter):
     \afterassignment\doentry
     \let\temp =
 }
+\def\entrybreak{\unskip\space\ignorespaces}%
 \def\doentry{%
     \bgroup % Instead of the swallowed brace.
       \noindent
@@ -4735,7 +5245,22 @@ end
 \message{sectioning,}
 % Chapters, sections, etc.
 
-% \unnumberedno is an oxymoron, of course.  But we count the unnumbered
+% Let's start with @part.
+\outer\parseargdef\part{\partzzz{#1}}
+\def\partzzz#1{%
+  \chapoddpage
+  \null
+  \vskip.3\vsize  % move it down on the page a bit
+  \begingroup
+    \noindent \titlefonts\rmisbold #1\par % the text
+    \let\lastnode=\empty      % no node to associate with
+    \writetocentry{part}{#1}{}% but put it in the toc
+    \headingsoff              % no headline or footline on the part page
+    \chapoddpage
+  \endgroup
+}
+
+% \unnumberedno is an oxymoron.  But we count the unnumbered
 % sections so that we can refer to them unambiguously in the pdf
 % outlines by their "section number".  We avoid collisions with chapter
 % numbers by starting them at 10000.  (If a document ever has 10000
@@ -4815,7 +5340,7 @@ end
 %
 % A numbered section within an unnumbered changes to unnumbered too.
 % To achieve this, remember the "biggest" unnum. sec. we are currently in:
-\chardef\unmlevel = \maxseclevel
+\chardef\unnlevel = \maxseclevel
 %
 % Trace whether the current chapter is an appendix or not:
 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
@@ -4840,8 +5365,8 @@ end
   % The heading type:
   \def\headtype{#1}%
   \if \headtype U%
-    \ifnum \absseclevel < \unmlevel
-      \chardef\unmlevel = \absseclevel
+    \ifnum \absseclevel < \unnlevel
+      \chardef\unnlevel = \absseclevel
     \fi
   \else
     % Check for appendix sections:
@@ -4853,10 +5378,10 @@ end
       \fi\fi
     \fi
     % Check for numbered within unnumbered:
-    \ifnum \absseclevel > \unmlevel
+    \ifnum \absseclevel > \unnlevel
       \def\headtype{U}%
     \else
-      \chardef\unmlevel = 3
+      \chardef\unnlevel = 3
     \fi
   \fi
   % Now print the heading:
@@ -4910,7 +5435,9 @@ end
   \gdef\chaplevelprefix{\the\chapno.}%
   \resetallfloatnos
   %
-  \message{\putwordChapter\space \the\chapno}%
+  % \putwordChapter can contain complex things in translations.
+  \toks0=\expandafter{\putwordChapter}%
+  \message{\the\toks0 \space \the\chapno}%
   %
   % Write the actual heading.
   \chapmacro{#1}{Ynumbered}{\the\chapno}%
@@ -4921,15 +5448,17 @@ end
   \global\let\subsubsection = \numberedsubsubsec
 }
 
-\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz
+\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
+%
 \def\appendixzzz#1{%
   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
     \global\advance\appendixno by 1
   \gdef\chaplevelprefix{\appendixletter.}%
   \resetallfloatnos
   %
-  \def\appendixnum{\putwordAppendix\space \appendixletter}%
-  \message{\appendixnum}%
+  % \putwordAppendix can contain complex things in translations.
+  \toks0=\expandafter{\putwordAppendix}%
+  \message{\the\toks0 \space \appendixletter}%
   %
   \chapmacro{#1}{Yappendix}{\appendixletter}%
   %
@@ -4938,7 +5467,8 @@ end
   \global\let\subsubsection = \appendixsubsubsec
 }
 
-\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
+% normally unnmhead0 calls unnumberedzzz:
+\outer\parseargdef\unnumbered{\unnmhead0{#1}}
 \def\unnumberedzzz#1{%
   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
     \global\advance\unnumberedno by 1
@@ -4982,40 +5512,47 @@ end
 \let\top\unnumbered
 
 % Sections.
+% 
 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
 \def\seczzz#1{%
   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
   \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
 }
 
-\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz
+% normally calls appendixsectionzzz:
+\outer\parseargdef\appendixsection{\apphead1{#1}}
 \def\appendixsectionzzz#1{%
   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
   \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
 }
 \let\appendixsec\appendixsection
 
-\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz
+% normally calls unnumberedseczzz:
+\outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
 \def\unnumberedseczzz#1{%
   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
   \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
 }
 
 % Subsections.
-\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz
+% 
+% normally calls numberedsubseczzz:
+\outer\parseargdef\numberedsubsec{\numhead2{#1}}
 \def\numberedsubseczzz#1{%
   \global\subsubsecno=0  \global\advance\subsecno by 1
   \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
 }
 
-\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz
+% normally calls appendixsubseczzz:
+\outer\parseargdef\appendixsubsec{\apphead2{#1}}
 \def\appendixsubseczzz#1{%
   \global\subsubsecno=0  \global\advance\subsecno by 1
   \sectionheading{#1}{subsec}{Yappendix}%
                  {\appendixletter.\the\secno.\the\subsecno}%
 }
 
-\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
+% normally calls unnumberedsubseczzz:
+\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
 \def\unnumberedsubseczzz#1{%
   \global\subsubsecno=0  \global\advance\subsecno by 1
   \sectionheading{#1}{subsec}{Ynothing}%
@@ -5023,21 +5560,25 @@ end
 }
 
 % Subsubsections.
-\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz
+% 
+% normally numberedsubsubseczzz:
+\outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
 \def\numberedsubsubseczzz#1{%
   \global\advance\subsubsecno by 1
   \sectionheading{#1}{subsubsec}{Ynumbered}%
                  {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
 }
 
-\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz
+% normally appendixsubsubseczzz:
+\outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
 \def\appendixsubsubseczzz#1{%
   \global\advance\subsubsecno by 1
   \sectionheading{#1}{subsubsec}{Yappendix}%
                  {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
 }
 
-\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
+% normally unnumberedsubsubseczzz:
+\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
 \def\unnumberedsubsubseczzz#1{%
   \global\advance\subsubsecno by 1
   \sectionheading{#1}{subsubsec}{Ynothing}%
@@ -5053,15 +5594,6 @@ end
 
 % Define @majorheading, @heading and @subheading
 
-% NOTE on use of \vbox for chapter headings, section headings, and such:
-%       1) We use \vbox rather than the earlier \line to permit
-%          overlong headings to fold.
-%       2) \hyphenpenalty is set to 10000 because hyphenation in a
-%          heading is obnoxious; this forbids it.
-%       3) Likewise, headings look best if no \parindent is used, and
-%          if justification is not attempted.  Hence \raggedright.
-
-
 \def\majorheading{%
   {\advance\chapheadingskip by 10pt \chapbreak }%
   \parsearg\chapheadingzzz
@@ -5069,10 +5601,8 @@ end
 
 \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
 \def\chapheadingzzz#1{%
-  {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
-                    \parindent=0pt\raggedright
-                    \rm #1\hfill}}%
-  \bigskip \par\penalty 200\relax
+  \vbox{\chapfonts \raggedtitlesettings #1\par}%
+  \nobreak\bigskip \nobreak
   \suppressfirstparagraphindent
 }
 
@@ -5088,14 +5618,13 @@ end
 % (including whitespace, linebreaking, etc. around it),
 % given all the information in convenient, parsed form.
 
-%%% Args are the skip and penalty (usually negative)
+% Args are the skip and penalty (usually negative)
 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
 
-%%% Define plain chapter starts, and page on/off switching for it
 % Parameter controlling skip before chapter headings (if needed)
-
 \newskip\chapheadingskip
 
+% Define plain chapter starts, and page on/off switching for it.
 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
 \def\chappager{\par\vfill\supereject}
 % Because \domark is called before \chapoddpage, the filler page will
@@ -5105,9 +5634,8 @@ end
   \chappager
   \ifodd\pageno \else
     \begingroup
-      \evenheadline={\hfil}\evenfootline={\hfil}%
-      \oddheadline={\hfil}\oddfootline={\hfil}%
-      \hbox to 0pt{}%
+      \headingsoff
+      \null
       \chappager
     \endgroup
   \fi
@@ -5163,7 +5691,10 @@ end
     \xdef\lastchapterdefs{%
       \gdef\noexpand\thischaptername{\the\toks0}%
       \gdef\noexpand\thischapternum{\appendixletter}%
-      \gdef\noexpand\thischapter{\putwordAppendix{} \noexpand\thischapternum:
+      % \noexpand\putwordAppendix avoids expanding indigestible
+      % commands in some of the translations.
+      \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
+                                 \noexpand\thischapternum:
                                  \noexpand\thischaptername}%
     }%
   \else
@@ -5171,7 +5702,10 @@ end
     \xdef\lastchapterdefs{%
       \gdef\noexpand\thischaptername{\the\toks0}%
       \gdef\noexpand\thischapternum{\the\chapno}%
-      \gdef\noexpand\thischapter{\putwordChapter{} \noexpand\thischapternum:
+      % \noexpand\putwordChapter avoids expanding indigestible
+      % commands in some of the translations.
+      \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
+                                 \noexpand\thischapternum:
                                  \noexpand\thischaptername}%
     }%
   \fi\fi\fi
@@ -5190,7 +5724,7 @@ end
   \domark
   %
   {%
-    \chapfonts \rm
+    \chapfonts \rmisbold
     %
     % Have to define \lastsection before calling \donoderef, because the
     % xref code eventually uses it.  On the other hand, it has to be called
@@ -5227,8 +5761,7 @@ end
     %
     % Typeset the actual heading.
     \nobreak % Avoid page breaks at the interline glue.
-    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
-          \hangindent=\wd0 \centerparametersmaybe
+    \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
           \unhbox0 #1\par}%
   }%
   \nobreak\bigskip % no page break after a chapter title
@@ -5250,18 +5783,18 @@ end
 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
 %
 \def\unnchfopen #1{%
-\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
-                       \parindent=0pt\raggedright
-                       \rm #1\hfill}}\bigskip \par\nobreak
+  \chapoddpage
+  \vbox{\chapfonts \raggedtitlesettings #1\par}%
+  \nobreak\bigskip\nobreak
 }
 \def\chfopen #1#2{\chapoddpage {\chapfonts
 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
 \par\penalty 5000 %
 }
 \def\centerchfopen #1{%
-\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
-                       \parindent=0pt
-                       \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
+  \chapoddpage
+  \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}%
+  \nobreak\bigskip \nobreak
 }
 \def\CHAPFopen{%
   \global\let\chapmacro=\chfopen
@@ -5293,8 +5826,10 @@ end
 %
 \def\sectionheading#1#2#3#4{%
   {%
+    \checkenv{}% should not be in an environment.
+    %
     % Switch to the right set of fonts.
-    \csname #2fonts\endcsname \rm
+    \csname #2fonts\endcsname \rmisbold
     %
     \def\sectionlevel{#2}%
     \def\temptype{#3}%
@@ -5314,7 +5849,10 @@ end
         \xdef\lastsectiondefs{%
           \gdef\noexpand\thissectionname{\the\toks0}%
           \gdef\noexpand\thissectionnum{#4}%
-          \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum:
+          % \noexpand\putwordSection avoids expanding indigestible
+          % commands in some of the translations.
+          \gdef\noexpand\thissection{\noexpand\putwordSection{}
+                                     \noexpand\thissectionnum:
                                      \noexpand\thissectionname}%
         }%
       \fi
@@ -5324,12 +5862,20 @@ end
         \xdef\lastsectiondefs{%
           \gdef\noexpand\thissectionname{\the\toks0}%
           \gdef\noexpand\thissectionnum{#4}%
-          \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum:
+          % \noexpand\putwordSection avoids expanding indigestible
+          % commands in some of the translations.
+          \gdef\noexpand\thissection{\noexpand\putwordSection{}
+                                     \noexpand\thissectionnum:
                                      \noexpand\thissectionname}%
         }%
       \fi
     \fi\fi\fi
     %
+    % Go into vertical mode.  Usually we'll already be there, but we
+    % don't want the following whatsit to end up in a preceding paragraph
+    % if the document didn't happen to have a blank line.
+    \par
+    %
     % Output the mark.  Pass it through \safewhatsit, to take care of
     % the preceding space.
     \safewhatsit\domark
@@ -5379,7 +5925,7 @@ end
     \nobreak
     %
     % Output the actual section heading.
-    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
+    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
           \hangindent=\wd0  % zero if no section number
           \unhbox0 #1}%
   }%
@@ -5393,15 +5939,15 @@ end
   %
   % We'll almost certainly start a paragraph next, so don't let that
   % glue accumulate.  (Not a breakpoint because it's preceded by a
-  % discardable item.)
+  % discardable item.)  However, when a paragraph is not started next
+  % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
+  % or the negative glue will cause weirdly wrong output, typically
+  % obscuring the section heading with something else.
   \vskip-\parskip
-  % 
-  % This is purely so the last item on the list is a known \penalty >
-  % 10000.  This is so \startdefun can avoid allowing breakpoints after
-  % section headings.  Otherwise, it would insert a valid breakpoint between:
-  % 
-  %   @section sec-whatever
-  %   @deffn def-whatever
+  %
+  % This is so the last item on the main vertical list is a known
+  % \penalty > 10000, so \startdefun, etc., can recognize the situation
+  % and do the needful.
   \penalty 10001
 }
 
@@ -5457,7 +6003,7 @@ end
 % These characters do not print properly in the Computer Modern roman
 % fonts, so we must take special care.  This is more or less redundant
 % with the Texinfo input format setup at the end of this file.
-% 
+%
 \def\activecatcodes{%
   \catcode`\"=\active
   \catcode`\$=\active
@@ -5507,7 +6053,7 @@ end
 
 % redefined for the two-volume lispref.  We always output on
 % \jobname.toc even if this is redefined.
-% 
+%
 \def\tocreadfilename{\jobname.toc}
 
 % Normal (long) toc.
@@ -5533,6 +6079,7 @@ end
 \def\summarycontents{%
   \startcontents{\putwordShortTOC}%
     %
+    \let\partentry = \shortpartentry
     \let\numchapentry = \shortchapentry
     \let\appentry = \shortchapentry
     \let\unnchapentry = \shortunnchapentry
@@ -5588,6 +6135,19 @@ end
 % The last argument is the page number.
 % The arguments in between are the chapter number, section number, ...
 
+% Parts, in the main contents.  Replace the part number, which doesn't
+% exist, with an empty box.  Let's hope all the numbers have the same width.
+% Also ignore the page number, which is conventionally not printed.
+\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
+\def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
+%
+% Parts, in the short toc.
+\def\shortpartentry#1#2#3#4{%
+  \penalty-300
+  \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
+  \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
+}
+
 % Chapters, in the main contents.
 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
 %
@@ -5677,46 +6237,12 @@ end
 \message{environments,}
 % @foo ... @end foo.
 
-% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
-%
-% Since these characters are used in examples, they should be an even number of
-% \tt widths. Each \tt character is 1en, so two makes it 1em.
-%
-\def\point{$\star$}
-\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
-\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
-\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
-\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
-\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
-
-% The @error{} command.
-% Adapted from the TeXbook's \boxit.
-%
-\newbox\errorbox
-%
-{\tentt \global\dimen0 = 3em}% Width of the box.
-\dimen2 = .55pt % Thickness of rules
-% The text. (`r' is open on the right, `e' somewhat less so on the left.)
-\setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt}
-%
-\setbox\errorbox=\hbox to \dimen0{\hfil
-   \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
-   \advance\hsize by -2\dimen2 % Rules.
-   \vbox{%
-      \hrule height\dimen2
-      \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
-         \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
-         \kern3pt\vrule width\dimen2}% Space to right.
-      \hrule height\dimen2}
-    \hfil}
-%
-\def\error{\leavevmode\lower.7ex\copy\errorbox}
-
-% @tex ... @end tex    escapes into raw Tex temporarily.
+% @tex ... @end tex    escapes into raw TeX temporarily.
 % One exception: @ is still an escape character, so that @end tex works.
-% But \@ or @@ will get a plain tex @ character.
+% But \@ or @@ will get a plain @ character.
 
 \envdef\tex{%
+  \setupmarkupstyle{tex}%
   \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
   \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
   \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
@@ -5726,8 +6252,14 @@ end
   \catcode `\|=\other
   \catcode `\<=\other
   \catcode `\>=\other
+  \catcode`\`=\other
+  \catcode`\'=\other
   \escapechar=`\\
   %
+  % ' is active in math mode (mathcode"8000).  So reset it, and all our
+  % other math active characters (just in case), to plain's definitions.
+  \mathactive
+  %
   \let\b=\ptexb
   \let\bullet=\ptexbullet
   \let\c=\ptexc
@@ -5831,6 +6363,12 @@ end
   \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
   % Flag to tell @lisp, etc., not to narrow margin.
   \let\nonarrowing = t%
+  %
+  % If this cartouche directly follows a sectioning command, we need the
+  % \parskip glue (backspaced over by default) or the cartouche can
+  % collide with the section heading.
+  \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
+  %
   \vbox\bgroup
       \baselineskip=0pt\parskip=0pt\lineskip=0pt
       \carttop
@@ -5844,7 +6382,7 @@ end
              \lineskip=\normlskip
              \parskip=\normpskip
              \vskip -\parskip
-             \comment % For explanation, see the end of \def\group.
+             \comment % For explanation, see the end of def\group.
 }
 \def\Ecartouche{%
               \ifhmode\par\fi
@@ -5861,6 +6399,7 @@ end
 
 % This macro is called at the beginning of all the @example variants,
 % inside a group.
+\newdimen\nonfillparindent
 \def\nonfillstart{%
   \aboveenvbreak
   \hfuzz = 12pt % Don't be fussy
@@ -5868,7 +6407,12 @@ end
   \let\par = \lisppar % don't ignore blank lines
   \obeylines % each line of input is a line of output
   \parskip = 0pt
+  % Turn off paragraph indentation but redefine \indent to emulate
+  % the normal \indent.
+  \nonfillparindent=\parindent
   \parindent = 0pt
+  \let\indent\nonfillindent
+  %
   \emergencystretch = 0pt % don't try to avoid overfull boxes
   \ifx\nonarrowing\relax
     \advance \leftskip by \lispnarrowing
@@ -5879,6 +6423,24 @@ end
   \let\exdent=\nofillexdent
 }
 
+\begingroup
+\obeyspaces
+% We want to swallow spaces (but not other tokens) after the fake
+% @indent in our nonfill-environments, where spaces are normally
+% active and set to @tie, resulting in them not being ignored after
+% @indent.
+\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
+\gdef\nonfillindentcheck{%
+\ifx\temp %
+\expandafter\nonfillindentgobble%
+\else%
+\leavevmode\nonfillindentbox%
+\fi%
+}%
+\endgroup
+\def\nonfillindentgobble#1{\nonfillindent}
+\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
+
 % If you want all examples etc. small: @set dispenvsize small.
 % If you want even small examples the full size: @set dispenvsize nosmall.
 % This affects the following displayed environments:
@@ -5906,41 +6468,42 @@ end
 }
 
 % We often define two environments, @foo and @smallfoo.
-% Let's do it by one command:
-\def\makedispenv #1#2{
-  \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}
-  \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}
+% Let's do it in one command.  #1 is the env name, #2 the definition.
+\def\makedispenvdef#1#2{%
+  \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
+  \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
   \expandafter\let\csname E#1\endcsname \afterenvbreak
   \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
 }
 
-% Define two synonyms:
-\def\maketwodispenvs #1#2#3{
-  \makedispenv{#1}{#3}
-  \makedispenv{#2}{#3}
+% Define two environment synonyms (#1 and #2) for an environment.
+\def\maketwodispenvdef#1#2#3{%
+  \makedispenvdef{#1}{#3}%
+  \makedispenvdef{#2}{#3}%
 }
-
-% @lisp: indented, narrowed, typewriter font; @example: same as @lisp.
+%
+% @lisp: indented, narrowed, typewriter font;
+% @example: same as @lisp.
 %
 % @smallexample and @smalllisp: use smaller fonts.
 % Originally contributed by Pavel@xerox.
 %
-\maketwodispenv{lisp}{example}{%
+\maketwodispenvdef{lisp}{example}{%
   \nonfillstart
-  \tt\quoteexpand
+  \tt\setupmarkupstyle{example}%
   \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
-  \gobble       % eat return
+  \gobble % eat return
 }
 % @display/@smalldisplay: same as @lisp except keep current font.
 %
-\makedispenv {display}{%
+\makedispenvdef{display}{%
   \nonfillstart
   \gobble
 }
 
 % @format/@smallformat: same as @display except don't narrow margins.
 %
-\makedispenv{format}{%
+\makedispenvdef{format}{%
   \let\nonarrowing = t%
   \nonfillstart
   \gobble
@@ -5959,28 +6522,47 @@ end
 \envdef\flushright{%
   \let\nonarrowing = t%
   \nonfillstart
-  \advance\leftskip by 0pt plus 1fill
+  \advance\leftskip by 0pt plus 1fill\relax
   \gobble
 }
 \let\Eflushright = \afterenvbreak
 
 
+% @raggedright does more-or-less normal line breaking but no right
+% justification.  From plain.tex.
+\envdef\raggedright{%
+  \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax
+}
+\let\Eraggedright\par
+
+\envdef\raggedleft{%
+  \parindent=0pt \leftskip0pt plus2em
+  \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
+  \hbadness=10000 % Last line will usually be underfull, so turn off
+                  % badness reporting.
+}
+\let\Eraggedleft\par
+
+\envdef\raggedcenter{%
+  \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
+  \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
+  \hbadness=10000 % Last line will usually be underfull, so turn off
+                  % badness reporting.
+}
+\let\Eraggedcenter\par
+
+
 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
 % and narrows the margins.  We keep \parskip nonzero in general, since
 % we're doing normal filling.  So, when using \aboveenvbreak and
 % \afterenvbreak, temporarily make \parskip 0.
 %
-\envdef\quotation{%
-  {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
-  \parindent=0pt
-  %
-  % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
+\makedispenvdef{quotation}{\quotationstart}
+%
+\def\quotationstart{%
+  \indentedblockstart % same as \indentedblock, but increase right margin too.
   \ifx\nonarrowing\relax
-    \advance\leftskip by \lispnarrowing
     \advance\rightskip by \lispnarrowing
-    \exdentamount = \lispnarrowing
-  \else
-    \let\nonarrowing = \relax
   \fi
   \parsearg\quotationlabel
 }
@@ -5990,12 +6572,13 @@ end
 %
 \def\Equotation{%
   \par
-  \ifx\quotationauthor\undefined\else
+  \ifx\quotationauthor\thisisundefined\else
     % indent a bit.
     \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
   \fi
   {\parskip=0pt \afterenvbreak}%
 }
+\def\Esmallquotation{\Equotation}
 
 % If we're given an argument, typeset it in bold with a colon after.
 \def\quotationlabel#1{%
@@ -6005,6 +6588,32 @@ end
   \fi
 }
 
+% @indentedblock is like @quotation, but indents only on the left and
+% has no optional argument.
+% 
+\makedispenvdef{indentedblock}{\indentedblockstart}
+%
+\def\indentedblockstart{%
+  {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
+  \parindent=0pt
+  %
+  % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
+  \ifx\nonarrowing\relax
+    \advance\leftskip by \lispnarrowing
+    \exdentamount = \lispnarrowing
+  \else
+    \let\nonarrowing = \relax
+  \fi
+}
+
+% Keep a nonzero parskip for the environment, since we're doing normal filling.
+%
+\def\Eindentedblock{%
+  \par
+  {\parskip=0pt \afterenvbreak}%
+}
+\def\Esmallindentedblock{\Eindentedblock}
+
 
 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
 % If we want to allow any <char> as delimiter,
@@ -6020,18 +6629,16 @@ end
   \do\ \do\\\do\{\do\}\do\$\do\&%
   \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
   \do\<\do\>\do\|\do\@\do+\do\"%
+  % Don't do the quotes -- if we do, @set txicodequoteundirected and
+  % @set txicodequotebacktick will not have effect on @verb and
+  % @verbatim, and ?` and !` ligatures won't get disabled.
+  %\do\`\do\'%
 }
 %
 % [Knuth] p. 380
 \def\uncatcodespecials{%
   \def\do##1{\catcode`##1=\other}\dospecials}
 %
-% [Knuth] pp. 380,381,391
-% Disable Spanish ligatures ?` and !` of \tt font
-\begingroup
-  \catcode`\`=\active\gdef`{\relax\lq}
-\endgroup
-%
 % Setup for the @verb command.
 %
 % Eight spaces for a tab
@@ -6043,7 +6650,7 @@ end
 \def\setupverb{%
   \tt  % easiest (and conventionally used) font for verbatim
   \def\par{\leavevmode\endgraf}%
-  \catcode`\`=\active
+  \setupmarkupstyle{verb}%
   \tabeightspaces
   % Respect line breaks,
   % print special symbols as themselves, and
@@ -6054,73 +6661,46 @@ end
 
 % Setup for the @verbatim environment
 %
-% Real tab expansion
+% Real tab expansion.
 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
 %
-\def\starttabbox{\setbox0=\hbox\bgroup}
-
-% Allow an option to not replace quotes with a regular directed right
-% quote/apostrophe (char 0x27), but instead use the undirected quote
-% from cmtt (char 0x0d).  The undirected quote is ugly, so don't make it
-% the default, but it works for pasting with more pdf viewers (at least
-% evince), the lilypond developers report.  xpdf does work with the
-% regular 0x27.  
-% 
-\def\codequoteright{%
-  \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
-    \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
-      '%
-    \else \char'15 \fi
-  \else \char'15 \fi
-}
-%
-% and a similar option for the left quote char vs. a grave accent.
-% Modern fonts display ASCII 0x60 as a grave accent, so some people like
-% the code environments to do likewise.
-% 
-\def\codequoteleft{%
-  \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
-    \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
-      `%
-    \else \char'22 \fi
-  \else \char'22 \fi
-}
+% We typeset each line of the verbatim in an \hbox, so we can handle
+% tabs.  The \global is in case the verbatim line starts with an accent,
+% or some other command that starts with a begin-group.  Otherwise, the
+% entire \verbbox would disappear at the corresponding end-group, before
+% it is typeset.  Meanwhile, we can't have nested verbatim commands
+% (can we?), so the \global won't be overwriting itself.
+\newbox\verbbox
+\def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
 %
 \begingroup
   \catcode`\^^I=\active
   \gdef\tabexpand{%
     \catcode`\^^I=\active
     \def^^I{\leavevmode\egroup
-      \dimen0=\wd0 % the width so far, or since the previous tab
-      \divide\dimen0 by\tabw
-      \multiply\dimen0 by\tabw % compute previous multiple of \tabw
-      \advance\dimen0 by\tabw  % advance to next multiple of \tabw
-      \wd0=\dimen0 \box0 \starttabbox
+      \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
+      \divide\dimen\verbbox by\tabw
+      \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
+      \advance\dimen\verbbox by\tabw  % advance to next multiple of \tabw
+      \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
     }%
   }
-  \catcode`\'=\active
-  \gdef\rquoteexpand{\catcode\rquoteChar=\active \def'{\codequoteright}}%
-  %
-  \catcode`\`=\active
-  \gdef\lquoteexpand{\catcode\lquoteChar=\active \def`{\codequoteleft}}%
-  %
-  \gdef\quoteexpand{\rquoteexpand \lquoteexpand}%
 \endgroup
 
 % start the verbatim environment.
 \def\setupverbatim{%
   \let\nonarrowing = t%
   \nonfillstart
-  % Easiest (and conventionally used) font for verbatim
-  \tt
-  \def\par{\leavevmode\egroup\box0\endgraf}%
-  \catcode`\`=\active
+  \tt % easiest (and conventionally used) font for verbatim
+  % The \leavevmode here is for blank lines.  Otherwise, we would
+  % never \starttabox and the \egroup would end verbatim mode.
+  \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
   \tabexpand
-  \quoteexpand
+  \setupmarkupstyle{verbatim}%
   % Respect line breaks,
   % print special symbols as themselves, and
-  % make each space count
-  % must do in this order:
+  % make each space count.
+  % Must do in this order:
   \obeylines \uncatcodespecials \sepspaces
   \everypar{\starttabbox}%
 }
@@ -6176,6 +6756,8 @@ end
   {%
     \makevalueexpandable
     \setupverbatim
+    \indexnofonts       % Allow `@@' and other weird things in file names.
+    \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
     \input #1
     \afterenvbreak
   }%
@@ -6225,7 +6807,7 @@ end
     % commands also insert a nobreak penalty, and we don't want to allow
     % a break between a section heading and a defun.
     %
-    % As a minor refinement, we avoid "club" headers by signalling
+    % As a further refinement, we avoid "club" headers by signalling
     % with penalty of 10003 after the very first @deffn in the
     % sequence (see above), and penalty of 10002 after any following
     % @def command.
@@ -6262,7 +6844,7 @@ end
     #1#2 \endheader
     % common ending:
     \interlinepenalty = 10000
-    \advance\rightskip by 0pt plus 1fil
+    \advance\rightskip by 0pt plus 1fil\relax
     \endgraf
     \nobreak\vskip -\parskip
     \penalty\defunpenalty  % signal to \startdefun and \dodefunx
@@ -6292,13 +6874,36 @@ end
 \def\domakedefun#1#2#3{%
   \envdef#1{%
     \startdefun
+    \doingtypefnfalse    % distinguish typed functions from all else
     \parseargusing\activeparens{\printdefunline#3}%
   }%
   \def#2{\dodefunx#1}%
   \def#3%
 }
 
-%%% Untyped functions:
+\newif\ifdoingtypefn       % doing typed function?
+\newif\ifrettypeownline    % typeset return type on its own line?
+
+% @deftypefnnewline on|off says whether the return type of typed functions
+% are printed on their own line.  This affects @deftypefn, @deftypefun,
+% @deftypeop, and @deftypemethod.
+% 
+\parseargdef\deftypefnnewline{%
+  \def\temp{#1}%
+  \ifx\temp\onword
+    \expandafter\let\csname SETtxideftypefnnl\endcsname
+      = \empty
+  \else\ifx\temp\offword
+    \expandafter\let\csname SETtxideftypefnnl\endcsname
+      = \relax
+  \else
+    \errhelp = \EMsimple
+    \errmessage{Unknown @txideftypefnnl value `\temp',
+                must be on|off}%
+  \fi\fi
+}
+
+% Untyped functions:
 
 % @deffn category name args
 \makedefun{deffn}{\deffngeneral{}}
@@ -6317,7 +6922,7 @@ end
   \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
 }
 
-%%% Typed functions:
+% Typed functions:
 
 % @deftypefn category type name args
 \makedefun{deftypefn}{\deftypefngeneral{}}
@@ -6332,10 +6937,11 @@ end
 %
 \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
   \dosubind{fn}{\code{#4}}{#1}%
+  \doingtypefntrue
   \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
 }
 
-%%% Typed variables:
+% Typed variables:
 
 % @deftypevr category type var args
 \makedefun{deftypevr}{\deftypecvgeneral{}}
@@ -6353,7 +6959,7 @@ end
   \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
 }
 
-%%% Untyped variables:
+% Untyped variables:
 
 % @defvr category var args
 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
@@ -6364,7 +6970,8 @@ end
 % \defcvof {category of}class var args
 \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
 
-%%% Type:
+% Types:
+
 % @deftp category name args
 \makedefun{deftp}#1 #2 #3\endheader{%
   \doind{tp}{\code{#2}}%
@@ -6392,25 +6999,49 @@ end
 % We are followed by (but not passed) the arguments, if any.
 %
 \def\defname#1#2#3{%
+  \par
   % Get the values of \leftskip and \rightskip as they were outside the @def...
   \advance\leftskip by -\defbodyindent
   %
-  % How we'll format the type name.  Putting it in brackets helps
+  % Determine if we are typesetting the return type of a typed function
+  % on a line by itself.
+  \rettypeownlinefalse
+  \ifdoingtypefn  % doing a typed function specifically?
+    % then check user option for putting return type on its own line:
+    \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
+      \rettypeownlinetrue
+    \fi
+  \fi
+  %
+  % How we'll format the category name.  Putting it in brackets helps
   % distinguish it from the body text that may end up on the next line
   % just below it.
   \def\temp{#1}%
   \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
   %
-  % Figure out line sizes for the paragraph shape.
+  % Figure out line sizes for the paragraph shape.  We'll always have at
+  % least two.
+  \tempnum = 2
+  %
   % The first line needs space for \box0; but if \rightskip is nonzero,
   % we need only space for the part of \box0 which exceeds it:
   \dimen0=\hsize  \advance\dimen0 by -\wd0  \advance\dimen0 by \rightskip
+  %
+  % If doing a return type on its own line, we'll have another line.
+  \ifrettypeownline
+    \advance\tempnum by 1
+    \def\maybeshapeline{0in \hsize}%
+  \else
+    \def\maybeshapeline{}%
+  \fi
+  %
   % The continuations:
   \dimen2=\hsize  \advance\dimen2 by -\defargsindent
-  % (plain.tex says that \dimen1 should be used only as global.)
-  \parshape 2 0in \dimen0 \defargsindent \dimen2
   %
-  % Put the type name to the right margin.
+  % The final paragraph shape:
+  \parshape \tempnum  0in \dimen0  \maybeshapeline  \defargsindent \dimen2
+  %
+  % Put the category name at the right margin.
   \noindent
   \hbox to 0pt{%
     \hfil\box0 \kern-\hsize
@@ -6432,8 +7063,16 @@ end
     % . this still does not fix the ?` and !` ligatures, but so far no
     %   one has made identifiers using them :).
     \df \tt
-    \def\temp{#2}% return value type
-    \ifx\temp\empty\else \tclose{\temp} \fi
+    \def\temp{#2}% text of the return type
+    \ifx\temp\empty\else
+      \tclose{\temp}% typeset the return type
+      \ifrettypeownline
+        % put return type on its own line; prohibit line break following:
+        \hfil\vadjust{\nobreak}\break  
+      \else
+        \space  % type on same line, so just followed by a space
+      \fi
+    \fi           % no return type
     #3% output function name
   }%
   {\rm\enskip}% hskip 0.5 em of \tenrm
@@ -6453,8 +7092,11 @@ end
   \df \sl \hyphenchar\font=0
   %
   % On the other hand, if an argument has two dashes (for instance), we
-  % want a way to get ttsl.  Let's try @var for that.
-  \let\var=\ttslanted
+  % want a way to get ttsl.  We used to recommend @var for that, so
+  % leave the code in, but it's strange for @var to lead to typewriter.
+  % Nowadays we recommend @code, since the difference between a ttsl hyphen
+  % and a tt hyphen is pretty tiny.  @code also disables ?` !`.
+  \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
   #1%
   \sl\hyphenchar\font=45
 }
@@ -6551,7 +7193,7 @@ end
 
 % To do this right we need a feature of e-TeX, \scantokens,
 % which we arrange to emulate with a temporary file in ordinary TeX.
-\ifx\eTeXversion\undefined
+\ifx\eTeXversion\thisisundefined
   \newwrite\macscribble
   \def\scantokens#1{%
     \toks0={#1}%
@@ -6562,25 +7204,30 @@ end
   }
 \fi
 
-\def\scanmacro#1{%
-  \begingroup
-    \newlinechar`\^^M
-    \let\xeatspaces\eatspaces
-    % Undo catcode changes of \startcontents and \doprintindex
-    % When called from @insertcopying or (short)caption, we need active
-    % backslash to get it printed correctly.  Previously, we had
-    % \catcode`\\=\other instead.  We'll see whether a problem appears
-    % with macro expansion.                            --kasal, 19aug04
-    \catcode`\@=0 \catcode`\\=\active \escapechar=`\@
-    % ... and \example
-    \spaceisspace
-    %
-    % Append \endinput to make sure that TeX does not see the ending newline.
-    % I've verified that it is necessary both for e-TeX and for ordinary TeX
-    %                                                  --kasal, 29nov03
-    \scantokens{#1\endinput}%
-  \endgroup
-}
+\def\scanmacro#1{\begingroup
+  \newlinechar`\^^M
+  \let\xeatspaces\eatspaces
+  %
+  % Undo catcode changes of \startcontents and \doprintindex
+  % When called from @insertcopying or (short)caption, we need active
+  % backslash to get it printed correctly.  Previously, we had
+  % \catcode`\\=\other instead.  We'll see whether a problem appears
+  % with macro expansion.                              --kasal, 19aug04
+  \catcode`\@=0 \catcode`\\=\active \escapechar=`\@
+  %
+  % ... and for \example:
+  \spaceisspace
+  %
+  % The \empty here causes a following catcode 5 newline to be eaten as
+  % part of reading whitespace after a control sequence.  It does not
+  % eat a catcode 13 newline.  There's no good way to handle the two
+  % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX
+  % would then have different behavior).  See the Macro Details node in
+  % the manual for the workaround we recommend for macros and
+  % line-oriented commands.
+  % 
+  \scantokens{#1\empty}%
+\endgroup}
 
 \def\scanexp#1{%
   \edef\temp{\noexpand\scanmacro{#1}}%
@@ -6608,7 +7255,7 @@ end
 % This does \let #1 = #2, with \csnames; that is,
 %   \let \csname#1\endcsname = \csname#2\endcsname
 % (except of course we have to play expansion games).
-% 
+%
 \def\cslet#1#2{%
   \expandafter\let
   \csname#1\expandafter\endcsname
@@ -6634,17 +7281,18 @@ end
 
 % Macro bodies are absorbed as an argument in a context where
 % all characters are catcode 10, 11 or 12, except \ which is active
-% (as in normal texinfo). It is necessary to change the definition of \.
-
+% (as in normal texinfo). It is necessary to change the definition of \
+% to recognize macro arguments; this is the job of \mbodybackslash.
+%
 % Non-ASCII encodings make 8-bit characters active, so un-activate
 % them to avoid their expansion.  Must do this non-globally, to
 % confine the change to the current group.
-
+%
 % It's necessary to have hard CRs when the macro is executed. This is
-% done by  making ^^M (\endlinechar) catcode 12 when reading the macro
+% done by making ^^M (\endlinechar) catcode 12 when reading the macro
 % body, and then making it the \newlinechar in \scanmacro.
-
-\def\scanctxt{%
+%
+\def\scanctxt{% used as subroutine
   \catcode`\"=\other
   \catcode`\+=\other
   \catcode`\<=\other
@@ -6657,13 +7305,13 @@ end
   \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
 }
 
-\def\scanargctxt{%
+\def\scanargctxt{% used for copying and captions, not macros.
   \scanctxt
   \catcode`\\=\other
   \catcode`\^^M=\other
 }
 
-\def\macrobodyctxt{%
+\def\macrobodyctxt{% used for @macro definitions
   \scanctxt
   \catcode`\{=\other
   \catcode`\}=\other
@@ -6671,32 +7319,56 @@ end
   \usembodybackslash
 }
 
-\def\macroargctxt{%
+\def\macroargctxt{% used when scanning invocations
   \scanctxt
-  \catcode`\\=\other
+  \catcode`\\=0
 }
+% why catcode 0 for \ in the above?  To recognize \\ \{ \} as "escapes"
+% for the single characters \ { }.  Thus, we end up with the "commands"
+% that would be written @\ @{ @} in a Texinfo document.
+% 
+% We already have @{ and @}.  For @\, we define it here, and only for
+% this purpose, to produce a typewriter backslash (so, the @\ that we
+% define for @math can't be used with @macro calls):
+%
+\def\\{\normalbackslash}%
+% 
+% We would like to do this for \, too, since that is what makeinfo does.
+% But it is not possible, because Texinfo already has a command @, for a
+% cedilla accent.  Documents must use @comma{} instead.
+%
+% \anythingelse will almost certainly be an error of some kind.
+
 
 % \mbodybackslash is the definition of \ in @macro bodies.
 % It maps \foo\ => \csname macarg.foo\endcsname => #N
 % where N is the macro parameter number.
 % We define \csname macarg.\endcsname to be \realbackslash, so
 % \\ in macro replacement text gets you a backslash.
-
+%
 {\catcode`@=0 @catcode`@\=@active
  @gdef@usembodybackslash{@let\=@mbodybackslash}
  @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
 }
 \expandafter\def\csname macarg.\endcsname{\realbackslash}
 
+\def\margbackslash#1{\char`\#1 }
+
 \def\macro{\recursivefalse\parsearg\macroxxx}
 \def\rmacro{\recursivetrue\parsearg\macroxxx}
 
 \def\macroxxx#1{%
-  \getargs{#1}%           now \macname is the macname and \argl the arglist
+  \getargs{#1}% now \macname is the macname and \argl the arglist
   \ifx\argl\empty       % no arguments
-     \paramno=0%
+     \paramno=0\relax
   \else
      \expandafter\parsemargdef \argl;%
+     \if\paramno>256\relax
+       \ifx\eTeXversion\thisisundefined
+         \errhelp = \EMsimple
+         \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
+       \fi
+     \fi
   \fi
   \if1\csname ismacro.\the\macname\endcsname
      \message{Warning: redefining \the\macname}%
@@ -6743,46 +7415,269 @@ end
 % an opening brace, and that opening brace is not consumed.
 \def\getargs#1{\getargsxxx#1{}}
 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
-\def\getmacname #1 #2\relax{\macname={#1}}
+\def\getmacname#1 #2\relax{\macname={#1}}
 \def\getmacargs#1{\def\argl{#1}}
 
+% For macro processing make @ a letter so that we can make Texinfo private macro names.
+\edef\texiatcatcode{\the\catcode`\@}
+\catcode `@=11\relax
+
 % Parse the optional {params} list.  Set up \paramno and \paramlist
-% so \defmacro knows what to do.  Define \macarg.blah for each blah
-% in the params list, to be ##N where N is the position in that list.
+% so \defmacro knows what to do.  Define \macarg.BLAH for each BLAH
+% in the params list to some hook where the argument si to be expanded.  If
+% there are less than 10 arguments that hook is to be replaced by ##N where N
+% is the position in that list, that is to say the macro arguments are to be
+% defined `a la TeX in the macro body.  
+%
 % That gets used by \mbodybackslash (above).
-
+%
 % We need to get `macro parameter char #' into several definitions.
-% The technique used is stolen from LaTeX:  let \hash be something
+% The technique used is stolen from LaTeX: let \hash be something
 % unexpandable, insert that wherever you need a #, and then redefine
 % it to # just before using the token list produced.
 %
 % The same technique is used to protect \eatspaces till just before
 % the macro is used.
-
-\def\parsemargdef#1;{\paramno=0\def\paramlist{}%
-        \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
+%
+% If there are 10 or more arguments, a different technique is used, where the
+% hook remains in the body, and when macro is to be expanded the body is
+% processed again to replace the arguments.
+%
+% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
+% argument N value and then \edef  the body (nothing else will expand because of
+% the catcode regime underwhich the body was input).
+%
+% If you compile with TeX (not eTeX), and you have macros with 10 or more
+% arguments, you need that no macro has more than 256 arguments, otherwise an
+% error is produced.
+\def\parsemargdef#1;{%
+  \paramno=0\def\paramlist{}%
+  \let\hash\relax
+  \let\xeatspaces\relax
+  \parsemargdefxxx#1,;,%
+  % In case that there are 10 or more arguments we parse again the arguments
+  % list to set new definitions for the \macarg.BLAH macros corresponding to
+  % each BLAH argument. It was anyhow needed to parse already once this list
+  % in order to count the arguments, and as macros with at most 9 arguments
+  % are by far more frequent than macro with 10 or more arguments, defining
+  % twice the \macarg.BLAH macros does not cost too much processing power.
+  \ifnum\paramno<10\relax\else
+    \paramno0\relax
+    \parsemmanyargdef@@#1,;,% 10 or more arguments
+  \fi
+}
 \def\parsemargdefxxx#1,{%
   \if#1;\let\next=\relax
   \else \let\next=\parsemargdefxxx
-    \advance\paramno by 1%
+    \advance\paramno by 1
     \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
         {\xeatspaces{\hash\the\paramno}}%
     \edef\paramlist{\paramlist\hash\the\paramno,}%
   \fi\next}
 
+\def\parsemmanyargdef@@#1,{%
+  \if#1;\let\next=\relax
+  \else 
+    \let\next=\parsemmanyargdef@@
+    \edef\tempb{\eatspaces{#1}}%
+    \expandafter\def\expandafter\tempa
+       \expandafter{\csname macarg.\tempb\endcsname}%
+    % Note that we need some extra \noexpand\noexpand, this is because we
+    % don't want \the  to be expanded in the \parsermacbody  as it uses an
+    % \xdef .
+    \expandafter\edef\tempa
+      {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
+    \advance\paramno by 1\relax
+  \fi\next}
+
 % These two commands read recursive and nonrecursive macro bodies.
 % (They're different since rec and nonrec macros end differently.)
+%
 
+\catcode `\@\texiatcatcode
 \long\def\parsemacbody#1@end macro%
 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
 \long\def\parsermacbody#1@end rmacro%
 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
+\catcode `\@=11\relax
+
+\let\endargs@\relax
+\let\nil@\relax
+\def\nilm@{\nil@}%
+\long\def\nillm@{\nil@}%
+
+% This macro is expanded during the Texinfo macro expansion, not during its
+% definition.  It gets all the arguments values and assigns them to macros
+% macarg.ARGNAME
+%
+% #1 is the macro name
+% #2 is the list of argument names
+% #3 is the list of argument values
+\def\getargvals@#1#2#3{%
+  \def\macargdeflist@{}%
+  \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
+  \def\paramlist{#2,\nil@}%
+  \def\macroname{#1}%
+  \begingroup
+  \macroargctxt
+  \def\argvaluelist{#3,\nil@}%
+  \def\@tempa{#3}%
+  \ifx\@tempa\empty
+    \setemptyargvalues@
+  \else
+    \getargvals@@
+  \fi
+}
+
+% 
+\def\getargvals@@{%
+  \ifx\paramlist\nilm@
+      % Some sanity check needed here that \argvaluelist is also empty.
+      \ifx\argvaluelist\nillm@
+      \else
+        \errhelp = \EMsimple
+        \errmessage{Too many arguments in macro `\macroname'!}%
+      \fi
+      \let\next\macargexpandinbody@
+  \else
+    \ifx\argvaluelist\nillm@
+       % No more arguments values passed to macro.  Set remaining named-arg
+       % macros to empty.
+       \let\next\setemptyargvalues@
+    \else
+      % pop current arg name into \@tempb
+      \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
+      \expandafter\@tempa\expandafter{\paramlist}%
+       % pop current argument value into \@tempc
+      \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
+      \expandafter\@tempa\expandafter{\argvaluelist}%
+       % Here \@tempb is the current arg name and \@tempc is the current arg value.
+       % First place the new argument macro definition into \@tempd
+       \expandafter\macname\expandafter{\@tempc}%
+       \expandafter\let\csname macarg.\@tempb\endcsname\relax
+       \expandafter\def\expandafter\@tempe\expandafter{%
+         \csname macarg.\@tempb\endcsname}%
+       \edef\@tempd{\long\def\@tempe{\the\macname}}%
+       \push@\@tempd\macargdeflist@
+       \let\next\getargvals@@
+    \fi
+  \fi
+  \next
+}
+
+\def\push@#1#2{%
+  \expandafter\expandafter\expandafter\def
+  \expandafter\expandafter\expandafter#2%
+  \expandafter\expandafter\expandafter{%
+  \expandafter#1#2}%
+}
+
+% Replace arguments by their values in the macro body, and place the result
+% in macro \@tempa
+\def\macvalstoargs@{%
+  %  To do this we use the property that token registers that are \the'ed
+  % within an \edef  expand only once. So we are going to place all argument
+  % values into respective token registers.
+  %
+  % First we save the token context, and initialize argument numbering.
+  \begingroup
+    \paramno0\relax
+    % Then, for each argument number #N, we place the corresponding argument
+    % value into a new token list register \toks#N
+    \expandafter\putargsintokens@\saveparamlist@,;,%
+    % Then, we expand the body so that argument are replaced by their
+    % values. The trick for values not to be expanded themselves is that they
+    % are within tokens and that tokens expand only once in an \edef .
+    \edef\@tempc{\csname mac.\macroname .body\endcsname}%
+    % Now we restore the token stack pointer to free the token list registers
+    % which we have used, but we make sure that expanded body is saved after
+    % group.
+    \expandafter
+  \endgroup
+  \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
+  }
+
+\def\macargexpandinbody@{% 
+  %% Define the named-macro outside of this group and then close this group. 
+  \expandafter
+  \endgroup
+  \macargdeflist@
+  % First the replace in body the macro arguments by their values, the result
+  % is in \@tempa .
+  \macvalstoargs@
+  % Then we point at the \norecurse or \gobble (for recursive) macro value
+  % with \@tempb .
+  \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
+  % Depending on whether it is recursive or not, we need some tailing
+  % \egroup .
+  \ifx\@tempb\gobble
+     \let\@tempc\relax
+  \else
+     \let\@tempc\egroup
+  \fi
+  % And now we do the real job:
+  \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
+  \@tempd
+}
+
+\def\putargsintokens@#1,{%
+  \if#1;\let\next\relax
+  \else
+    \let\next\putargsintokens@
+    % First we allocate the new token list register, and give it a temporary
+    % alias \@tempb .
+    \toksdef\@tempb\the\paramno
+    % Then we place the argument value into that token list register.
+    \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
+    \expandafter\@tempb\expandafter{\@tempa}%
+    \advance\paramno by 1\relax
+  \fi
+  \next
+}
+
+% Save the token stack pointer into macro #1
+\def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}}
+% Restore the token stack pointer from number in macro #1
+\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax}
+% newtoks that can be used non \outer .
+\def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi}
+
+% Tailing missing arguments are set to empty
+\def\setemptyargvalues@{%
+  \ifx\paramlist\nilm@
+    \let\next\macargexpandinbody@
+  \else
+    \expandafter\setemptyargvaluesparser@\paramlist\endargs@
+    \let\next\setemptyargvalues@
+  \fi
+  \next
+}
+
+\def\setemptyargvaluesparser@#1,#2\endargs@{%
+  \expandafter\def\expandafter\@tempa\expandafter{%
+    \expandafter\def\csname macarg.#1\endcsname{}}%
+  \push@\@tempa\macargdeflist@
+  \def\paramlist{#2}%
+}
+
+% #1 is the element target macro
+% #2 is the list macro
+% #3,#4\endargs@ is the list value
+\def\pop@#1#2#3,#4\endargs@{%
+   \def#1{#3}%
+   \def#2{#4}%
+}
+\long\def\longpop@#1#2#3,#4\endargs@{%
+   \long\def#1{#3}%
+   \long\def#2{#4}%
+}
 
-% This defines the macro itself. There are six cases: recursive and
-% nonrecursive macros of zero, one, and many arguments.
+% This defines a Texinfo @macro. There are eight cases: recursive and
+% nonrecursive macros of zero, one, up to nine, and many arguments.
 % Much magic with \expandafter here.
 % \xdef is used so that macro definitions will survive the file
 % they're defined in; @include reads the file inside a group.
+%
 \def\defmacro{%
   \let\hash=##% convert placeholders to macro parameter chars
   \ifrecursive
@@ -6797,17 +7692,25 @@ end
          \expandafter\noexpand\csname\the\macname xxx\endcsname}%
       \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
          \egroup\noexpand\scanmacro{\temp}}%
-    \else % many
-      \expandafter\xdef\csname\the\macname\endcsname{%
-         \bgroup\noexpand\macroargctxt
-         \noexpand\csname\the\macname xx\endcsname}%
-      \expandafter\xdef\csname\the\macname xx\endcsname##1{%
-          \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
-      \expandafter\expandafter
-      \expandafter\xdef
-      \expandafter\expandafter
-        \csname\the\macname xxx\endcsname
-          \paramlist{\egroup\noexpand\scanmacro{\temp}}%
+    \else
+      \ifnum\paramno<10\relax % at most 9
+        \expandafter\xdef\csname\the\macname\endcsname{%
+           \bgroup\noexpand\macroargctxt
+           \noexpand\csname\the\macname xx\endcsname}%
+        \expandafter\xdef\csname\the\macname xx\endcsname##1{%
+            \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
+        \expandafter\expandafter
+        \expandafter\xdef
+        \expandafter\expandafter
+          \csname\the\macname xxx\endcsname
+            \paramlist{\egroup\noexpand\scanmacro{\temp}}%
+      \else % 10 or more
+        \expandafter\xdef\csname\the\macname\endcsname{%
+          \noexpand\getargvals@{\the\macname}{\argl}%
+        }%    
+        \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
+        \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
+      \fi
     \fi
   \else
     \ifcase\paramno
@@ -6824,29 +7727,40 @@ end
         \egroup
         \noexpand\norecurse{\the\macname}%
         \noexpand\scanmacro{\temp}\egroup}%
-    \else % many
-      \expandafter\xdef\csname\the\macname\endcsname{%
-         \bgroup\noexpand\macroargctxt
-         \expandafter\noexpand\csname\the\macname xx\endcsname}%
-      \expandafter\xdef\csname\the\macname xx\endcsname##1{%
-          \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
-      \expandafter\expandafter
-      \expandafter\xdef
-      \expandafter\expandafter
-      \csname\the\macname xxx\endcsname
-      \paramlist{%
-          \egroup
-          \noexpand\norecurse{\the\macname}%
-          \noexpand\scanmacro{\temp}\egroup}%
+    \else % at most 9
+      \ifnum\paramno<10\relax
+        \expandafter\xdef\csname\the\macname\endcsname{%
+           \bgroup\noexpand\macroargctxt
+           \expandafter\noexpand\csname\the\macname xx\endcsname}%
+        \expandafter\xdef\csname\the\macname xx\endcsname##1{%
+            \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
+        \expandafter\expandafter
+        \expandafter\xdef
+        \expandafter\expandafter
+        \csname\the\macname xxx\endcsname
+        \paramlist{%
+            \egroup
+            \noexpand\norecurse{\the\macname}%
+            \noexpand\scanmacro{\temp}\egroup}%
+      \else % 10 or more:
+        \expandafter\xdef\csname\the\macname\endcsname{%
+          \noexpand\getargvals@{\the\macname}{\argl}%
+        }%
+        \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
+        \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse
+      \fi
     \fi
   \fi}
 
+\catcode `\@\texiatcatcode\relax
+
 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
 
 % \braceorline decides whether the next nonwhitespace character is a
 % {.  If so it reads up to the closing }, if not, it reads the whole
 % line.  Whatever was read is then fed to the next control sequence
-% as an argument (by \parsebrace or \parsearg)
+% as an argument (by \parsebrace or \parsearg).
+% 
 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
 \def\braceorlinexxx{%
   \ifx\nchar\bgroup\else
@@ -6856,7 +7770,8 @@ end
 
 % @alias.
 % We need some trickery to remove the optional spaces around the equal
-% sign.  Just make them active and then expand them all to nothing.
+% sign.  Make them active and then expand them all to nothing.
+%
 \def\alias{\parseargusing\obeyspaces\aliasxxx}
 \def\aliasxxx #1{\aliasyyy#1\relax}
 \def\aliasyyy #1=#2\relax{%
@@ -6877,7 +7792,8 @@ end
 
 % @inforef is relatively simple.
 \def\inforef #1{\inforefzzz #1,,,,**}
-\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
+\def\inforefzzz #1,#2,#3,#4**{%
+  \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
   node \samp{\ignorespaces#1{}}}
 
 % @node's only job in TeX is to define \lastnode, which is used in
@@ -6938,11 +7854,32 @@ end
       \toks0 = \expandafter{\lastsection}%
       \immediate \writexrdef{title}{\the\toks0 }%
       \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
-      \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, during \shipout
+      \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
     }%
   \fi
 }
 
+% @xrefautosectiontitle on|off says whether @section(ing) names are used
+% automatically in xrefs, if the third arg is not explicitly specified.
+% This was provided as a "secret" @set xref-automatic-section-title
+% variable, now it's official.
+% 
+\parseargdef\xrefautomaticsectiontitle{%
+  \def\temp{#1}%
+  \ifx\temp\onword
+    \expandafter\let\csname SETxref-automatic-section-title\endcsname
+      = \empty
+  \else\ifx\temp\offword
+    \expandafter\let\csname SETxref-automatic-section-title\endcsname
+      = \relax
+  \else
+    \errhelp = \EMsimple
+    \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
+                must be on|off}%
+  \fi\fi
+}
+
+% \f
 % @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
 % the node name, #2 the name of the Info cross-reference, #3 the printed
 % node name, #4 the name of the Info file, #5 the name of the printed
@@ -6951,26 +7888,41 @@ end
 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
 \def\ref#1{\xrefX[#1,,,,,,,]}
+%
+\newbox\toprefbox
+\newbox\printedrefnamebox
+\newbox\infofilenamebox
+\newbox\printedmanualbox
+%
 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
   \unsepspaces
-  \def\printedmanual{\ignorespaces #5}%
+  %
+  % Get args without leading/trailing spaces.
   \def\printedrefname{\ignorespaces #3}%
-  \setbox1=\hbox{\printedmanual\unskip}%
-  \setbox0=\hbox{\printedrefname\unskip}%
-  \ifdim \wd0 = 0pt
+  \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
+  %
+  \def\infofilename{\ignorespaces #4}%
+  \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
+  %
+  \def\printedmanual{\ignorespaces #5}%
+  \setbox\printedmanualbox  = \hbox{\printedmanual\unskip}%
+  %
+  % If the printed reference name (arg #3) was not explicitly given in
+  % the @xref, figure out what we want to use.
+  \ifdim \wd\printedrefnamebox = 0pt
     % No printed node name was explicitly given.
-    \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
-      % Use the node name inside the square brackets.
+    \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
+      % Not auto section-title: use node name inside the square brackets.
       \def\printedrefname{\ignorespaces #1}%
     \else
-      % Use the actual chapter/section title appear inside
-      % the square brackets.  Use the real section title if we have it.
-      \ifdim \wd1 > 0pt
-        % It is in another manual, so we don't have it.
+      % Auto section-title: use chapter/section title inside
+      % the square brackets if we have it.
+      \ifdim \wd\printedmanualbox > 0pt
+        % It is in another manual, so we don't have it; use node name.
         \def\printedrefname{\ignorespaces #1}%
       \else
         \ifhavexrefs
-          % We know the real title if we have the xref values.
+          % We (should) know the real title if we have the xref values.
           \def\printedrefname{\refx{#1-title}{}}%
         \else
           % Otherwise just copy the Info node name.
@@ -6984,13 +7936,20 @@ end
   \ifpdf
     {\indexnofonts
      \turnoffactive
+     \makevalueexpandable
      % This expands tokens, so do it after making catcode changes, so _
-     % etc. don't get their TeX definitions.
+     % etc. don't get their TeX definitions.  This ignores all spaces in
+     % #4, including (wrongly) those in the middle of the filename.
      \getfilename{#4}%
      %
-     % See comments at \activebackslashdouble.
-     {\activebackslashdouble \xdef\pdfxrefdest{#1}%
-      \backslashparens\pdfxrefdest}%
+     % This (wrongly) does not take account of leading or trailing
+     % spaces in #1, which should be ignored.
+     \edef\pdfxrefdest{#1}%
+     \ifx\pdfxrefdest\empty
+       \def\pdfxrefdest{Top}% no empty targets
+     \else
+       \txiescapepdf\pdfxrefdest  % escape PDF special chars
+     \fi
      %
      \leavevmode
      \startlink attr{/Border [0 0 0]}%
@@ -7017,29 +7976,42 @@ end
   \iffloat\Xthisreftitle
     % If the user specified the print name (third arg) to the ref,
     % print it instead of our usual "Figure 1.2".
-    \ifdim\wd0 = 0pt
+    \ifdim\wd\printedrefnamebox = 0pt
       \refx{#1-snt}{}%
     \else
       \printedrefname
     \fi
     %
-    % if the user also gave the printed manual name (fifth arg), append
+    % If the user also gave the printed manual name (fifth arg), append
     % "in MANUALNAME".
-    \ifdim \wd1 > 0pt
+    \ifdim \wd\printedmanualbox > 0pt
       \space \putwordin{} \cite{\printedmanual}%
     \fi
   \else
     % node/anchor (non-float) references.
+    % 
+    % If we use \unhbox to print the node names, TeX does not insert
+    % empty discretionaries after hyphens, which means that it will not
+    % find a line break at a hyphen in a node names.  Since some manuals
+    % are best written with fairly long node names, containing hyphens,
+    % this is a loss.  Therefore, we give the text of the node name
+    % again, so it is as if TeX is seeing it for the first time.
+    % 
+    \ifdim \wd\printedmanualbox > 0pt
+      % Cross-manual reference with a printed manual name.
+      % 
+      \crossmanualxref{\cite{\printedmanual\unskip}}%
+    %
+    \else\ifdim \wd\infofilenamebox > 0pt
+      % Cross-manual reference with only an info filename (arg 4), no
+      % printed manual name (arg 5).  This is essentially the same as
+      % the case above; we output the filename, since we have nothing else.
+      % 
+      \crossmanualxref{\code{\infofilename\unskip}}%
     %
-    % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
-    % insert empty discretionaries after hyphens, which means that it will
-    % not find a line break at a hyphen in a node names.  Since some manuals
-    % are best written with fairly long node names, containing hyphens, this
-    % is a loss.  Therefore, we give the text of the node name again, so it
-    % is as if TeX is seeing it for the first time.
-    \ifdim \wd1 > 0pt
-      \putwordSection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}%
     \else
+      % Reference within this manual.
+      %
       % _ (for example) has to be the character _ for the purposes of the
       % control sequence corresponding to the node, but it has to expand
       % into the usual \leavevmode...\vrule stuff for purposes of
@@ -7051,7 +8023,7 @@ end
        \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
        \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
       }%
-      % output the `[mynode]' via a macro so it can be overridden.
+      % output the `[mynode]' via the macro below so it can be overridden.
       \xrefprintnodename\printedrefname
       %
       % But we always want a comma and a space:
@@ -7059,11 +8031,37 @@ end
       %
       % output the `page 3'.
       \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
-    \fi
+    \fi\fi
   \fi
   \endlink
 \endgroup}
 
+% Output a cross-manual xref to #1.  Used just above (twice).
+% 
+% Only include the text "Section ``foo'' in" if the foo is neither
+% missing or Top.  Thus, @xref{,,,foo,The Foo Manual} outputs simply
+% "see The Foo Manual", the idea being to refer to the whole manual.
+% 
+% But, this being TeX, we can't easily compare our node name against the
+% string "Top" while ignoring the possible spaces before and after in
+% the input.  By adding the arbitrary 7sp below, we make it much less
+% likely that a real node name would have the same width as "Top" (e.g.,
+% in a monospaced font).  Hopefully it will never happen in practice.
+% 
+% For the same basic reason, we retypeset the "Top" at every
+% reference, since the current font is indeterminate.
+% 
+\def\crossmanualxref#1{%
+  \setbox\toprefbox = \hbox{Top\kern7sp}%
+  \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
+  \ifdim \wd2 > 7sp  % nonempty?
+    \ifdim \wd2 = \wd\toprefbox \else  % same as Top?
+      \putwordSection{} ``\printedrefname'' \putwordin{}\space
+    \fi
+  \fi
+  #1%
+}
+
 % This macro is called from \xrefX for the `[nodename]' part of xref
 % output.  It's a separate macro only so it can be changed more easily,
 % since square brackets don't work well in some documents.  Particularly
@@ -7114,7 +8112,8 @@ end
     \angleleft un\-de\-fined\angleright
     \iflinks
       \ifhavexrefs
-        \message{\linenumber Undefined cross reference `#1'.}%
+        {\toks0 = {#1}% avoid expansion of possibly-complex value
+         \message{\linenumber Undefined cross reference `\the\toks0'.}}%
       \else
         \ifwarnedxrefs\else
           \global\warnedxrefstrue
@@ -7278,7 +8277,7 @@ end
 % space to prevent strange expansion errors.)
 \def\supereject{\par\penalty -20000\footnoteno =0 }
 
-% @footnotestyle is meaningful for info output only.
+% @footnotestyle is meaningful for Info output only.
 \let\footnotestyle=\comment
 
 {\catcode `\@=11
@@ -7341,6 +8340,8 @@ end
   % expands into a box, it must come within the paragraph, lest it
   % provide a place where TeX can split the footnote.
   \footstrut
+  %
+  % Invoke rest of plain TeX footnote routine.
   \futurelet\next\fo@t
 }
 }%end \catcode `\@=11
@@ -7428,7 +8429,7 @@ end
   it from ftp://tug.org/tex/epsf.tex.}
 %
 \def\image#1{%
-  \ifx\epsfbox\undefined
+  \ifx\epsfbox\thisisundefined
     \ifwarnednoepsf \else
       \errhelp = \noepsfhelp
       \errmessage{epsf.tex not found, images will be ignored}%
@@ -7444,7 +8445,7 @@ end
 % #2 is (optional) width, #3 is (optional) height.
 % #4 is (ignored optional) html alt text.
 % #5 is (ignored optional) extension.
-% #6 is just the usual extra ignored arg for parsing this stuff.
+% #6 is just the usual extra ignored arg for parsing stuff.
 \newif\ifimagevmode
 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
   \catcode`\^^M = 5     % in case we're inside an example
@@ -7452,6 +8453,13 @@ end
   % If the image is by itself, center it.
   \ifvmode
     \imagevmodetrue
+  \else \ifx\centersub\centerV
+    % for @center @image, we need a vbox so we can have our vertical space
+    \imagevmodetrue
+    \vbox\bgroup % vbox has better behavior than vtop herev
+  \fi\fi
+  %
+  \ifimagevmode
     \nobreak\medskip
     % Usually we'll have text after the image which will insert
     % \parskip glue, so insert it here too to equalize the space
@@ -7461,9 +8469,13 @@ end
   \fi
   %
   % Leave vertical mode so that indentation from an enclosing
-  % environment such as @quotation is respected.  On the other hand, if
-  % it's at the top level, we don't want the normal paragraph indentation.
-  \noindent
+  %  environment such as @quotation is respected.
+  % However, if we're at the top level, we don't want the
+  %  normal paragraph indentation.
+  % On the other hand, if we are in the case of @center @image, we don't
+  %  want to start a paragraph, which will create a hsize-width box and
+  %  eradicate the centering.
+  \ifx\centersub\centerV\else \noindent \fi
   %
   % Output the image.
   \ifpdf
@@ -7475,7 +8487,10 @@ end
     \epsfbox{#1.eps}%
   \fi
   %
-  \ifimagevmode \medskip \fi  % space after the standalone image
+  \ifimagevmode
+    \medskip  % space after a standalone image
+  \fi  
+  \ifx\centersub\centerV \egroup \fi
 \endgroup}
 
 
@@ -7747,10 +8762,9 @@ end
 
 \message{localization,}
 
-% @documentlanguage is usually given very early, just after
-% @setfilename.  If done too late, it may not override everything
-% properly.  Single argument is the language (de) or locale (de_DE)
-% abbreviation.  It would be nice if we could set up a hyphenation file.
+% For single-language documents, @documentlanguage is usually given very
+% early, just after @documentencoding.  Single argument is the language
+% (de) or locale (de_DE) abbreviation.
 %
 {
   \catcode`\_ = \active
@@ -7763,31 +8777,60 @@ end
     \ifeof 1
       \documentlanguagetrywithoutunderscore{#1_\finish}%
     \else
+      \globaldefs = 1  % everything in the txi-LL files needs to persist
       \input txi-#1.tex
     \fi
     \closein 1
-  \endgroup
+  \endgroup % end raw TeX
 \endgroup}
-}
 %
 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
 % try txi-de.tex.
-% 
-\def\documentlanguagetrywithoutunderscore#1_#2\finish{%
+%
+\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
   \openin 1 txi-#1.tex
   \ifeof 1
     \errhelp = \nolanghelp
     \errmessage{Cannot read language file txi-#1.tex}%
   \else
+    \globaldefs = 1  % everything in the txi-LL files needs to persist
     \input txi-#1.tex
   \fi
   \closein 1
 }
+}% end of special _ catcode
 %
 \newhelp\nolanghelp{The given language definition file cannot be found or
-is empty.  Maybe you need to install it?  In the current directory
-should work if nowhere else does.}
+is empty.  Maybe you need to install it?  Putting it in the current
+directory should work if nowhere else does.}
+
+% This macro is called from txi-??.tex files; the first argument is the
+% \language name to set (without the "\lang@" prefix), the second and
+% third args are \{left,right}hyphenmin.
+%
+% The language names to pass are determined when the format is built.
+% See the etex.log file created at that time, e.g.,
+% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
+%
+% With TeX Live 2008, etex now includes hyphenation patterns for all
+% available languages.  This means we can support hyphenation in
+% Texinfo, at least to some extent.  (This still doesn't solve the
+% accented characters problem.)
+%
+\catcode`@=11
+\def\txisetlanguage#1#2#3{%
+  % do not set the language if the name is undefined in the current TeX.
+  \expandafter\ifx\csname lang@#1\endcsname \relax
+    \message{no patterns for #1}%
+  \else
+    \global\language = \csname lang@#1\endcsname
+  \fi
+  % but there is no harm in adjusting the hyphenmin values regardless.
+  \global\lefthyphenmin = #2\relax
+  \global\righthyphenmin = #3\relax
+}
 
+% Helpers for encodings.
 % Set the catcode of characters 128 through 255 to the specified number.
 %
 \def\setnonasciicharscatcode#1{%
@@ -7828,7 +8871,7 @@ should work if nowhere else does.}
      \setnonasciicharscatcode\active
      \lattwochardefs
   %
-  \else \ifx \declaredencoding \latone 
+  \else \ifx \declaredencoding \latone
      \setnonasciicharscatcode\active
      \latonechardefs
   %
@@ -7840,7 +8883,7 @@ should work if nowhere else does.}
      \setnonasciicharscatcode\active
      \utfeightchardefs
   %
-  \else 
+  \else
     \message{Unknown document encoding #1, ignoring.}%
   %
   \fi % utfeight
@@ -7852,7 +8895,7 @@ should work if nowhere else does.}
 
 % A message to be logged when using a character that isn't available
 % the default font encoding (OT1).
-% 
+%
 \def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}}
 
 % Take account of \c (plain) vs. \, (Texinfo) difference.
@@ -7865,21 +8908,21 @@ should work if nowhere else does.}
 %
 % Latin1 (ISO-8859-1) character definitions.
 \def\latonechardefs{%
-  \gdef^^a0{~} 
+  \gdef^^a0{\tie}
   \gdef^^a1{\exclamdown}
-  \gdef^^a2{\missingcharmsg{CENT SIGN}} 
+  \gdef^^a2{\missingcharmsg{CENT SIGN}}
   \gdef^^a3{{\pounds}}
   \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
   \gdef^^a5{\missingcharmsg{YEN SIGN}}
-  \gdef^^a6{\missingcharmsg{BROKEN BAR}} 
+  \gdef^^a6{\missingcharmsg{BROKEN BAR}}
   \gdef^^a7{\S}
-  \gdef^^a8{\"{}} 
-  \gdef^^a9{\copyright} 
+  \gdef^^a8{\"{}}
+  \gdef^^a9{\copyright}
   \gdef^^aa{\ordf}
-  \gdef^^ab{\missingcharmsg{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}} 
+  \gdef^^ab{\guillemetleft}
   \gdef^^ac{$\lnot$}
-  \gdef^^ad{\-} 
-  \gdef^^ae{\registeredsymbol} 
+  \gdef^^ad{\-}
+  \gdef^^ae{\registeredsymbol}
   \gdef^^af{\={}}
   %
   \gdef^^b0{\textdegree}
@@ -7895,7 +8938,7 @@ should work if nowhere else does.}
   \gdef^^b9{$^1$}
   \gdef^^ba{\ordm}
   %
-  \gdef^^bb{\missingcharmsg{RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK}}
+  \gdef^^bb{\guillemetright}
   \gdef^^bc{$1\over4$}
   \gdef^^bd{$1\over2$}
   \gdef^^be{$3\over4$}
@@ -7906,7 +8949,7 @@ should work if nowhere else does.}
   \gdef^^c2{\^A}
   \gdef^^c3{\~A}
   \gdef^^c4{\"A}
-  \gdef^^c5{\ringaccent A} 
+  \gdef^^c5{\ringaccent A}
   \gdef^^c6{\AE}
   \gdef^^c7{\cedilla C}
   \gdef^^c8{\`E}
@@ -7918,7 +8961,7 @@ should work if nowhere else does.}
   \gdef^^ce{\^I}
   \gdef^^cf{\"I}
   %
-  \gdef^^d0{\missingcharmsg{LATIN CAPITAL LETTER ETH}}
+  \gdef^^d0{\DH}
   \gdef^^d1{\~N}
   \gdef^^d2{\`O}
   \gdef^^d3{\'O}
@@ -7932,7 +8975,7 @@ should work if nowhere else does.}
   \gdef^^db{\^U}
   \gdef^^dc{\"U}
   \gdef^^dd{\'Y}
-  \gdef^^de{\missingcharmsg{LATIN CAPITAL LETTER THORN}}
+  \gdef^^de{\TH}
   \gdef^^df{\ss}
   %
   \gdef^^e0{\`a}
@@ -7952,7 +8995,7 @@ should work if nowhere else does.}
   \gdef^^ee{\^{\dotless i}}
   \gdef^^ef{\"{\dotless i}}
   %
-  \gdef^^f0{\missingcharmsg{LATIN SMALL LETTER ETH}}
+  \gdef^^f0{\dh}
   \gdef^^f1{\~n}
   \gdef^^f2{\`o}
   \gdef^^f3{\'o}
@@ -7966,7 +9009,7 @@ should work if nowhere else does.}
   \gdef^^fb{\^u}
   \gdef^^fc{\"u}
   \gdef^^fd{\'y}
-  \gdef^^fe{\missingcharmsg{LATIN SMALL LETTER THORN}}
+  \gdef^^fe{\th}
   \gdef^^ff{\"y}
 }
 
@@ -7987,8 +9030,8 @@ should work if nowhere else does.}
 
 % Latin2 (ISO-8859-2) character definitions.
 \def\lattwochardefs{%
-  \gdef^^a0{~}
-  \gdef^^a1{\missingcharmsg{LATIN CAPITAL LETTER A WITH OGONEK}}
+  \gdef^^a0{\tie}
+  \gdef^^a1{\ogonek{A}}
   \gdef^^a2{\u{}}
   \gdef^^a3{\L}
   \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
@@ -8005,8 +9048,8 @@ should work if nowhere else does.}
   \gdef^^af{\dotaccent Z}
   %
   \gdef^^b0{\textdegree}
-  \gdef^^b1{\missingcharmsg{LATIN SMALL LETTER A WITH OGONEK}}
-  \gdef^^b2{\missingcharmsg{OGONEK}}
+  \gdef^^b1{\ogonek{a}}
+  \gdef^^b2{\ogonek{ }}
   \gdef^^b3{\l}
   \gdef^^b4{\'{}}
   \gdef^^b5{\v l}
@@ -8031,14 +9074,14 @@ should work if nowhere else does.}
   \gdef^^c7{\cedilla C}
   \gdef^^c8{\v C}
   \gdef^^c9{\'E}
-  \gdef^^ca{\missingcharmsg{LATIN CAPITAL LETTER E WITH OGONEK}}
+  \gdef^^ca{\ogonek{E}}
   \gdef^^cb{\"E}
   \gdef^^cc{\v E}
   \gdef^^cd{\'I}
   \gdef^^ce{\^I}
   \gdef^^cf{\v D}
   %
-  \gdef^^d0{\missingcharmsg{LATIN CAPITAL LETTER D WITH STROKE}}
+  \gdef^^d0{\DH}
   \gdef^^d1{\'N}
   \gdef^^d2{\v N}
   \gdef^^d3{\'O}
@@ -8047,7 +9090,7 @@ should work if nowhere else does.}
   \gdef^^d6{\"O}
   \gdef^^d7{$\times$}
   \gdef^^d8{\v R}
-  \gdef^^d9{\ringaccent U} 
+  \gdef^^d9{\ringaccent U}
   \gdef^^da{\'U}
   \gdef^^db{\H U}
   \gdef^^dc{\"U}
@@ -8065,14 +9108,14 @@ should work if nowhere else does.}
   \gdef^^e7{\cedilla c}
   \gdef^^e8{\v c}
   \gdef^^e9{\'e}
-  \gdef^^ea{\missingcharmsg{LATIN SMALL LETTER E WITH OGONEK}}
+  \gdef^^ea{\ogonek{e}}
   \gdef^^eb{\"e}
   \gdef^^ec{\v e}
-  \gdef^^ed{\'\i}
-  \gdef^^ee{\^\i}
+  \gdef^^ed{\'{\dotless{i}}}
+  \gdef^^ee{\^{\dotless{i}}}
   \gdef^^ef{\v d}
   %
-  \gdef^^f0{\missingcharmsg{LATIN SMALL LETTER D WITH STROKE}}
+  \gdef^^f0{\dh}
   \gdef^^f1{\'n}
   \gdef^^f2{\v n}
   \gdef^^f3{\'o}
@@ -8091,11 +9134,11 @@ should work if nowhere else does.}
 }
 
 % UTF-8 character definitions.
-% 
+%
 % This code to support UTF-8 is based on LaTeX's utf8.def, with some
 % changes for Texinfo conventions.  It is included here under the GPL by
 % permission from Frank Mittelbach and the LaTeX team.
-% 
+%
 \newcount\countUTFx
 \newcount\countUTFy
 \newcount\countUTFz
@@ -8160,7 +9203,7 @@ should work if nowhere else does.}
 
   \gdef\DeclareUnicodeCharacter#1#2{%
     \countUTFz = "#1\relax
-    \wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
+    %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
     \begingroup
       \parseXMLCharref
       \def\UTFviiiTwoOctets##1##2{%
@@ -8245,6 +9288,7 @@ should work if nowhere else does.}
   \DeclareUnicodeCharacter{00CE}{\^I}
   \DeclareUnicodeCharacter{00CF}{\"I}
 
+  \DeclareUnicodeCharacter{00D0}{\DH}
   \DeclareUnicodeCharacter{00D1}{\~N}
   \DeclareUnicodeCharacter{00D2}{\`O}
   \DeclareUnicodeCharacter{00D3}{\'O}
@@ -8257,6 +9301,7 @@ should work if nowhere else does.}
   \DeclareUnicodeCharacter{00DB}{\^U}
   \DeclareUnicodeCharacter{00DC}{\"U}
   \DeclareUnicodeCharacter{00DD}{\'Y}
+  \DeclareUnicodeCharacter{00DE}{\TH}
   \DeclareUnicodeCharacter{00DF}{\ss}
 
   \DeclareUnicodeCharacter{00E0}{\`a}
@@ -8276,6 +9321,7 @@ should work if nowhere else does.}
   \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
   \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
 
+  \DeclareUnicodeCharacter{00F0}{\dh}
   \DeclareUnicodeCharacter{00F1}{\~n}
   \DeclareUnicodeCharacter{00F2}{\`o}
   \DeclareUnicodeCharacter{00F3}{\'o}
@@ -8288,16 +9334,21 @@ should work if nowhere else does.}
   \DeclareUnicodeCharacter{00FB}{\^u}
   \DeclareUnicodeCharacter{00FC}{\"u}
   \DeclareUnicodeCharacter{00FD}{\'y}
+  \DeclareUnicodeCharacter{00FE}{\th}
   \DeclareUnicodeCharacter{00FF}{\"y}
 
   \DeclareUnicodeCharacter{0100}{\=A}
   \DeclareUnicodeCharacter{0101}{\=a}
   \DeclareUnicodeCharacter{0102}{\u{A}}
   \DeclareUnicodeCharacter{0103}{\u{a}}
+  \DeclareUnicodeCharacter{0104}{\ogonek{A}}
+  \DeclareUnicodeCharacter{0105}{\ogonek{a}}
   \DeclareUnicodeCharacter{0106}{\'C}
   \DeclareUnicodeCharacter{0107}{\'c}
   \DeclareUnicodeCharacter{0108}{\^C}
   \DeclareUnicodeCharacter{0109}{\^c}
+  \DeclareUnicodeCharacter{0118}{\ogonek{E}}
+  \DeclareUnicodeCharacter{0119}{\ogonek{e}}
   \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
   \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
   \DeclareUnicodeCharacter{010C}{\v{C}}
@@ -8445,6 +9496,8 @@ should work if nowhere else does.}
   \DeclareUnicodeCharacter{0233}{\=y}
   \DeclareUnicodeCharacter{0237}{\dotless{j}}
 
+  \DeclareUnicodeCharacter{02DB}{\ogonek{ }}
+
   \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
   \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
   \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
@@ -8618,8 +9671,8 @@ should work if nowhere else does.}
 % Prevent underfull vbox error messages.
 \vbadness = 10000
 
-% Don't be so finicky about underfull hboxes, either.
-\hbadness = 2000
+% Don't be very finicky about underfull hboxes, either.
+\hbadness = 6666
 
 % Following George Bush, get rid of widows and orphans.
 \widowpenalty=10000
@@ -8826,25 +9879,21 @@ should work if nowhere else does.}
 
 \message{and turning on texinfo input format.}
 
+\def^^L{\par} % remove \outer, so ^L can appear in an @comment
+
+% DEL is a comment character, in case @c does not suffice.
+\catcode`\^^? = 14
+
 % Define macros to output various characters with catcode for normal text.
-\catcode`\"=\other
-\catcode`\~=\other
-\catcode`\^=\other
-\catcode`\_=\other
-\catcode`\|=\other
-\catcode`\<=\other
-\catcode`\>=\other
-\catcode`\+=\other
-\catcode`\$=\other
-\def\normaldoublequote{"}
-\def\normaltilde{~}
-\def\normalcaret{^}
-\def\normalunderscore{_}
-\def\normalverticalbar{|}
-\def\normalless{<}
-\def\normalgreater{>}
-\def\normalplus{+}
-\def\normaldollar{$}%$ font-lock fix
+\catcode`\"=\other \def\normaldoublequote{"}
+\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
+\catcode`\+=\other \def\normalplus{+}
+\catcode`\<=\other \def\normalless{<}
+\catcode`\>=\other \def\normalgreater{>}
+\catcode`\^=\other \def\normalcaret{^}
+\catcode`\_=\other \def\normalunderscore{_}
+\catcode`\|=\other \def\normalverticalbar{|}
+\catcode`\~=\other \def\normaltilde{~}
 
 % This macro is used to make a character print one way in \tt
 % (where it can probably be output as-is), and another way in other fonts,
@@ -8922,32 +9971,48 @@ should work if nowhere else does.}
 
 % In texinfo, backslash is an active character; it prints the backslash
 % in fixed width font.
-\catcode`\\=\active
-@def@normalbackslash{{@tt@backslashcurfont}}
+\catcode`\\=\active  % @ for escape char from now on.
+
+% The story here is that in math mode, the \char of \backslashcurfont
+% ends up printing the roman \ from the math symbol font (because \char
+% in math mode uses the \mathcode, and plain.tex sets
+% \mathcode`\\="026E).  It seems better for @backslashchar{} to always
+% print a typewriter backslash, hence we use an explicit \mathchar,
+% which is the decimal equivalent of "715c (class 7, e.g., use \fam;
+% ignored family value; char position "5C).  We can't use " for the
+% usual hex value because it has already been made active.
+@def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
+@let@backslashchar = @normalbackslash % @backslashchar{} is for user documents.
+
 % On startup, @fixbackslash assigns:
 %  @let \ = @normalbackslash
-
 % \rawbackslash defines an active \ to do \backslashcurfont.
 % \otherbackslash defines an active \ to be a literal `\' character with
-% catcode other.
+% catcode other.  We switch back and forth between these.
 @gdef@rawbackslash{@let\=@backslashcurfont}
 @gdef@otherbackslash{@let\=@realbackslash}
 
 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
-% the literal character `\'.
-% 
-@def@normalturnoffactive{%
-  @let\=@normalbackslash
-  @let"=@normaldoublequote
-  @let~=@normaltilde
-  @let^=@normalcaret
-  @let_=@normalunderscore
-  @let|=@normalverticalbar
-  @let<=@normalless
-  @let>=@normalgreater
-  @let+=@normalplus
-  @let$=@normaldollar %$ font-lock fix
-  @unsepspaces
+% the literal character `\'.  Also revert - to its normal character, in
+% case the active - from code has slipped in.
+%
+{@catcode`- = @active
+ @gdef@normalturnoffactive{%
+   @let-=@normaldash
+   @let"=@normaldoublequote
+   @let$=@normaldollar %$ font-lock fix
+   @let+=@normalplus
+   @let<=@normalless
+   @let>=@normalgreater
+   @let\=@normalbackslash
+   @let^=@normalcaret
+   @let_=@normalunderscore
+   @let|=@normalverticalbar
+   @let~=@normaltilde
+   @markupsetuplqdefault
+   @markupsetuprqdefault
+   @unsepspaces
+ }
 }
 
 % Make _ and + \other characters, temporarily.
@@ -8976,11 +10041,28 @@ should work if nowhere else does.}
 % Say @foo, not \foo, in error messages.
 @escapechar = `@@
 
-% These look ok in all fonts, so just make them not special.
-@catcode`@& = @other
-@catcode`@# = @other
-@catcode`@% = @other
+% These (along with & and #) are made active for url-breaking, so need
+% active definitions as the normal characters.
+@def@normaldot{.}
+@def@normalquest{?}
+@def@normalslash{/}
 
+% These look ok in all fonts, so just make them not special.
+% @hashchar{} gets its own user-level command, because of #line.
+@catcode`@& = @other @def@normalamp{&}
+@catcode`@# = @other @def@normalhash{#}
+@catcode`@% = @other @def@normalpercent{%}
+
+@let @hashchar = @normalhash
+
+@c Finally, make ` and ' active, so that txicodequoteundirected and
+@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}.  If we
+@c don't make ` and ' active, @code will not get them as active chars.
+@c Do this last of all since we use ` in the previous @catcode assignments.
+@catcode`@'=@active
+@catcode`@`=@active
+@markupsetuplqdefault
+@markupsetuprqdefault
 
 @c Local variables:
 @c eval: (add-hook 'write-file-hooks 'time-stamp)
index 5d81d9c6ebaa61bc085d9b8a628800c55f263728..3fbde2e7d4d57a789d46c400205e33e3e993eae2 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 30 September 2013
-@set UPDATED-MONTH September 2013
-@set EDITION 5.1.3
-@set VERSION 5.1.3
+@set UPDATED 24 March 2014
+@set UPDATED-MONTH March 2014
+@set EDITION 6.0.0
+@set VERSION 6.0.0
diff --git a/errno.c b/errno.c
index e5e160dbe2f3026df01ac13f9291293553647513..d3c02ef4b82e8a370bc9a10f1cbba7736e710576 100644 (file)
--- a/errno.c
+++ b/errno.c
@@ -9,17 +9,28 @@ Copyright 2000, 2001, 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
 #include "gmp.h"
index f81789a4bfca4249722fb05e027d116d75f78c71..a6e7bf946813af0649f456a7200c876dae7d0a8f 100644 (file)
@@ -1,22 +1,32 @@
 /* __gmp_extract_double -- convert from double to array of mp_limb_t.
 
-Copyright 1996, 1999, 2000, 2001, 2002, 2006, 2012 Free Software Foundation,
-Inc.
+Copyright 1996, 1999-2002, 2006, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 60cbd3f2fce55c21e109bbd5120d92b5533b89fa..4d4b0db8aceda483427fee7350535d25782092bb 100644 (file)
@@ -6,17 +6,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "bootstrap.c"
 
index 522e573eef33c1fc49403c157e7849cd0c9c4660..b1756a61173d309ac74506eec76dd33dcaaaaab5 100644 (file)
--- a/gen-fac.c
+++ b/gen-fac.c
@@ -1,21 +1,32 @@
 /* Generate data for combinatorics: fac_ui, bin_uiui, ...
 
-Copyright 2002, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2002, 2011-2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <stdlib.h>
@@ -25,9 +36,8 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 int
 mpz_remove_twos (mpz_t x)
 {
-  int r = 0;
-  for (;mpz_even_p (x);r++)
-    mpz_tdiv_q_2exp (x, x, 1);
+  mp_bitcnt_t r = mpz_scan1(x, 0);
+  mpz_tdiv_q_2exp (x, x, r);
   return r;
 }
 
@@ -75,8 +85,8 @@ gen_consts (int numb, int nail, int limb)
   for (b = 3;; b++)
     {
       for (a = b; (a & 1) == 0; a >>= 1);
-      mpz_set (last, x);
-      mpz_mul_ui (x, x, a);
+      mpz_swap (last, x);
+      mpz_mul_ui (x, last, a);
       if (mpz_sizeinbase (x, 2) > numb)
        break;
       printf ("),CNST_LIMB(0x");
@@ -91,7 +101,7 @@ gen_consts (int numb, int nail, int limb)
   ofl = b - 1;
   printf
     ("#define ODD_FACTORIAL_TABLE_LIMIT (%lu)\n", ofl);
-  mpz_init (mask);
+  mpz_init2 (mask, numb);
   mpz_setbit (mask, numb);
   mpz_sub_ui (mask, mask, 1);
   printf
@@ -130,8 +140,8 @@ gen_consts (int numb, int nail, int limb)
   mpz_set_ui (x, 1);
   for (b = 3;; b+=2)
     {
-      mpz_set (last, x);
-      mpz_mul_ui (x, x, b);
+      mpz_swap (last, x);
+      mpz_mul_ui (x, last, b);
       if (mpz_sizeinbase (x, 2) > numb)
        break;
       printf ("),CNST_LIMB(0x");
@@ -248,61 +258,6 @@ gen_consts (int numb, int nail, int limb)
     }
   printf ("\n");
 
-#if 0
-  mpz_set_ui (x, 1);
-  mpz_mul_2exp (x, x, limb + 1);       /* x=2^(limb+1)        */
-  mpz_init (y);
-  mpz_set_ui (y, 10000);
-  mpz_mul (x, x, y);           /* x=2^(limb+1)*10^4     */
-  mpz_set_ui (y, 27182);       /* exp(1)*10^4      */
-  mpz_tdiv_q (x, x, y);                /* x=2^(limb+1)/exp(1)        */
-  printf ("\n/* is 2^(GMP_LIMB_BITS+1)/exp(1) */\n");
-  printf ("#define FAC2OVERE CNST_LIMB(0x");
-  mpz_out_str (stdout, 16, x);
-  printf (")\n");
-
-
-  printf
-    ("\n/* FACMULn is largest odd x such that x*(x+2)*...*(x+2(n-1))<=2^GMP_NUMB_BITS-1 */\n\n");
-  mpz_init (z);
-  mpz_init (t);
-  for (a = 2; a <= 4; a++)
-    {
-      mpz_set_ui (x, 1);
-      mpz_mul_2exp (x, x, numb);
-      mpz_root (x, x, a);
-      /* so x is approx sol       */
-      if (mpz_even_p (x))
-       mpz_sub_ui (x, x, 1);
-      mpz_set_ui (y, 1);
-      mpz_mul_2exp (y, y, numb);
-      mpz_sub_ui (y, y, 1);
-      /* decrement x until we are <= real sol     */
-      do
-       {
-         mpz_sub_ui (x, x, 2);
-         odd_products (t, x, a);
-         if (mpz_cmp (t, y) <= 0)
-           break;
-       }
-      while (1);
-      /* increment x until > real sol     */
-      do
-       {
-         mpz_add_ui (x, x, 2);
-         odd_products (t, x, a);
-         if (mpz_cmp (t, y) > 0)
-           break;
-       }
-      while (1);
-      /* dec once to get real sol */
-      mpz_sub_ui (x, x, 2);
-      printf ("#define FACMUL%lu CNST_LIMB(0x", a);
-      mpz_out_str (stdout, 16, x);
-      printf (")\n");
-    }
-#endif
-
   return 0;
 }
 
index b6c77459237c21967476e7250754c1f82c40b010..d5f26019155c8d7c5cbd8e6768efedc200afe388 100644 (file)
--- a/gen-fib.c
+++ b/gen-fib.c
@@ -5,17 +5,28 @@ Copyright 2001, 2002, 2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 "bootstrap.c"
index a37ff228129d91782b27c6d09da613d8d672e88f..537994b3b27d1996e992fcdd2e732dc3920602e6 100644 (file)
@@ -1,23 +1,34 @@
 /* gen-jacobi.c
 
-   Contributed to the GNU project by Niels Möller.
+   Contributed to the GNU project by Niels Möller.
 
 Copyright 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* Generate the lookup table needed for fast left-to-right computation
    of the Jacobi symbol. */
index 513286c012334abbc3b319b3ec7c19ced125423c..31977cda1c2b5617d15faa532008c6e8b7deff18 100644 (file)
@@ -1,21 +1,32 @@
 /* Generate perfect square testing data.
 
-Copyright 2002, 2003, 2004, 2012 Free Software Foundation, Inc.
+Copyright 2002-2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <stdlib.h>
index d87265ec41c1cfe2aa8ae7a54817e6504163d955..75876660031c8e7681f3a3421852eac2e686ddaf 100644 (file)
@@ -2,22 +2,33 @@
 
    Contributed to the GNU project by Torbjorn Granlund.
 
-Copyright 2009, 2012 Free Software Foundation, Inc.
+Copyright 2009, 2012, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /*
   Generate tables for fast, division-free trial division for GMP.
@@ -98,7 +109,9 @@ main (int argc, char *argv[])
   omitted_p = 3;
   interval_end = 0;
 
-  printf ("static struct gmp_primes_dtab gmp_primes_dtab[] = {\n");
+/*  printf ("static struct gmp_primes_dtab gmp_primes_dtab[] = {\n"); */
+
+  printf ("#ifdef WANT_dtab\n");
 
   for (t = start_p; t <= end_p; t += 2)
     {
@@ -120,7 +133,7 @@ main (int argc, char *argv[])
              if (! isprime (p))
                continue;
 
-             printf ("  P(%d,", (int) p);
+             printf ("  P(%d,", (int) p);
              mpz_invert_ui_2exp (inv, p, limb_bits);
              printf ("CNST_LIMB(0x");  mpz_out_str (stdout, 16, inv);  printf ("),");
 
@@ -138,10 +151,12 @@ main (int argc, char *argv[])
        }
       interval_end = t;
     }
-  printf ("  P(0,0,0)\n};\n");
+  printf ("#define SMALLEST_OMITTED_PRIME %d\n", (int) omitted_p);
+  printf ("#endif\n");
 
+  printf ("#ifdef WANT_ptab\n");
 
-  printf ("static struct gmp_primes_ptab gmp_primes_ptab[] = {\n");
+/*  printf ("static struct gmp_primes_ptab gmp_primes_ptab[] = {\n"); */
 
   endtok = "";
 
@@ -193,9 +208,9 @@ main (int argc, char *argv[])
       interval_end = t;
       np++;
     }
-  printf ("\n};\n");
 
-  printf ("#define SMALLEST_OMITTED_PRIME %d\n", (int) omitted_p);
+  printf ("\n");
+  printf ("#endif\n");
 
   return 0;
 }
index 7deb67ad49755c3a98b23201be0b7adbce02baa0..32f63d9a08e2e3eb3ad1f97580d144af038cd85f 100644 (file)
--- a/gmp-h.in
+++ b/gmp-h.in
@@ -1,23 +1,32 @@
 /* Definitions for GNU multiple precision functions.   -*- mode: c -*-
 
-Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
-2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free
-Software Foundation, Inc.
+Copyright 1991, 1993-1997, 1999-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #ifndef __GMP_H__
 
@@ -46,13 +55,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #ifndef __GNU_MP__
 #define __GNU_MP__ 5
 
-#define __need_size_t  /* tell gcc stddef.h we only want size_t */
-#if defined (__cplusplus)
-#include <cstddef>     /* for size_t */
-#else
 #include <stddef.h>    /* for size_t */
-#endif
-#undef __need_size_t
 
 /* Instantiated by configure. */
 #if ! defined (__GMP_WITHIN_CONFIGURE)
@@ -276,16 +279,14 @@ typedef __mpq_struct *mpq_ptr;
 #define _GMP_H_HAVE_OBSTACK 1
 #endif
 
-/* The prototypes for gmp_vprintf etc are provided only if va_list is
-   available, via an application having included <stdarg.h> or <varargs.h>.
-   Usually va_list is a typedef so can't be tested directly, but C99
-   specifies that va_start is a macro (and it was normally a macro on past
-   systems too), so look for that.
+/* The prototypes for gmp_vprintf etc are provided only if va_list is defined,
+   via an application having included <stdarg.h>.  Usually va_list is a typedef
+   so can't be tested directly, but C99 specifies that va_start is a macro.
 
    <stdio.h> will define some sort of va_list for vprintf and vfprintf, but
    let's not bother trying to use that since it's not standard and since
    application uses for gmp_vprintf etc will almost certainly require the
-   whole <stdarg.h> or <varargs.h> anyway.  */
+   whole <stdarg.h> anyway.  */
 
 #ifdef va_start
 #define _GMP_H_HAVE_VA_LIST 1
@@ -445,10 +446,10 @@ typedef __mpq_struct *mpq_ptr;
 #define __GMP_MAX(h,i) ((h) > (i) ? (h) : (i))
 
 /* __GMP_USHRT_MAX is not "~ (unsigned short) 0" because short is promoted
-   to int by "~".  */
+   to int by "~". It still needs to have the promoted type.  */
 #define __GMP_UINT_MAX   (~ (unsigned) 0)
 #define __GMP_ULONG_MAX  (~ (unsigned long) 0)
-#define __GMP_USHRT_MAX  ((unsigned short) ~0)
+#define __GMP_USHRT_MAX  (0 + (unsigned short) ~0)
 
 
 /* __builtin_expect is in gcc 3.0, and not in 2.95. */
@@ -484,8 +485,8 @@ __GMP_DECLSPEC void mp_set_memory_functions (void *(*) (size_t),
 
 #define mp_get_memory_functions __gmp_get_memory_functions
 __GMP_DECLSPEC void mp_get_memory_functions (void *(**) (size_t),
-                                      void *(**) (void *, size_t, size_t),
-                                      void (**) (void *, size_t)) __GMP_NOTHROW;
+                                     void *(**) (void *, size_t, size_t),
+                                     void (**) (void *, size_t)) __GMP_NOTHROW;
 
 #define mp_bits_per_limb __gmp_bits_per_limb
 __GMP_DECLSPEC extern const int mp_bits_per_limb;
@@ -1117,6 +1118,22 @@ __GMP_DECLSPEC void mpz_urandomm (mpz_ptr, gmp_randstate_t, mpz_srcptr);
 #define mpz_eor __gmpz_xor
 __GMP_DECLSPEC void mpz_xor (mpz_ptr, mpz_srcptr, mpz_srcptr);
 
+#define mpz_limbs_read __gmpz_limbs_read
+__GMP_DECLSPEC mp_srcptr mpz_limbs_read (mpz_srcptr);
+
+#define mpz_limbs_write __gmpz_limbs_write
+__GMP_DECLSPEC mp_ptr mpz_limbs_write (mpz_ptr, mp_size_t);
+
+#define mpz_limbs_modify __gmpz_limbs_modify
+__GMP_DECLSPEC mp_ptr mpz_limbs_modify (mpz_ptr, mp_size_t);
+
+#define mpz_limbs_finish __gmpz_limbs_finish
+__GMP_DECLSPEC void mpz_limbs_finish (mpz_ptr, mp_size_t);
+
+#define mpz_roinit_n __gmpz_roinit_n
+__GMP_DECLSPEC mpz_srcptr mpz_roinit_n (mpz_ptr, mp_srcptr, mp_size_t);
+
+#define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }}
 
 /**************** Rational (i.e. Q) routines.  ****************/
 
@@ -1481,6 +1498,9 @@ __GMP_DECLSPEC mp_limb_t mpn_divrem_1 (mp_ptr, mp_size_t, mp_srcptr, mp_size_t,
 #define mpn_divrem_2 __MPN(divrem_2)
 __GMP_DECLSPEC mp_limb_t mpn_divrem_2 (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr);
 
+#define mpn_div_qr_1 __MPN(div_qr_1)
+__GMP_DECLSPEC mp_limb_t mpn_div_qr_1 (mp_ptr, mp_limb_t *, mp_srcptr, mp_size_t, mp_limb_t);
+
 #define mpn_div_qr_2 __MPN(div_qr_2)
 __GMP_DECLSPEC mp_limb_t mpn_div_qr_2 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
 
@@ -1564,6 +1584,9 @@ __GMP_DECLSPEC mp_bitcnt_t mpn_scan1 (mp_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PU
 #define mpn_set_str __MPN(set_str)
 __GMP_DECLSPEC mp_size_t mpn_set_str (mp_ptr, const unsigned char *, size_t, int);
 
+#define mpn_sizeinbase __MPN(sizeinbase)
+__GMP_DECLSPEC size_t mpn_sizeinbase (mp_srcptr, mp_size_t, int);
+
 #define mpn_sqrtrem __MPN(sqrtrem)
 __GMP_DECLSPEC mp_size_t mpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t);
 
@@ -1610,6 +1633,54 @@ __GMP_DECLSPEC void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
 #define mpn_zero __MPN(zero)
 __GMP_DECLSPEC void mpn_zero (mp_ptr, mp_size_t);
 
+#define mpn_cnd_add_n __MPN(cnd_add_n)
+__GMP_DECLSPEC mp_limb_t mpn_cnd_add_n (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+#define mpn_cnd_sub_n __MPN(cnd_sub_n)
+__GMP_DECLSPEC mp_limb_t mpn_cnd_sub_n (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+
+#define mpn_sec_add_1 __MPN(sec_add_1)
+__GMP_DECLSPEC mp_limb_t mpn_sec_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
+#define mpn_sec_add_1_itch __MPN(sec_add_1_itch)
+__GMP_DECLSPEC mp_size_t mpn_sec_add_1_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
+
+#define mpn_sec_sub_1 __MPN(sec_sub_1)
+__GMP_DECLSPEC mp_limb_t mpn_sec_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
+#define mpn_sec_sub_1_itch __MPN(sec_sub_1_itch)
+__GMP_DECLSPEC mp_size_t mpn_sec_sub_1_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
+
+#define mpn_sec_mul __MPN(sec_mul)
+__GMP_DECLSPEC void mpn_sec_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
+#define mpn_sec_mul_itch __MPN(sec_mul_itch)
+__GMP_DECLSPEC mp_size_t mpn_sec_mul_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
+
+#define mpn_sec_sqr __MPN(sec_sqr)
+__GMP_DECLSPEC void mpn_sec_sqr (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
+#define mpn_sec_sqr_itch __MPN(sec_sqr_itch)
+__GMP_DECLSPEC mp_size_t mpn_sec_sqr_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
+
+#define mpn_sec_powm __MPN(sec_powm)
+__GMP_DECLSPEC void mpn_sec_powm (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_bitcnt_t, mp_srcptr, mp_size_t, mp_ptr);
+#define mpn_sec_powm_itch __MPN(sec_powm_itch)
+__GMP_DECLSPEC mp_size_t mpn_sec_powm_itch (mp_size_t, mp_bitcnt_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
+
+#define mpn_sec_tabselect __MPN(sec_tabselect)
+__GMP_DECLSPEC void mpn_sec_tabselect (volatile mp_limb_t *, volatile const mp_limb_t *, mp_size_t, mp_size_t, mp_size_t);
+
+#define mpn_sec_div_qr __MPN(sec_div_qr)
+__GMP_DECLSPEC mp_limb_t mpn_sec_div_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
+#define mpn_sec_div_qr_itch __MPN(sec_div_qr_itch)
+__GMP_DECLSPEC mp_size_t mpn_sec_div_qr_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
+#define mpn_sec_div_r __MPN(sec_div_r)
+__GMP_DECLSPEC void mpn_sec_div_r (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
+#define mpn_sec_div_r_itch __MPN(sec_div_r_itch)
+__GMP_DECLSPEC mp_size_t mpn_sec_div_r_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
+
+#define mpn_sec_invert __MPN(sec_invert)
+__GMP_DECLSPEC int mpn_sec_invert (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_bitcnt_t, mp_ptr);
+#define mpn_sec_invert_itch __MPN(sec_invert_itch)
+__GMP_DECLSPEC mp_size_t mpn_sec_invert_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
+
+
 /**************** mpz inlines ****************/
 
 /* The following are provided as inlines where possible, but always exist as
@@ -2145,17 +2216,18 @@ mpn_neg (mp_ptr __gmp_rp, mp_srcptr __gmp_up, mp_size_t __gmp_n)
 #define mpz_cmp_ui(Z,UI) \
   (__builtin_constant_p (UI) && (UI) == 0                              \
    ? mpz_sgn (Z) : _mpz_cmp_ui (Z,UI))
-#define mpz_cmp_si(Z,SI) \
-  (__builtin_constant_p (SI) && (SI) == 0 ? mpz_sgn (Z)                        \
-   : __builtin_constant_p (SI) && (SI) > 0                             \
-    ? _mpz_cmp_ui (Z, __GMP_CAST (unsigned long int, SI))              \
+#define mpz_cmp_si(Z,SI)                                               \
+  (__builtin_constant_p ((SI) >= 0) && (SI) >= 0                       \
+   ? mpz_cmp_ui (Z, __GMP_CAST (unsigned long, SI))                    \
    : _mpz_cmp_si (Z,SI))
-#define mpq_cmp_ui(Q,NUI,DUI) \
-  (__builtin_constant_p (NUI) && (NUI) == 0                            \
-   ? mpq_sgn (Q) : _mpq_cmp_ui (Q,NUI,DUI))
-#define mpq_cmp_si(q,n,d)                       \
-  (__builtin_constant_p ((n) >= 0) && (n) >= 0  \
-   ? mpq_cmp_ui (q, __GMP_CAST (unsigned long, n), d) \
+#define mpq_cmp_ui(Q,NUI,DUI)                                  \
+  (__builtin_constant_p (NUI) && (NUI) == 0 ? mpq_sgn (Q)      \
+   : __builtin_constant_p ((NUI) == (DUI)) && (NUI) == (DUI)   \
+   ? mpz_cmp (mpq_numref (Q), mpq_denref (Q))                  \
+   : _mpq_cmp_ui (Q,NUI,DUI))
+#define mpq_cmp_si(q,n,d)                              \
+  (__builtin_constant_p ((n) >= 0) && (n) >= 0         \
+   ? mpq_cmp_ui (q, __GMP_CAST (unsigned long, n), d)  \
    : _mpq_cmp_si (q, n, d))
 #else
 #define mpz_cmp_ui(Z,UI) _mpz_cmp_ui (Z,UI)
@@ -2220,9 +2292,9 @@ enum
 #define __GMP_CFLAGS "@CFLAGS@"
 
 /* Major version number is the value of __GNU_MP__ too, above and in mp.h. */
-#define __GNU_MP_VERSION            5
-#define __GNU_MP_VERSION_MINOR      1
-#define __GNU_MP_VERSION_PATCHLEVEL 3
+#define __GNU_MP_VERSION            6
+#define __GNU_MP_VERSION_MINOR      0
+#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__
index 24cfc0631e95b66c646bdd3ebd9ce772e46dc711..dc4e084a723d9544e4cd82575361a81c75ce507d 100644 (file)
@@ -3,24 +3,33 @@
    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, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
-2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software
-Foundation, Inc.
+Copyright 1991, 1993-1997, 1999-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /* __GMP_DECLSPEC must be given on any global data that will be accessed
@@ -38,9 +47,9 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #include <intrinsics.h>  /* for _popcnt */
 #endif
 
-/* limits.h is not used in general, since it's an ANSI-ism, and since on
-   solaris gcc 2.95 under -mcpu=ultrasparc in ABI=32 ends up getting wrong
-   values (the ABI=64 values).
+/* For INT_MAX, etc. We used to avoid it because of a bug (on solaris,
+   gcc 2.95 under -mcpu=ultrasparc in ABI=32 ends up getting wrong
+   values (the ABI=64 values)), but it should be safe now.
 
    On Cray vector systems, however, we need the system limits.h since sizes
    of signed and unsigned types can differ there, depending on compiler
@@ -48,9 +57,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
    reference, int can be 46 or 64 bits, whereas uint is always 64 bits; and
    short can be 24, 32, 46 or 64 bits, and different for ushort.  */
 
-#if defined _CRAY
 #include <limits.h>
-#endif
 
 /* For fat.h and other fat binary stuff.
    No need for __GMP_ATTRIBUTE_PURE or __GMP_NOTHROW, since functions
@@ -68,6 +75,10 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
   __GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr)
 #define DECL_bdiv_dbm1c(name) \
   __GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)
+#define DECL_cnd_add_n(name) \
+  __GMP_DECLSPEC mp_limb_t name (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)
+#define DECL_cnd_sub_n(name) \
+  __GMP_DECLSPEC mp_limb_t name (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)
 #define DECL_com(name) \
   __GMP_DECLSPEC void name (mp_ptr, mp_srcptr, mp_size_t)
 #define DECL_copyd(name) \
@@ -89,7 +100,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #define DECL_mod_1(name) \
   __GMP_DECLSPEC mp_limb_t name (mp_srcptr, mp_size_t, mp_limb_t)
 #define DECL_mod_1_1p(name) \
-  __GMP_DECLSPEC mp_limb_t name (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [])
+  __GMP_DECLSPEC mp_limb_t name (mp_srcptr, mp_size_t, mp_limb_t, const mp_limb_t [])
 #define DECL_mod_1_1p_cps(name) \
   __GMP_DECLSPEC void name (mp_limb_t cps[], mp_limb_t b)
 #define DECL_mod_1s_2p(name) \
@@ -206,10 +217,9 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
 /* if not provided by gmp-mparam.h */
-#ifndef BYTES_PER_MP_LIMB
-#define BYTES_PER_MP_LIMB  SIZEOF_MP_LIMB_T
+#ifndef GMP_LIMB_BYTES
+#define GMP_LIMB_BYTES  SIZEOF_MP_LIMB_T
 #endif
-#define GMP_LIMB_BYTES  BYTES_PER_MP_LIMB
 #ifndef GMP_LIMB_BITS
 #define GMP_LIMB_BITS  (8 * SIZEOF_MP_LIMB_T)
 #endif
@@ -506,7 +516,8 @@ __GMP_DECLSPEC void  __gmp_tmp_debug_free (const char *, int, int,
 #define UNLIKELY(cond)                 __GMP_UNLIKELY(cond)
 
 #define ABS(x) ((x) >= 0 ? (x) : -(x))
-#define ABS_CAST(T,x) ((x) >= 0 ? (T)(x) : -((T)((x) + 1) - 1))
+#define NEG_CAST(T,x) (- (__GMP_CAST (T, (x) + 1) - 1))
+#define ABS_CAST(T,x) ((x) >= 0 ? __GMP_CAST (T, x) : NEG_CAST (T,x))
 #undef MIN
 #define MIN(l,o) ((l) < (o) ? (l) : (o))
 #undef MAX
@@ -541,7 +552,9 @@ __GMP_DECLSPEC void  __gmp_tmp_debug_free (const char *, int, int,
 
    #ifndef's are used since on some systems (HP?) header files other than
    limits.h setup these defines.  We could forcibly #undef in that case, but
-   there seems no need to worry about that.  */
+   there seems no need to worry about that.
+
+   Now that we include <limits.h> we should be able to remove all this.  */
 
 #ifndef ULONG_MAX
 #define ULONG_MAX   __GMP_ULONG_MAX
@@ -559,7 +572,7 @@ __GMP_DECLSPEC void  __gmp_tmp_debug_free (const char *, int, int,
    treats the plain decimal values in <limits.h> as signed.  */
 #define ULONG_HIGHBIT      (ULONG_MAX ^ ((unsigned long) ULONG_MAX >> 1))
 #define UINT_HIGHBIT       (UINT_MAX ^ ((unsigned) UINT_MAX >> 1))
-#define USHRT_HIGHBIT      ((unsigned short) (USHRT_MAX ^ ((unsigned short) USHRT_MAX >> 1)))
+#define USHRT_HIGHBIT      (USHRT_MAX ^ ((unsigned short) USHRT_MAX >> 1))
 #define GMP_LIMB_HIGHBIT  (MP_LIMB_T_MAX ^ (MP_LIMB_T_MAX >> 1))
 
 #ifndef LONG_MIN
@@ -577,10 +590,10 @@ __GMP_DECLSPEC void  __gmp_tmp_debug_free (const char *, int, int,
 #endif
 
 #ifndef SHRT_MIN
-#define SHRT_MIN           ((short) USHRT_HIGHBIT)
+#define SHRT_MIN           ((int) (short) USHRT_HIGHBIT)
 #endif
 #ifndef SHRT_MAX
-#define SHRT_MAX           ((short) (-(SHRT_MIN+1)))
+#define SHRT_MAX           (-(SHRT_MIN+1))
 #endif
 
 #if __GMP_MP_SIZE_T_INT
@@ -1090,9 +1103,6 @@ __GMP_DECLSPEC void mpn_mullo_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
 __GMP_DECLSPEC void mpn_mullo_basecase (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
 #endif
 
-#define mpn_sqr __MPN(sqr)
-__GMP_DECLSPEC void mpn_sqr (mp_ptr, mp_srcptr, mp_size_t);
-
 #ifndef mpn_sqr_basecase  /* if not done with cpuvec in a fat binary */
 #define mpn_sqr_basecase __MPN(sqr_basecase)
 __GMP_DECLSPEC void mpn_sqr_basecase (mp_ptr, mp_srcptr, mp_size_t);
@@ -1130,7 +1140,7 @@ __GMP_DECLSPEC void mpn_mod_1_1p_cps (mp_limb_t [4], mp_limb_t);
 #endif
 #ifndef mpn_mod_1_1p  /* if not done with cpuvec in a fat binary */
 #define mpn_mod_1_1p __MPN(mod_1_1p)
-__GMP_DECLSPEC mp_limb_t mpn_mod_1_1p (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [4]) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC mp_limb_t mpn_mod_1_1p (mp_srcptr, mp_size_t, mp_limb_t, const mp_limb_t [4]) __GMP_ATTRIBUTE_PURE;
 #endif
 
 #ifndef mpn_mod_1s_2p_cps  /* if not done with cpuvec in a fat binary */
@@ -1139,7 +1149,7 @@ __GMP_DECLSPEC void mpn_mod_1s_2p_cps (mp_limb_t [5], mp_limb_t);
 #endif
 #ifndef mpn_mod_1s_2p  /* if not done with cpuvec in a fat binary */
 #define mpn_mod_1s_2p __MPN(mod_1s_2p)
-__GMP_DECLSPEC mp_limb_t mpn_mod_1s_2p (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [5]) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC mp_limb_t mpn_mod_1s_2p (mp_srcptr, mp_size_t, mp_limb_t, const mp_limb_t [5]) __GMP_ATTRIBUTE_PURE;
 #endif
 
 #ifndef mpn_mod_1s_3p_cps  /* if not done with cpuvec in a fat binary */
@@ -1148,7 +1158,7 @@ __GMP_DECLSPEC void mpn_mod_1s_3p_cps (mp_limb_t [6], mp_limb_t);
 #endif
 #ifndef mpn_mod_1s_3p  /* if not done with cpuvec in a fat binary */
 #define mpn_mod_1s_3p __MPN(mod_1s_3p)
-__GMP_DECLSPEC mp_limb_t mpn_mod_1s_3p (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [6]) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC mp_limb_t mpn_mod_1s_3p (mp_srcptr, mp_size_t, mp_limb_t, const mp_limb_t [6]) __GMP_ATTRIBUTE_PURE;
 #endif
 
 #ifndef mpn_mod_1s_4p_cps  /* if not done with cpuvec in a fat binary */
@@ -1157,7 +1167,7 @@ __GMP_DECLSPEC void mpn_mod_1s_4p_cps (mp_limb_t [7], mp_limb_t);
 #endif
 #ifndef mpn_mod_1s_4p  /* if not done with cpuvec in a fat binary */
 #define mpn_mod_1s_4p __MPN(mod_1s_4p)
-__GMP_DECLSPEC mp_limb_t mpn_mod_1s_4p (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [7]) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC mp_limb_t mpn_mod_1s_4p (mp_srcptr, mp_size_t, mp_limb_t, const mp_limb_t [7]) __GMP_ATTRIBUTE_PURE;
 #endif
 
 #define mpn_bc_mulmod_bnm1 __MPN(bc_mulmod_bnm1)
@@ -1411,6 +1421,9 @@ __GMP_DECLSPEC void      mpn_nussbaumer_mul (mp_ptr, mp_srcptr, mp_size_t, mp_sr
 #define   mpn_fft_next_size __MPN(fft_next_size)
 __GMP_DECLSPEC mp_size_t mpn_fft_next_size (mp_size_t, int) ATTRIBUTE_CONST;
 
+#define   mpn_div_qr_1n_pi1 __MPN(div_qr_1n_pi1)
+  __GMP_DECLSPEC mp_limb_t mpn_div_qr_1n_pi1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t);
+
 #define   mpn_div_qr_2n_pi1 __MPN(div_qr_2n_pi1)
   __GMP_DECLSPEC mp_limb_t mpn_div_qr_2n_pi1 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t);
 
@@ -1442,19 +1455,19 @@ __GMP_DECLSPEC mp_limb_t mpn_dcpi1_divappr_q_n (mp_ptr, mp_ptr, mp_srcptr, mp_si
 #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);
+__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);
 #define   mpn_preinv_mu_div_qr_itch __MPN(preinv_mu_div_qr_itch)
-__GMP_DECLSPEC mp_size_t mpn_preinv_mu_div_qr_itch (mp_size_t, mp_size_t, mp_size_t);
+__GMP_DECLSPEC mp_size_t mpn_preinv_mu_div_qr_itch (mp_size_t, mp_size_t, mp_size_t) ATTRIBUTE_CONST;
 
 #define   mpn_mu_divappr_q __MPN(mu_divappr_q)
 __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);
+__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);
 
@@ -1464,7 +1477,7 @@ __GMP_DECLSPEC mp_limb_t mpn_preinv_mu_divappr_q (mp_ptr, mp_srcptr, mp_size_t,
 #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);
 #define   mpn_mu_div_q_itch __MPN(mu_div_q_itch)
-__GMP_DECLSPEC mp_size_t mpn_mu_div_q_itch (mp_size_t, mp_size_t, int);
+__GMP_DECLSPEC mp_size_t mpn_mu_div_q_itch (mp_size_t, mp_size_t, int) ATTRIBUTE_CONST;
 
 #define  mpn_div_q __MPN(div_q)
 __GMP_DECLSPEC void mpn_div_q (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
@@ -1482,7 +1495,7 @@ __GMP_DECLSPEC mp_limb_t mpn_invertappr (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
 #define   mpn_binvert __MPN(binvert)
 __GMP_DECLSPEC void      mpn_binvert (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
 #define   mpn_binvert_itch __MPN(binvert_itch)
-__GMP_DECLSPEC mp_size_t mpn_binvert_itch (mp_size_t);
+__GMP_DECLSPEC mp_size_t mpn_binvert_itch (mp_size_t) ATTRIBUTE_CONST;
 
 #define mpn_bdiv_q_1 __MPN(bdiv_q_1)
 __GMP_DECLSPEC mp_limb_t mpn_bdiv_q_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
@@ -1499,42 +1512,42 @@ __GMP_DECLSPEC void      mpn_sbpi1_bdiv_q (mp_ptr, mp_ptr, mp_size_t, mp_srcptr,
 #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)
-__GMP_DECLSPEC mp_size_t mpn_dcpi1_bdiv_qr_n_itch (mp_size_t);
+__GMP_DECLSPEC mp_size_t mpn_dcpi1_bdiv_qr_n_itch (mp_size_t) ATTRIBUTE_CONST;
 
 #define   mpn_dcpi1_bdiv_qr_n __MPN(dcpi1_bdiv_qr_n)
 __GMP_DECLSPEC mp_limb_t mpn_dcpi1_bdiv_qr_n (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
 #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_itch __MPN(dcpi1_bdiv_q_n_itch)
-__GMP_DECLSPEC mp_size_t mpn_dcpi1_bdiv_q_n_itch (mp_size_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)
-__GMP_DECLSPEC mp_size_t mpn_mu_bdiv_qr_itch (mp_size_t, mp_size_t);
+__GMP_DECLSPEC mp_size_t mpn_mu_bdiv_qr_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
 
 #define   mpn_mu_bdiv_q __MPN(mu_bdiv_q)
 __GMP_DECLSPEC void      mpn_mu_bdiv_q (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
 #define   mpn_mu_bdiv_q_itch __MPN(mu_bdiv_q_itch)
-__GMP_DECLSPEC mp_size_t mpn_mu_bdiv_q_itch (mp_size_t, mp_size_t);
+__GMP_DECLSPEC mp_size_t mpn_mu_bdiv_q_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
 
 #define   mpn_bdiv_qr __MPN(bdiv_qr)
 __GMP_DECLSPEC mp_limb_t mpn_bdiv_qr (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
 #define   mpn_bdiv_qr_itch __MPN(bdiv_qr_itch)
-__GMP_DECLSPEC mp_size_t mpn_bdiv_qr_itch (mp_size_t, mp_size_t);
+__GMP_DECLSPEC mp_size_t mpn_bdiv_qr_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
 
 #define   mpn_bdiv_q __MPN(bdiv_q)
 __GMP_DECLSPEC void      mpn_bdiv_q (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
 #define   mpn_bdiv_q_itch __MPN(bdiv_q_itch)
-__GMP_DECLSPEC mp_size_t mpn_bdiv_q_itch (mp_size_t, mp_size_t);
+__GMP_DECLSPEC mp_size_t mpn_bdiv_q_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
 
 #define   mpn_divexact __MPN(divexact)
 __GMP_DECLSPEC void      mpn_divexact (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
 #define   mpn_divexact_itch __MPN(divexact_itch)
-__GMP_DECLSPEC mp_size_t mpn_divexact_itch (mp_size_t, mp_size_t);
+__GMP_DECLSPEC mp_size_t mpn_divexact_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
 
 #ifndef mpn_bdiv_dbm1c  /* if not done with cpuvec in a fat binary */
 #define   mpn_bdiv_dbm1c __MPN(bdiv_dbm1c)
@@ -1548,25 +1561,53 @@ __GMP_DECLSPEC mp_limb_t mpn_bdiv_dbm1c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t
 __GMP_DECLSPEC void      mpn_powm (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
 #define   mpn_powlo __MPN(powlo)
 __GMP_DECLSPEC void      mpn_powlo (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_size_t, mp_ptr);
-#define   mpn_powm_sec __MPN(powm_sec)
-__GMP_DECLSPEC void      mpn_powm_sec (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-#define   mpn_powm_sec_itch __MPN(powm_sec_itch)
-__GMP_DECLSPEC mp_size_t mpn_powm_sec_itch (mp_size_t, mp_size_t, mp_size_t);
-#define   mpn_tabselect __MPN(tabselect)
-__GMP_DECLSPEC void      mpn_tabselect (volatile mp_limb_t *, volatile mp_limb_t *, mp_size_t, mp_size_t, mp_size_t);
-#define   mpn_addcnd_n __MPN(addcnd_n)
-__GMP_DECLSPEC mp_limb_t mpn_addcnd_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-#define   mpn_subcnd_n __MPN(subcnd_n)
-__GMP_DECLSPEC mp_limb_t mpn_subcnd_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_sb_div_qr_sec __MPN(sb_div_qr_sec)
-__GMP_DECLSPEC void mpn_sb_div_qr_sec (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-#define mpn_sbpi1_div_qr_sec __MPN(sbpi1_div_qr_sec)
-__GMP_DECLSPEC mp_limb_t mpn_sbpi1_div_qr_sec (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
-#define mpn_sb_div_r_sec __MPN(sb_div_r_sec)
-__GMP_DECLSPEC void mpn_sb_div_r_sec (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-#define mpn_sbpi1_div_r_sec __MPN(sbpi1_div_r_sec)
-__GMP_DECLSPEC void mpn_sbpi1_div_r_sec (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
+
+#define mpn_sec_pi1_div_qr __MPN(sec_pi1_div_qr)
+__GMP_DECLSPEC mp_limb_t mpn_sec_pi1_div_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
+#define mpn_sec_pi1_div_r __MPN(sec_pi1_div_r)
+__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
@@ -2983,7 +3024,7 @@ __GMP_DECLSPEC mp_limb_t mpn_invert_limb (mp_limb_t) ATTRIBUTE_CONST;
   } while (0)
 
 
-/* udiv_qrnnd_preinv -- Based on work by Niels Möller and Torbjörn Granlund.
+/* udiv_qrnnd_preinv -- Based on work by Niels Möller and Torbjörn Granlund.
    We write things strangely below, to help gcc.  A more straightforward
    version:
        _r = (nl) - _qh * (d);
@@ -3450,7 +3491,7 @@ __GMP_DECLSPEC extern const unsigned char  binvert_limb_table[128];
     mp_limb_t  __bswapl_src = (src);                                   \
     mp_limb_t  __dstl = 0;                                             \
     int               __i;                                                     \
-    for (__i = 0; __i < BYTES_PER_MP_LIMB; __i++)                      \
+    for (__i = 0; __i < GMP_LIMB_BYTES; __i++)                 \
       {                                                                        \
        __dstl = (__dstl << 8) | (__bswapl_src & 0xFF);                 \
        __bswapl_src >>= 8;                                             \
@@ -4083,7 +4124,7 @@ __GMP_DECLSPEC void      mpn_matrix22_mul (mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_si
 #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);
+__GMP_DECLSPEC mp_size_t mpn_matrix22_mul_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
 
 #ifndef MATRIX22_STRASSEN_THRESHOLD
 #define MATRIX22_STRASSEN_THRESHOLD 30
@@ -4163,16 +4204,16 @@ __GMP_DECLSPEC mp_size_t mpn_hgcd_step (mp_size_t, mp_ptr, mp_ptr, mp_size_t, st
 __GMP_DECLSPEC mp_size_t mpn_hgcd_reduce (struct hgcd_matrix *, mp_ptr, mp_ptr, mp_size_t, mp_size_t, mp_ptr);
 
 #define mpn_hgcd_reduce_itch __MPN(hgcd_reduce_itch)
-__GMP_DECLSPEC mp_size_t mpn_hgcd_reduce_itch (mp_size_t, mp_size_t);
+__GMP_DECLSPEC mp_size_t mpn_hgcd_reduce_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
 
 #define mpn_hgcd_itch __MPN (hgcd_itch)
-__GMP_DECLSPEC mp_size_t mpn_hgcd_itch (mp_size_t);
+__GMP_DECLSPEC mp_size_t mpn_hgcd_itch (mp_size_t) ATTRIBUTE_CONST;
 
 #define mpn_hgcd __MPN (hgcd)
 __GMP_DECLSPEC mp_size_t mpn_hgcd (mp_ptr, mp_ptr, mp_size_t, struct hgcd_matrix *, mp_ptr);
 
 #define mpn_hgcd_appr_itch __MPN (hgcd_appr_itch)
-__GMP_DECLSPEC mp_size_t mpn_hgcd_appr_itch (mp_size_t);
+__GMP_DECLSPEC mp_size_t mpn_hgcd_appr_itch (mp_size_t) ATTRIBUTE_CONST;
 
 #define mpn_hgcd_appr __MPN (hgcd_appr)
 __GMP_DECLSPEC int mpn_hgcd_appr (mp_ptr, mp_ptr, mp_size_t, struct hgcd_matrix *, mp_ptr);
@@ -4536,10 +4577,6 @@ __GMP_DECLSPEC int __gmp_doscan (const struct gmp_doscan_funs_t *, void *, const
   } while (0)
 
 
-#define MPZ_PROVOKE_REALLOC(z)                                         \
-  do { ALLOC(z) = ABSIZ(z); } while (0)
-
-
 /* Enhancement: The "mod" and "gcd_1" functions below could have
    __GMP_ATTRIBUTE_PURE, but currently (gcc 3.3) that's not supported on
    function pointers, only actual functions.  It probably doesn't make much
@@ -4548,7 +4585,8 @@ __GMP_DECLSPEC int __gmp_doscan (const struct gmp_doscan_funs_t *, void *, const
 
 #if WANT_FAT_BINARY && (HAVE_HOST_CPU_FAMILY_x86 || HAVE_HOST_CPU_FAMILY_x86_64)
 /* NOTE: The function pointers in this struct are also in CPUVEC_FUNCS_LIST
-   in mpn/x86/x86-defs.m4.  Be sure to update that when changing here.  */
+   in mpn/x86/x86-defs.m4 and mpn/x86_64/x86_64-defs.m4.  Be sure to update
+   those when changing here.  */
 struct cpuvec_t {
   DECL_add_n           ((*add_n));
   DECL_addlsh1_n       ((*addlsh1_n));
@@ -4556,6 +4594,8 @@ struct cpuvec_t {
   DECL_addmul_1        ((*addmul_1));
   DECL_addmul_2        ((*addmul_2));
   DECL_bdiv_dbm1c      ((*bdiv_dbm1c));
+  DECL_cnd_add_n       ((*cnd_add_n));
+  DECL_cnd_sub_n       ((*cnd_sub_n));
   DECL_com             ((*com));
   DECL_copyd           ((*copyd));
   DECL_copyi           ((*copyi));
@@ -4636,10 +4676,9 @@ mpn_sub_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t ci)
 static inline int
 mpn_zero_p (mp_srcptr ap, mp_size_t n)
 {
-  mp_size_t i;
-  for (i = n - 1; i >= 0; i--)
+  while (--n >= 0)
     {
-      if (ap[i] != 0)
+      if (ap[n] != 0)
        return 0;
     }
   return 1;
@@ -4863,6 +4902,18 @@ extern mp_size_t                 gcd_dc_threshold;
 #define GCDEXT_DC_THRESHOLD            gcdext_dc_threshold
 extern mp_size_t                       gcdext_dc_threshold;
 
+#undef  DIV_QR_1N_PI1_METHOD
+#define DIV_QR_1N_PI1_METHOD           div_qr_1n_pi1_method
+extern int                             div_qr_1n_pi1_method;
+
+#undef  DIV_QR_1_NORM_THRESHOLD
+#define DIV_QR_1_NORM_THRESHOLD                div_qr_1_norm_threshold
+extern mp_size_t                       div_qr_1_norm_threshold;
+
+#undef  DIV_QR_1_UNNORM_THRESHOLD
+#define DIV_QR_1_UNNORM_THRESHOLD      div_qr_1_unnorm_threshold
+extern mp_size_t                       div_qr_1_unnorm_threshold;
+
 #undef  DIVREM_1_NORM_THRESHOLD
 #define DIVREM_1_NORM_THRESHOLD                divrem_1_norm_threshold
 extern mp_size_t                       divrem_1_norm_threshold;
diff --git a/gmpxx.h b/gmpxx.h
index c27a2f47fa0c2430b6b69fb72bf02e207b343d68..6dd9129c5ab532a7e7b63dc34dfdd7401a162490 100644 (file)
--- a/gmpxx.h
+++ b/gmpxx.h
@@ -1,22 +1,32 @@
 /* gmpxx.h -- C++ class wrapper for GMP types.  -*- C++ -*-
 
-Copyright 2001, 2002, 2003, 2006, 2008, 2011, 2012 Free Software Foundation,
-Inc.
+Copyright 2001-2003, 2006, 2008, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #ifndef __GMP_PLUSPLUS__
 #define __GMP_PLUSPLUS__
@@ -40,6 +50,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #else
 #define __GMPXX_CONSTANT(X) false
 #endif
+#define __GMPXX_CONSTANT_TRUE(X) (__GMPXX_CONSTANT(X) && (X))
 
 // Use C++11 features
 #ifndef __GMPXX_USE_CXX11
@@ -57,15 +68,20 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #define __GMPXX_NOEXCEPT
 #endif
 
-// Max allocations for plain types when converted to mpz_t
-#define __GMPZ_DBL_LIMBS (2 + DBL_MAX_EXP / GMP_NUMB_BITS)
-
+// Max allocations for plain types when converted to GMP types
 #if GMP_NAIL_BITS != 0 && ! defined _LONG_LONG_LIMB
 #define __GMPZ_ULI_LIMBS 2
 #else
 #define __GMPZ_ULI_LIMBS 1
 #endif
 
+#define __GMPXX_BITS_TO_LIMBS(n)  (((n) + (GMP_NUMB_BITS - 1)) / GMP_NUMB_BITS)
+#define __GMPZ_DBL_LIMBS __GMPXX_BITS_TO_LIMBS(DBL_MAX_EXP)+1
+#define __GMPQ_NUM_DBL_LIMBS __GMPZ_DBL_LIMBS
+#define __GMPQ_DEN_DBL_LIMBS __GMPXX_BITS_TO_LIMBS(DBL_MANT_DIG+1-DBL_MIN_EXP)+1
+// The final +1s are a security margin. The current implementation of
+// mpq_set_d seems to need it for the denominator.
+
 inline void __mpz_set_ui_safe(mpz_ptr p, unsigned long l)
 {
   p->_mp_size = (l != 0);
@@ -123,6 +139,14 @@ inline void __mpz_set_si_safe(mpz_ptr p, long l)
   mpq_denref(temp)->_mp_d = limbs + __GMPZ_ULI_LIMBS;                  \
   mpq_denref(temp)->_mp_size = 1;                                      \
   mpq_denref(temp)->_mp_d[0] = 1
+#define __GMPXX_TMPQ_D                                                 \
+  mpq_t temp;                                                          \
+  mp_limb_t limbs[__GMPQ_NUM_DBL_LIMBS + __GMPQ_DEN_DBL_LIMBS];                \
+  mpq_numref(temp)->_mp_d = limbs;                                     \
+  mpq_numref(temp)->_mp_alloc = __GMPQ_NUM_DBL_LIMBS;                  \
+  mpq_denref(temp)->_mp_d = limbs + __GMPQ_NUM_DBL_LIMBS;              \
+  mpq_denref(temp)->_mp_alloc = __GMPQ_DEN_DBL_LIMBS;                  \
+  mpq_set_d (temp, d)
 
 inline unsigned long __gmpxx_abs_ui (signed long l)
 {
@@ -215,13 +239,7 @@ struct __gmp_binary_plus
   static void eval(mpq_ptr q, signed long int l, mpq_srcptr r)
   { eval(q, r, l); }
   static void eval(mpq_ptr q, mpq_srcptr r, double d)
-  {
-    mpq_t temp;
-    mpq_init(temp);
-    mpq_set_d(temp, d);
-    mpq_add(q, r, temp);
-    mpq_clear(temp);
-  }
+  {  __GMPXX_TMPQ_D;    mpq_add (q, r, temp); }
   static void eval(mpq_ptr q, double d, mpq_srcptr r)
   { eval(q, r, d); }
 
@@ -345,21 +363,9 @@ struct __gmp_binary_minus
   static void eval(mpq_ptr q, signed long int l, mpq_srcptr r)
   { eval(q, r, l); mpq_neg(q, q); }
   static void eval(mpq_ptr q, mpq_srcptr r, double d)
-  {
-    mpq_t temp;
-    mpq_init(temp);
-    mpq_set_d(temp, d);
-    mpq_sub(q, r, temp);
-    mpq_clear(temp);
-  }
+  {  __GMPXX_TMPQ_D;    mpq_sub (q, r, temp); }
   static void eval(mpq_ptr q, double d, mpq_srcptr r)
-  {
-    mpq_t temp;
-    mpq_init(temp);
-    mpq_set_d(temp, d);
-    mpq_sub(q, temp, r);
-    mpq_clear(temp);
-  }
+  {  __GMPXX_TMPQ_D;    mpq_sub (q, temp, r); }
 
   static void eval(mpq_ptr q, mpq_srcptr r, mpz_srcptr z)
   {
@@ -501,16 +507,13 @@ struct __gmp_binary_multiplies
   { eval(z, w, l); }
   static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
   {
-    if (__GMPXX_CONSTANT(l))
-    {
-      if (l >= 0)
-        eval(z, w, static_cast<unsigned long>(l));
-      else
+    if (__GMPXX_CONSTANT_TRUE(l >= 0))
+      eval(z, w, static_cast<unsigned long>(l));
+    else if (__GMPXX_CONSTANT_TRUE(l <= 0))
       {
         eval(z, w, -static_cast<unsigned long>(l));
        mpz_neg(z, z);
       }
-    }
     else
       mpz_mul_si (z, w, l);
   }
@@ -549,32 +552,23 @@ struct __gmp_binary_multiplies
   { eval(q, r, l); }
   static void eval(mpq_ptr q, mpq_srcptr r, signed long int l)
   {
-    if (__GMPXX_CONSTANT(l))
-    {
-      if (l >= 0)
-        eval(q, r, static_cast<unsigned long>(l));
-      else
+    if (__GMPXX_CONSTANT_TRUE(l >= 0))
+      eval(q, r, static_cast<unsigned long>(l));
+    else if (__GMPXX_CONSTANT_TRUE(l <= 0))
       {
         eval(q, r, -static_cast<unsigned long>(l));
        mpq_neg(q, q);
       }
-    }
     else
-    {
-      __GMPXX_TMPQ_SI;
-      mpq_mul (q, r, temp);
-    }
+      {
+       __GMPXX_TMPQ_SI;
+       mpq_mul (q, r, temp);
+      }
   }
   static void eval(mpq_ptr q, signed long int l, mpq_srcptr r)
   { eval(q, r, l); }
   static void eval(mpq_ptr q, mpq_srcptr r, double d)
-  {
-    mpq_t temp;
-    mpq_init(temp);
-    mpq_set_d(temp, d);
-    mpq_mul(q, r, temp);
-    mpq_clear(temp);
-  }
+  {  __GMPXX_TMPQ_D;    mpq_mul (q, r, temp); }
   static void eval(mpq_ptr q, double d, mpq_srcptr r)
   { eval(q, r, d); }
 
@@ -698,40 +692,25 @@ struct __gmp_binary_divides
   {  __GMPXX_TMPQ_UI;   mpq_div (q, temp, r); }
   static void eval(mpq_ptr q, mpq_srcptr r, signed long int l)
   {
-    if (__GMPXX_CONSTANT(l))
-    {
-      if (l >= 0)
-        eval(q, r, static_cast<unsigned long>(l));
-      else
+    if (__GMPXX_CONSTANT_TRUE(l >= 0))
+      eval(q, r, static_cast<unsigned long>(l));
+    else if (__GMPXX_CONSTANT_TRUE(l <= 0))
       {
         eval(q, r, -static_cast<unsigned long>(l));
        mpq_neg(q, q);
       }
-    }
     else
-    {
-      __GMPXX_TMPQ_SI;
-      mpq_div (q, r, temp);
-    }
+      {
+       __GMPXX_TMPQ_SI;
+       mpq_div (q, r, temp);
+      }
   }
   static void eval(mpq_ptr q, signed long int l, mpq_srcptr r)
   {  __GMPXX_TMPQ_SI;   mpq_div (q, temp, r); }
   static void eval(mpq_ptr q, mpq_srcptr r, double d)
-  {
-    mpq_t temp;
-    mpq_init(temp);
-    mpq_set_d(temp, d);
-    mpq_div(q, r, temp);
-    mpq_clear(temp);
-  }
+  {  __GMPXX_TMPQ_D;    mpq_div (q, r, temp); }
   static void eval(mpq_ptr q, double d, mpq_srcptr r)
-  {
-    mpq_t temp;
-    mpq_init(temp);
-    mpq_set_d(temp, d);
-    mpq_div(q, temp, r);
-    mpq_clear(temp);
-  }
+  {  __GMPXX_TMPQ_D;    mpq_div (q, temp, r); }
 
   static void eval(mpf_ptr f, mpf_srcptr g, mpf_srcptr h)
   { mpf_div(f, g, h); }
@@ -886,15 +865,15 @@ struct __gmp_binary_equal
   static bool eval(mpz_srcptr z, unsigned long int l)
   { return mpz_cmp_ui(z, l) == 0; }
   static bool eval(unsigned long int l, mpz_srcptr z)
-  { return mpz_cmp_ui(z, l) == 0; }
+  { return eval(z, l); }
   static bool eval(mpz_srcptr z, signed long int l)
   { return mpz_cmp_si(z, l) == 0; }
   static bool eval(signed long int l, mpz_srcptr z)
-  { return mpz_cmp_si(z, l) == 0; }
+  { return eval(z, l); }
   static bool eval(mpz_srcptr z, double d)
   { return mpz_cmp_d(z, d) == 0; }
   static bool eval(double d, mpz_srcptr z)
-  { return mpz_cmp_d(z, d) == 0; }
+  { return eval(z, d); }
 
   static bool eval(mpq_srcptr q, mpq_srcptr r)
   { return mpq_equal(q, r) != 0; }
@@ -902,40 +881,30 @@ struct __gmp_binary_equal
   static bool eval(mpq_srcptr q, unsigned long int l)
   { return mpq_cmp_ui(q, l, 1) == 0; }
   static bool eval(unsigned long int l, mpq_srcptr q)
-  { return mpq_cmp_ui(q, l, 1) == 0; }
+  { return eval(q, l); }
   static bool eval(mpq_srcptr q, signed long int l)
   { return mpq_cmp_si(q, l, 1) == 0; }
   static bool eval(signed long int l, mpq_srcptr q)
-  { return mpq_cmp_si(q, l, 1) == 0; }
+  { return eval(q, l); }
   static bool eval(mpq_srcptr q, double d)
-  {
-    bool b;
-    mpq_t temp;
-    mpq_init(temp);
-    mpq_set_d(temp, d);
-    b = (mpq_equal(q, temp) != 0);
-    mpq_clear(temp);
-    return b;
-  }
+  {  __GMPXX_TMPQ_D;    return mpq_equal (q, temp) != 0; }
   static bool eval(double d, mpq_srcptr q)
-  {
-    return eval(q, d);
-  }
+  { return eval(q, d); }
 
   static bool eval(mpf_srcptr f, mpf_srcptr g) { return mpf_cmp(f, g) == 0; }
 
   static bool eval(mpf_srcptr f, unsigned long int l)
   { return mpf_cmp_ui(f, l) == 0; }
   static bool eval(unsigned long int l, mpf_srcptr f)
-  { return mpf_cmp_ui(f, l) == 0; }
+  { return eval(f, l); }
   static bool eval(mpf_srcptr f, signed long int l)
   { return mpf_cmp_si(f, l) == 0; }
   static bool eval(signed long int l, mpf_srcptr f)
-  { return mpf_cmp_si(f, l) == 0; }
+  { return eval(f, l); }
   static bool eval(mpf_srcptr f, double d)
   { return mpf_cmp_d(f, d) == 0; }
   static bool eval(double d, mpf_srcptr f)
-  { return mpf_cmp_d(f, d) == 0; }
+  { return eval(f, d); }
 };
 
 struct __gmp_binary_less
@@ -966,25 +935,9 @@ struct __gmp_binary_less
   static bool eval(signed long int l, mpq_srcptr q)
   { return mpq_cmp_si(q, l, 1) > 0; }
   static bool eval(mpq_srcptr q, double d)
-  {
-    bool b;
-    mpq_t temp;
-    mpq_init(temp);
-    mpq_set_d(temp, d);
-    b = (mpq_cmp(q, temp) < 0);
-    mpq_clear(temp);
-    return b;
-  }
+  {  __GMPXX_TMPQ_D;    return mpq_cmp (q, temp) < 0; }
   static bool eval(double d, mpq_srcptr q)
-  {
-    bool b;
-    mpq_t temp;
-    mpq_init(temp);
-    mpq_set_d(temp, d);
-    b = (mpq_cmp(temp, q) < 0);
-    mpq_clear(temp);
-    return b;
-  }
+  {  __GMPXX_TMPQ_D;    return mpq_cmp (temp, q) < 0; }
 
   static bool eval(mpf_srcptr f, mpf_srcptr g) { return mpf_cmp(f, g) < 0; }
 
@@ -1004,66 +957,8 @@ struct __gmp_binary_less
 
 struct __gmp_binary_greater
 {
-  static bool eval(mpz_srcptr z, mpz_srcptr w) { return mpz_cmp(z, w) > 0; }
-
-  static bool eval(mpz_srcptr z, unsigned long int l)
-  { return mpz_cmp_ui(z, l) > 0; }
-  static bool eval(unsigned long int l, mpz_srcptr z)
-  { return mpz_cmp_ui(z, l) < 0; }
-  static bool eval(mpz_srcptr z, signed long int l)
-  { return mpz_cmp_si(z, l) > 0; }
-  static bool eval(signed long int l, mpz_srcptr z)
-  { return mpz_cmp_si(z, l) < 0; }
-  static bool eval(mpz_srcptr z, double d)
-  { return mpz_cmp_d(z, d) > 0; }
-  static bool eval(double d, mpz_srcptr z)
-  { return mpz_cmp_d(z, d) < 0; }
-
-  static bool eval(mpq_srcptr q, mpq_srcptr r) { return mpq_cmp(q, r) > 0; }
-
-  static bool eval(mpq_srcptr q, unsigned long int l)
-  { return mpq_cmp_ui(q, l, 1) > 0; }
-  static bool eval(unsigned long int l, mpq_srcptr q)
-  { return mpq_cmp_ui(q, l, 1) < 0; }
-  static bool eval(mpq_srcptr q, signed long int l)
-  { return mpq_cmp_si(q, l, 1) > 0; }
-  static bool eval(signed long int l, mpq_srcptr q)
-  { return mpq_cmp_si(q, l, 1) < 0; }
-  static bool eval(mpq_srcptr q, double d)
-  {
-    bool b;
-    mpq_t temp;
-    mpq_init(temp);
-    mpq_set_d(temp, d);
-    b = (mpq_cmp(q, temp) > 0);
-    mpq_clear(temp);
-    return b;
-  }
-  static bool eval(double d, mpq_srcptr q)
-  {
-    bool b;
-    mpq_t temp;
-    mpq_init(temp);
-    mpq_set_d(temp, d);
-    b = (mpq_cmp(temp, q) > 0);
-    mpq_clear(temp);
-    return b;
-  }
-
-  static bool eval(mpf_srcptr f, mpf_srcptr g) { return mpf_cmp(f, g) > 0; }
-
-  static bool eval(mpf_srcptr f, unsigned long int l)
-  { return mpf_cmp_ui(f, l) > 0; }
-  static bool eval(unsigned long int l, mpf_srcptr f)
-  { return mpf_cmp_ui(f, l) < 0; }
-  static bool eval(mpf_srcptr f, signed long int l)
-  { return mpf_cmp_si(f, l) > 0; }
-  static bool eval(signed long int l, mpf_srcptr f)
-  { return mpf_cmp_si(f, l) < 0; }
-  static bool eval(mpf_srcptr f, double d)
-  { return mpf_cmp_d(f, d) > 0; }
-  static bool eval(double d, mpf_srcptr f)
-  { return mpf_cmp_d(f, d) < 0; }
+  template <class T, class U>
+  static inline bool eval(T t, U u) { return __gmp_binary_less::eval(u, t); }
 };
 
 struct __gmp_unary_increment
@@ -1129,24 +1024,15 @@ struct __gmp_hypot_function
     mpf_init2(temp, mpf_get_prec(f));
     mpf_mul(temp, g, g);
     mpf_set_ui(f, l);
-    mpf_mul(f, f, f);
+    mpf_mul_ui(f, f, l);
     mpf_add(f, f, temp);
-    mpf_sqrt(f, f);
     mpf_clear(temp);
+    mpf_sqrt(f, f);
   }
   static void eval(mpf_ptr f, unsigned long int l, mpf_srcptr g)
   { eval(f, g, l); }
   static void eval(mpf_ptr f, mpf_srcptr g, signed long int l)
-  {
-    mpf_t temp;
-    mpf_init2(temp, mpf_get_prec(f));
-    mpf_mul(temp, g, g);
-    mpf_set_si(f, l);
-    mpf_mul(f, f, f);
-    mpf_add(f, f, temp);
-    mpf_sqrt(f, f);
-    mpf_clear(temp);
-  }
+  { eval(f, g, __gmpxx_abs_ui(l)); }
   static void eval(mpf_ptr f, signed long int l, mpf_srcptr g)
   { eval(f, g, l); }
   static void eval(mpf_ptr f, mpf_srcptr g, double d)
@@ -1199,25 +1085,9 @@ struct __gmp_cmp_function
   static int eval(signed long int l, mpq_srcptr q)
   { return -mpq_cmp_si(q, l, 1); }
   static int eval(mpq_srcptr q, double d)
-  {
-    int i;
-    mpq_t temp;
-    mpq_init(temp);
-    mpq_set_d(temp, d);
-    i = mpq_cmp(q, temp);
-    mpq_clear(temp);
-    return i;
-  }
+  {  __GMPXX_TMPQ_D;    return mpq_cmp (q, temp); }
   static int eval(double d, mpq_srcptr q)
-  {
-    int i;
-    mpq_t temp;
-    mpq_init(temp);
-    mpq_set_d(temp, d);
-    i = mpq_cmp(temp, q);
-    mpq_clear(temp);
-    return i;
-  }
+  {  __GMPXX_TMPQ_D;    return mpq_cmp (temp, q); }
 
   static int eval(mpf_srcptr f, mpf_srcptr g) { return mpf_cmp(f, g); }
 
@@ -1450,6 +1320,29 @@ __GMPN_DECLARE_COMPOUND_OPERATOR(fun)
   inline __gmp_expr & fun();                  \
   inline __gmp_expr fun(int);
 
+#define __GMPXX_DEFINE_ARITHMETIC_CONSTRUCTORS         \
+  __gmp_expr(signed char c) { init_si(c); }            \
+  __gmp_expr(unsigned char c) { init_ui(c); }          \
+  __gmp_expr(signed int i) { init_si(i); }             \
+  __gmp_expr(unsigned int i) { init_ui(i); }           \
+  __gmp_expr(signed short int s) { init_si(s); }       \
+  __gmp_expr(unsigned short int s) { init_ui(s); }     \
+  __gmp_expr(signed long int l) { init_si(l); }                \
+  __gmp_expr(unsigned long int l) { init_ui(l); }      \
+  __gmp_expr(float f) { init_d(f); }                   \
+  __gmp_expr(double d) { init_d(d); }
+
+#define __GMPXX_DEFINE_ARITHMETIC_ASSIGNMENTS          \
+  __gmp_expr & operator=(signed char c) { assign_si(c); return *this; } \
+  __gmp_expr & operator=(unsigned char c) { assign_ui(c); return *this; } \
+  __gmp_expr & operator=(signed int i) { assign_si(i); return *this; } \
+  __gmp_expr & operator=(unsigned int i) { assign_ui(i); return *this; } \
+  __gmp_expr & operator=(signed short int s) { assign_si(s); return *this; } \
+  __gmp_expr & operator=(unsigned short int s) { assign_ui(s); return *this; } \
+  __gmp_expr & operator=(signed long int l) { assign_si(l); return *this; } \
+  __gmp_expr & operator=(unsigned long int l) { assign_ui(l); return *this; } \
+  __gmp_expr & operator=(float f) { assign_d(f); return *this; } \
+  __gmp_expr & operator=(double d) { assign_d(d); return *this; }
 
 /**************** mpz_class -- wrapper for mpz_t ****************/
 
@@ -1459,6 +1352,56 @@ class __gmp_expr<mpz_t, mpz_t>
 private:
   typedef mpz_t value_type;
   value_type mp;
+
+  // Helper functions used for all arithmetic types
+  void assign_ui(unsigned long l)
+  {
+    if (__GMPXX_CONSTANT_TRUE(l == 0))
+      mp->_mp_size = 0;
+    else
+      mpz_set_ui(mp, l);
+  }
+  void assign_si(signed long l)
+  {
+    if (__GMPXX_CONSTANT_TRUE(l >= 0))
+      assign_ui(l);
+    else if (__GMPXX_CONSTANT_TRUE(l <= 0))
+      {
+       assign_ui(-static_cast<unsigned long>(l));
+       mpz_neg(mp, mp);
+      }
+    else
+      mpz_set_si(mp, l);
+  }
+  void assign_d (double d)
+  {
+    mpz_set_d (mp, d);
+  }
+
+  void init_ui(unsigned long l)
+  {
+    if (__GMPXX_CONSTANT_TRUE(l == 0))
+      mpz_init(mp);
+    else
+      mpz_init_set_ui(mp, l);
+  }
+  void init_si(signed long l)
+  {
+    if (__GMPXX_CONSTANT_TRUE(l >= 0))
+      init_ui(l);
+    else if (__GMPXX_CONSTANT_TRUE(l <= 0))
+      {
+       init_ui(-static_cast<unsigned long>(l));
+       mpz_neg(mp, mp);
+      }
+    else
+      mpz_init_set_si(mp, l);
+  }
+  void init_d (double d)
+  {
+    mpz_init_set_d (mp, d);
+  }
+
 public:
   mp_bitcnt_t get_prec() const { return mpf_get_default_prec(); }
 
@@ -1477,21 +1420,7 @@ public:
   explicit __gmp_expr(const __gmp_expr<T, U> &expr)
   { mpz_init(mp); __gmp_set_expr(mp, expr); }
 
-  __gmp_expr(signed char c) { mpz_init_set_si(mp, c); }
-  __gmp_expr(unsigned char c) { mpz_init_set_ui(mp, c); }
-
-  __gmp_expr(signed int i) { mpz_init_set_si(mp, i); }
-  __gmp_expr(unsigned int i) { mpz_init_set_ui(mp, i); }
-
-  __gmp_expr(signed short int s) { mpz_init_set_si(mp, s); }
-  __gmp_expr(unsigned short int s) { mpz_init_set_ui(mp, s); }
-
-  __gmp_expr(signed long int l) { mpz_init_set_si(mp, l); }
-  __gmp_expr(unsigned long int l) { mpz_init_set_ui(mp, l); }
-
-  __gmp_expr(float f) { mpz_init_set_d(mp, f); }
-  __gmp_expr(double d) { mpz_init_set_d(mp, d); }
-  // __gmp_expr(long double ld) { mpz_init_set_d(mp, ld); }
+  __GMPXX_DEFINE_ARITHMETIC_CONSTRUCTORS
 
   explicit __gmp_expr(const char *s, int base = 0)
   {
@@ -1527,26 +1456,7 @@ public:
   __gmp_expr<value_type, value_type> & operator=(const __gmp_expr<T, U> &expr)
   { __gmp_set_expr(mp, expr); return *this; }
 
-  __gmp_expr & operator=(signed char c) { mpz_set_si(mp, c); return *this; }
-  __gmp_expr & operator=(unsigned char c) { mpz_set_ui(mp, c); return *this; }
-
-  __gmp_expr & operator=(signed int i) { mpz_set_si(mp, i); return *this; }
-  __gmp_expr & operator=(unsigned int i) { mpz_set_ui(mp, i); return *this; }
-
-  __gmp_expr & operator=(signed short int s)
-  { mpz_set_si(mp, s); return *this; }
-  __gmp_expr & operator=(unsigned short int s)
-  { mpz_set_ui(mp, s); return *this; }
-
-  __gmp_expr & operator=(signed long int l)
-  { mpz_set_si(mp, l); return *this; }
-  __gmp_expr & operator=(unsigned long int l)
-  { mpz_set_ui(mp, l); return *this; }
-
-  __gmp_expr & operator=(float f) { mpz_set_d(mp, f); return *this; }
-  __gmp_expr & operator=(double d) { mpz_set_d(mp, d); return *this; }
-  // __gmp_expr & operator=(long double ld)
-  // { mpz_set_ld(mp, ld); return *this; }
+  __GMPXX_DEFINE_ARITHMETIC_ASSIGNMENTS
 
   __gmp_expr & operator=(const char *s)
   {
@@ -1627,6 +1537,22 @@ class __gmp_expr<mpq_t, mpq_t>
 private:
   typedef mpq_t value_type;
   value_type mp;
+
+  // Helper functions used for all arithmetic types
+  void assign_ui(unsigned long l) { mpq_set_ui(mp, l, 1); }
+  void assign_si(signed long l)
+  {
+    if (__GMPXX_CONSTANT_TRUE(l >= 0))
+      assign_ui(l);
+    else
+      mpq_set_si(mp, l, 1);
+  }
+  void assign_d (double d)        { mpq_set_d (mp, d); }
+
+  void init_ui(unsigned long l)        { mpq_init(mp); get_num() = l; }
+  void init_si(signed long l)  { mpq_init(mp); get_num() = l; }
+  void init_d (double d)       { mpq_init(mp); assign_d (d); }
+
 public:
   mp_bitcnt_t get_prec() const { return mpf_get_default_prec(); }
   void canonicalize() { mpq_canonicalize(mp); }
@@ -1653,21 +1579,7 @@ public:
   explicit __gmp_expr(const __gmp_expr<T, U> &expr)
   { mpq_init(mp); __gmp_set_expr(mp, expr); }
 
-  __gmp_expr(signed char c) { mpq_init(mp); mpq_set_si(mp, c, 1); }
-  __gmp_expr(unsigned char c) { mpq_init(mp); mpq_set_ui(mp, c, 1); }
-
-  __gmp_expr(signed int i) { mpq_init(mp); mpq_set_si(mp, i, 1); }
-  __gmp_expr(unsigned int i) { mpq_init(mp); mpq_set_ui(mp, i, 1); }
-
-  __gmp_expr(signed short int s) { mpq_init(mp); mpq_set_si(mp, s, 1); }
-  __gmp_expr(unsigned short int s) { mpq_init(mp); mpq_set_ui(mp, s, 1); }
-
-  __gmp_expr(signed long int l) { mpq_init(mp); mpq_set_si(mp, l, 1); }
-  __gmp_expr(unsigned long int l) { mpq_init(mp); mpq_set_ui(mp, l, 1); }
-
-  __gmp_expr(float f) { mpq_init(mp); mpq_set_d(mp, f); }
-  __gmp_expr(double d) { mpq_init(mp); mpq_set_d(mp, d); }
-  // __gmp_expr(long double ld) { mpq_init(mp); mpq_set_ld(mp, ld); }
+  __GMPXX_DEFINE_ARITHMETIC_CONSTRUCTORS
 
   explicit __gmp_expr(const char *s, int base = 0)
   {
@@ -1723,29 +1635,7 @@ public:
   __gmp_expr<value_type, value_type> & operator=(const __gmp_expr<T, U> &expr)
   { __gmp_set_expr(mp, expr); return *this; }
 
-  __gmp_expr & operator=(signed char c)
-  { mpq_set_si(mp, c, 1); return *this; }
-  __gmp_expr & operator=(unsigned char c)
-  { mpq_set_ui(mp, c, 1); return *this; }
-
-  __gmp_expr & operator=(signed int i) { mpq_set_si(mp, i, 1); return *this; }
-  __gmp_expr & operator=(unsigned int i)
-  { mpq_set_ui(mp, i, 1); return *this; }
-
-  __gmp_expr & operator=(signed short int s)
-  { mpq_set_si(mp, s, 1); return *this; }
-  __gmp_expr & operator=(unsigned short int s)
-  { mpq_set_ui(mp, s, 1); return *this; }
-
-  __gmp_expr & operator=(signed long int l)
-  { mpq_set_si(mp, l, 1); return *this; }
-  __gmp_expr & operator=(unsigned long int l)
-  { mpq_set_ui(mp, l, 1); return *this; }
-
-  __gmp_expr & operator=(float f) { mpq_set_d(mp, f); return *this; }
-  __gmp_expr & operator=(double d) { mpq_set_d(mp, d); return *this; }
-  // __gmp_expr & operator=(long double ld)
-  // { mpq_set_ld(mp, ld); return *this; }
+  __GMPXX_DEFINE_ARITHMETIC_ASSIGNMENTS
 
   __gmp_expr & operator=(const char *s)
   {
@@ -1825,6 +1715,34 @@ class __gmp_expr<mpf_t, mpf_t>
 private:
   typedef mpf_t value_type;
   value_type mp;
+
+  // Helper functions used for all arithmetic types
+  void assign_ui(unsigned long l) { mpf_set_ui(mp, l); }
+  void assign_si(signed long l)
+  {
+    if (__GMPXX_CONSTANT_TRUE(l >= 0))
+      assign_ui(l);
+    else
+      mpf_set_si(mp, l);
+  }
+  void assign_d (double d)        { mpf_set_d (mp, d); }
+
+  void init_ui(unsigned long l)
+  {
+    if (__GMPXX_CONSTANT_TRUE(l == 0))
+      mpf_init(mp);
+    else
+      mpf_init_set_ui(mp, l);
+  }
+  void init_si(signed long l)
+  {
+    if (__GMPXX_CONSTANT_TRUE(l >= 0))
+      init_ui(l);
+    else
+      mpf_init_set_si(mp, l);
+  }
+  void init_d (double d)       { mpf_init_set_d (mp, d); }
+
 public:
   mp_bitcnt_t get_prec() const { return mpf_get_prec(mp); }
 
@@ -1849,38 +1767,30 @@ public:
   __gmp_expr(const __gmp_expr<T, U> &expr, mp_bitcnt_t prec)
   { mpf_init2(mp, prec); __gmp_set_expr(mp, expr); }
 
-  __gmp_expr(signed char c) { mpf_init_set_si(mp, c); }
+  __GMPXX_DEFINE_ARITHMETIC_CONSTRUCTORS
+
   __gmp_expr(signed char c, mp_bitcnt_t prec)
   { mpf_init2(mp, prec); mpf_set_si(mp, c); }
-  __gmp_expr(unsigned char c) { mpf_init_set_ui(mp, c); }
   __gmp_expr(unsigned char c, mp_bitcnt_t prec)
   { mpf_init2(mp, prec); mpf_set_ui(mp, c); }
 
-  __gmp_expr(signed int i) { mpf_init_set_si(mp, i); }
   __gmp_expr(signed int i, mp_bitcnt_t prec)
   { mpf_init2(mp, prec); mpf_set_si(mp, i); }
-  __gmp_expr(unsigned int i) { mpf_init_set_ui(mp, i); }
   __gmp_expr(unsigned int i, mp_bitcnt_t prec)
   { mpf_init2(mp, prec); mpf_set_ui(mp, i); }
 
-  __gmp_expr(signed short int s) { mpf_init_set_si(mp, s); }
   __gmp_expr(signed short int s, mp_bitcnt_t prec)
   { mpf_init2(mp, prec); mpf_set_si(mp, s); }
-  __gmp_expr(unsigned short int s) { mpf_init_set_ui(mp, s); }
   __gmp_expr(unsigned short int s, mp_bitcnt_t prec)
   { mpf_init2(mp, prec); mpf_set_ui(mp, s); }
 
-  __gmp_expr(signed long int l) { mpf_init_set_si(mp, l); }
   __gmp_expr(signed long int l, mp_bitcnt_t prec)
   { mpf_init2(mp, prec); mpf_set_si(mp, l); }
-  __gmp_expr(unsigned long int l) { mpf_init_set_ui(mp, l); }
   __gmp_expr(unsigned long int l, mp_bitcnt_t prec)
   { mpf_init2(mp, prec); mpf_set_ui(mp, l); }
 
-  __gmp_expr(float f) { mpf_init_set_d(mp, f); }
   __gmp_expr(float f, mp_bitcnt_t prec)
   { mpf_init2(mp, prec); mpf_set_d(mp, f); }
-  __gmp_expr(double d) { mpf_init_set_d(mp, d); }
   __gmp_expr(double d, mp_bitcnt_t prec)
   { mpf_init2(mp, prec); mpf_set_d(mp, d); }
   // __gmp_expr(long double ld) { mpf_init_set_d(mp, ld); }
@@ -1942,26 +1852,7 @@ public:
   __gmp_expr<value_type, value_type> & operator=(const __gmp_expr<T, U> &expr)
   { __gmp_set_expr(mp, expr); return *this; }
 
-  __gmp_expr & operator=(signed char c) { mpf_set_si(mp, c); return *this; }
-  __gmp_expr & operator=(unsigned char c) { mpf_set_ui(mp, c); return *this; }
-
-  __gmp_expr & operator=(signed int i) { mpf_set_si(mp, i); return *this; }
-  __gmp_expr & operator=(unsigned int i) { mpf_set_ui(mp, i); return *this; }
-
-  __gmp_expr & operator=(signed short int s)
-  { mpf_set_si(mp, s); return *this; }
-  __gmp_expr & operator=(unsigned short int s)
-  { mpf_set_ui(mp, s); return *this; }
-
-  __gmp_expr & operator=(signed long int l)
-  { mpf_set_si(mp, l); return *this; }
-  __gmp_expr & operator=(unsigned long int l)
-  { mpf_set_ui(mp, l); return *this; }
-
-  __gmp_expr & operator=(float f) { mpf_set_d(mp, f); return *this; }
-  __gmp_expr & operator=(double d) { mpf_set_d(mp, d); return *this; }
-  // __gmp_expr & operator=(long double ld)
-  // { mpf_set_ld(mp, ld); return *this; }
+  __GMPXX_DEFINE_ARITHMETIC_ASSIGNMENTS
 
   __gmp_expr & operator=(const char *s)
   {
@@ -3387,6 +3278,8 @@ namespace std {
 #undef __GMP_DECLARE_COMPOUND_OPERATOR
 #undef __GMP_DECLARE_COMPOUND_OPERATOR_UI
 #undef __GMP_DECLARE_INCREMENT_OPERATOR
+#undef __GMPXX_DEFINE_ARITHMETIC_CONSTRUCTORS
+#undef __GMPXX_DEFINE_ARITHMETIC_ASSIGNMENTS
 
 #undef __GMPZQ_DEFINE_EXPR
 
@@ -3437,6 +3330,7 @@ namespace std {
 #undef __GMPQ_DEFINE_INCREMENT_OPERATOR
 #undef __GMPF_DEFINE_INCREMENT_OPERATOR
 
+#undef __GMPXX_CONSTANT_TRUE
 #undef __GMPXX_CONSTANT
 
 #endif /* __GMP_PLUSPLUS__ */
index e4160c991dc958a11b89654e365c72a13639f6b2..a9244eb0786534553fdd9eb0050bb4b172bad0a3 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2004-04-01.17
+scriptversion=2011-01-19.21; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -39,120 +39,165 @@ scriptversion=2004-04-01.17
 # when there is no Makefile.
 #
 # This script is compatible with the BSD install script, but was written
-# from scratch.  It can only install one file at a time, a restriction
-# shared with many OS's install programs.
+# from scratch.
+
+nl='
+'
+IFS=" ""       $nl"
 
 # set DOITPROG to echo to test this script
 
 # Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=
-transform_arg=
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=
+doit=${DOITPROG-}
+if test -z "$doit"; then
+  doit_exec=exec
+else
+  doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+  test "$posix_glob" != "?" || {
+    if (set -f) 2>/dev/null; then
+      posix_glob=
+    else
+      posix_glob=:
+    fi
+  }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
 chgrpcmd=
-stripcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
 rmcmd="$rmprog -f"
-mvcmd="$mvprog"
+stripcmd=
+
 src=
 dst=
 dir_arg=
+dst_arg=
 
-usage="Usage: $0 [OPTION]... SRCFILE DSTFILE
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
    or: $0 [OPTION]... SRCFILES... DIRECTORY
-   or: $0 -d DIRECTORIES...
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
 
-In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
-In the second, create the directory path DIR.
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
 
 Options:
--b=TRANSFORMBASENAME
--c         copy source (using $cpprog) instead of moving (using $mvprog).
--d         create directories instead of installing files.
--g GROUP   $chgrp installed files to GROUP.
--m MODE    $chmod installed files to MODE.
--o USER    $chown installed files to USER.
--s         strip installed files (using $stripprog).
--t=TRANSFORM
---help     display this help and exit.
---version  display version info and exit.
+     --help     display this help and exit.
+     --version  display version info and exit.
+
+  -c            (ignored)
+  -C            install only if different (preserve the last data modification time)
+  -d            create directories instead of installing files.
+  -g GROUP      $chgrpprog installed files to GROUP.
+  -m MODE       $chmodprog installed files to MODE.
+  -o USER       $chownprog installed files to USER.
+  -s            $stripprog installed files.
+  -t DIRECTORY  install into DIRECTORY.
+  -T            report an error if DSTFILE is a directory.
 
 Environment variables override the default commands:
-  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+  RMPROG STRIPPROG
 "
 
-while test -n "$1"; do
+while test $# -ne 0; do
   case $1 in
-    -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
-        shift
-        continue;;
+    -c) ;;
 
-    -c) instcmd=$cpprog
-        shift
-        continue;;
+    -C) copy_on_change=true;;
 
-    -d) dir_arg=true
-        shift
-        continue;;
+    -d) dir_arg=true;;
 
     -g) chgrpcmd="$chgrpprog $2"
-        shift
-        shift
-        continue;;
+       shift;;
 
-    --help) echo "$usage"; exit 0;;
+    --help) echo "$usage"; exit $?;;
 
-    -m) chmodcmd="$chmodprog $2"
-        shift
-        shift
-        continue;;
+    -m) mode=$2
+       case $mode in
+         *' '* | *'    '* | *'
+'*       | *'*'* | *'?'* | *'['*)
+           echo "$0: invalid mode: $mode" >&2
+           exit 1;;
+       esac
+       shift;;
 
     -o) chowncmd="$chownprog $2"
-        shift
-        shift
-        continue;;
-
-    -s) stripcmd=$stripprog
-        shift
-        continue;;
-
-    -t=*) transformarg=`echo $1 | sed 's/-t=//'`
-        shift
-        continue;;
-
-    --version) echo "$0 $scriptversion"; exit 0;;
-
-    *)  # When -d is used, all remaining arguments are directories to create.
-       test -n "$dir_arg" && break
-        # Otherwise, the last argument is the destination.  Remove it from $@.
-       for arg
-       do
-          if test -n "$dstarg"; then
-           # $@ is not empty: it contains at least $arg.
-           set fnord "$@" "$dstarg"
-           shift # fnord
-         fi
-         shift # arg
-         dstarg=$arg
-       done
+       shift;;
+
+    -s) stripcmd=$stripprog;;
+
+    -t) dst_arg=$2
+       # Protect names problematic for `test' and other utilities.
+       case $dst_arg in
+         -* | [=\(\)!]) dst_arg=./$dst_arg;;
+       esac
+       shift;;
+
+    -T) no_target_directory=true;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    --)        shift
        break;;
+
+    -*)        echo "$0: invalid option: $1" >&2
+       exit 1;;
+
+    *)  break;;
   esac
+  shift
 done
 
-if test -z "$1"; then
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $@.
+  for arg
+  do
+    if test -n "$dst_arg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dst_arg"
+      shift # fnord
+    fi
+    shift # arg
+    dst_arg=$arg
+    # Protect names problematic for `test' and other utilities.
+    case $dst_arg in
+      -* | [=\(\)!]) dst_arg=./$dst_arg;;
+    esac
+  done
+fi
+
+if test $# -eq 0; then
   if test -z "$dir_arg"; then
     echo "$0: no input file specified." >&2
     exit 1
@@ -162,25 +207,52 @@ if test -z "$1"; then
   exit 0
 fi
 
+if test -z "$dir_arg"; then
+  do_exit='(exit $ret); exit $ret'
+  trap "ret=129; $do_exit" 1
+  trap "ret=130; $do_exit" 2
+  trap "ret=141; $do_exit" 13
+  trap "ret=143; $do_exit" 15
+
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+       u_plus_rw=
+      else
+       u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+       u_plus_rw=
+      else
+       u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
+
 for src
 do
-  # Protect names starting with `-'.
+  # Protect names problematic for `test' and other utilities.
   case $src in
-    -*) src=./$src ;;
+    -* | [=\(\)!]) src=./$src;;
   esac
 
   if test -n "$dir_arg"; then
     dst=$src
-    src=
-
-    if test -d "$dst"; then
-      instcmd=:
-      chmodcmd=
-    else
-      instcmd=$mkdirprog
-    fi
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
   else
-    # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
     # might cause directories to be created, which would be especially bad
     # if $src (and thus $dsttmp) contains '*'.
     if test ! -f "$src" && test ! -d "$src"; then
@@ -188,138 +260,268 @@ do
       exit 1
     fi
 
-    if test -z "$dstarg"; then
+    if test -z "$dst_arg"; then
       echo "$0: no destination specified." >&2
       exit 1
     fi
-
-    dst=$dstarg
-    # Protect names starting with `-'.
-    case $dst in
-      -*) dst=./$dst ;;
-    esac
+    dst=$dst_arg
 
     # If destination is a directory, append the input filename; won't work
     # if double slashes aren't ignored.
     if test -d "$dst"; then
-      dst=$dst/`basename "$src"`
+      if test -n "$no_target_directory"; then
+       echo "$0: $dst_arg: Is a directory" >&2
+       exit 1
+      fi
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      # Prefer dirname, but fall back on a substitute if dirname fails.
+      dstdir=`
+       (dirname "$dst") 2>/dev/null ||
+       expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+            X"$dst" : 'X\(//\)[^/]' \| \
+            X"$dst" : 'X\(//\)$' \| \
+            X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+       echo X"$dst" |
+           sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+                  s//\1/
+                  q
+                }
+                /^X\(\/\/\)[^/].*/{
+                  s//\1/
+                  q
+                }
+                /^X\(\/\/\)$/{
+                  s//\1/
+                  q
+                }
+                /^X\(\/\).*/{
+                  s//\1/
+                  q
+                }
+                s/.*/./; q'
+      `
+
+      test -d "$dstdir"
+      dstdir_status=$?
     fi
   fi
 
-  # This sed command emulates the dirname command.
-  dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+  obsolete_mkdir_used=false
+
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+       # Create intermediate dirs using mode 755 as modified by the umask.
+       # This is like FreeBSD 'install' as of 1997-10-28.
+       umask=`umask`
+       case $stripcmd.$umask in
+         # Optimize common cases.
+         *[2367][2367]) mkdir_umask=$umask;;
+         .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+         *[0-7])
+           mkdir_umask=`expr $umask + 22 \
+             - $umask % 100 % 40 + $umask % 20 \
+             - $umask % 10 % 4 + $umask % 2
+           `;;
+         *) mkdir_umask=$umask,go-w;;
+       esac
+
+       # With -d, create the new directory with the user-specified mode.
+       # Otherwise, rely on $mkdir_umask.
+       if test -n "$dir_arg"; then
+         mkdir_mode=-m$mode
+       else
+         mkdir_mode=
+       fi
+
+       posix_mkdir=false
+       case $umask in
+         *[123567][0-7][0-7])
+           # POSIX mkdir -p sets u+wx bits regardless of umask, which
+           # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+           ;;
+         *)
+           tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+           trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+           if (umask $mkdir_umask &&
+               exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+           then
+             if test -z "$dir_arg" || {
+                  # Check for POSIX incompatibilities with -m.
+                  # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+                  # other-writeable bit of parent directory when it shouldn't.
+                  # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+                  ls_ld_tmpdir=`ls -ld "$tmpdir"`
+                  case $ls_ld_tmpdir in
+                    d????-?r-*) different_mode=700;;
+                    d????-?--*) different_mode=755;;
+                    *) false;;
+                  esac &&
+                  $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+                    ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+                    test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+                  }
+                }
+             then posix_mkdir=:
+             fi
+             rmdir "$tmpdir/d" "$tmpdir"
+           else
+             # Remove any dirs left behind by ancient mkdir implementations.
+             rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+           fi
+           trap '' 0;;
+       esac;;
+    esac
 
-  # Make sure that the destination directory exists.
+    if
+      $posix_mkdir && (
+       umask $mkdir_umask &&
+       $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
 
-  # Skip lots of stat calls in the usual case.
-  if test ! -d "$dstdir"; then
-    defaultIFS='
-        '
-    IFS="${IFS-$defaultIFS}"
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
 
-    oIFS=$IFS
-    # Some sh's can't handle IFS=/ for some reason.
-    IFS='%'
-    set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-    IFS=$oIFS
+      case $dstdir in
+       /*) prefix='/';;
+       [-=\(\)!]*) prefix='./';;
+       *)  prefix='';;
+      esac
 
-    pathcomp=
+      eval "$initialize_posix_glob"
 
-    while test $# -ne 0 ; do
-      pathcomp=$pathcomp$1
+      oIFS=$IFS
+      IFS=/
+      $posix_glob set -f
+      set fnord $dstdir
       shift
-      if test ! -d "$pathcomp"; then
-        $mkdirprog "$pathcomp" || lasterr=$?
-       # mkdir can fail with a `File exist' error in case several
-       # install-sh are creating the directory concurrently.  This
-       # is OK.
-       test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; }
+      $posix_glob set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+       test X"$d" = X && continue
+
+       prefix=$prefix$d
+       if test -d "$prefix"; then
+         prefixes=
+       else
+         if $posix_mkdir; then
+           (umask=$mkdir_umask &&
+            $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+           # Don't fail if two instances are running concurrently.
+           test -d "$prefix" || exit 1
+         else
+           case $prefix in
+             *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+             *) qprefix=$prefix;;
+           esac
+           prefixes="$prefixes '$qprefix'"
+         fi
+       fi
+       prefix=$prefix/
+      done
+
+      if test -n "$prefixes"; then
+       # Don't fail if two instances are running concurrently.
+       (umask $mkdir_umask &&
+        eval "\$doit_exec \$mkdirprog $prefixes") ||
+         test -d "$dstdir" || exit 1
+       obsolete_mkdir_used=true
       fi
-      pathcomp=$pathcomp/
-    done
+    fi
   fi
 
   if test -n "$dir_arg"; then
-    $doit $instcmd "$dst" \
-      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
-      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
-      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
-      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
-
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
   else
-    # If we're going to rename the final executable, determine the name now.
-    if test -z "$transformarg"; then
-      dstfile=`basename "$dst"`
-    else
-      dstfile=`basename "$dst" $transformbasename \
-               | sed $transformarg`$transformbasename
-    fi
-
-    # don't allow the sed command to completely eliminate the filename.
-    test -z "$dstfile" && dstfile=`basename "$dst"`
 
     # Make a couple of temp file names in the proper directory.
     dsttmp=$dstdir/_inst.$$_
     rmtmp=$dstdir/_rm.$$_
 
     # Trap to clean up those temp files at exit.
-    trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
-    trap '(exit $?); exit' 1 2 13 15
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
 
-    # Move or copy the file name to the temp name
-    $doit $instcmd "$src" "$dsttmp" &&
+    # Copy the file name to the temp name.
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
 
     # and set any options; do chmod last to preserve setuid bits.
     #
     # If any of these fail, we abort the whole thing.  If we want to
     # ignore errors from any of these, just make sure not to ignore
-    # errors from the above "$doit $instcmd $src $dsttmp" command.
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
     #
-    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
-      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
-      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
-      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
-
-    # Now rename the file to the real destination.
-    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
-      || {
-          # The rename failed, perhaps because mv can't rename something else
-          # to itself, or perhaps because mv is so ancient that it does not
-          # support -f.
-
-          # Now remove or move aside any old file at destination location.
-          # We try this two ways since rm can't unlink itself on some
-          # systems and the destination file might be busy for other
-          # reasons.  In this case, the final cleanup might fail but the new
-          # file should still install successfully.
-          {
-            if test -f "$dstdir/$dstfile"; then
-              $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
-              || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
-              || {
-                echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
-                (exit 1); exit
-              }
-            else
-              :
-            fi
-          } &&
-
-          # Now rename the file to the real destination.
-          $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
-        }
-    }
-  fi || { (exit 1); exit; }
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+    # If -C, don't bother to copy if it wouldn't change the file.
+    if $copy_on_change &&
+       old=`LC_ALL=C ls -dlL "$dst"    2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+       eval "$initialize_posix_glob" &&
+       $posix_glob set -f &&
+       set X $old && old=:$2:$4:$5:$6 &&
+       set X $new && new=:$2:$4:$5:$6 &&
+       $posix_glob set +f &&
+
+       test "$old" = "$new" &&
+       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+    then
+      rm -f "$dsttmp"
+    else
+      # Rename the file to the real destination.
+      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+      # The rename failed, perhaps because mv can't rename something else
+      # to itself, or perhaps because mv is so ancient that it does not
+      # support -f.
+      {
+       # Now remove or move aside any old file at destination location.
+       # We try this two ways since rm can't unlink itself on some
+       # systems and the destination file might be busy for other
+       # reasons.  In this case, the final cleanup might fail but the new
+       # file should still install successfully.
+       {
+         test ! -f "$dst" ||
+         $doit $rmcmd -f "$dst" 2>/dev/null ||
+         { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+           { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+         } ||
+         { echo "$0: cannot unlink or rename $dst" >&2
+           (exit 1); exit 1
+         }
+       } &&
+
+       # Now rename the file to the real destination.
+       $doit $mvcmd "$dsttmp" "$dst"
+      }
+    fi || exit 1
+
+    trap '' 0
+  fi
 done
 
-# The final little trick to "correctly" pass the exit status to the exit trap.
-{
-  (exit 0); exit
-}
-
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
index 24c6f131c1fe621bb418c1d106476aeaf1349e63..81d6720c0ddc5e1e0667a3bb9c998aaef43a2bd7 100644 (file)
--- a/invalid.c
+++ b/invalid.c
@@ -9,17 +9,28 @@ Copyright 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 211d80d6b387dfab2db782fc0ea2c81117175c30..f144dee9e700fc9187caba95ff3102bc35987349 100644 (file)
@@ -1,20 +1,33 @@
 /* longlong.h -- definitions for mixed size 32/64 bit arithmetic.
 
-Copyright 1991, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
-2004, 2005, 2007, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
+Copyright 1991-1994, 1996, 1997, 1999-2005, 2007-2009, 2011-2013 Free Software
+Foundation, Inc.
 
-This file is free software; you can redistribute it and/or modify it under the
-terms of 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.
+This file is part of the GNU MP Library.
 
-This file 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 Lesser General Public License for more
-details.
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
 
-You should have received a copy of the GNU Lesser General Public License
-along with this file.  If not, see http://www.gnu.org/licenses/.  */
+  * 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/.  */
 
 /* You have to define the following before including this file:
 
@@ -139,30 +152,30 @@ along with this file.  If not, see http://www.gnu.org/licenses/.  */
    or want.  */
 
 #ifdef _LONG_LONG_LIMB
-#define count_leading_zeros_gcc_clz(count,x)    \
-  do {                                          \
-    ASSERT ((x) != 0);                          \
-    (count) = __builtin_clzll (x);              \
+#define count_leading_zeros_gcc_clz(count,x)   \
+  do {                                         \
+    ASSERT ((x) != 0);                         \
+    (count) = __builtin_clzll (x);             \
   } while (0)
 #else
-#define count_leading_zeros_gcc_clz(count,x)    \
-  do {                                          \
-    ASSERT ((x) != 0);                          \
-    (count) = __builtin_clzl (x);               \
+#define count_leading_zeros_gcc_clz(count,x)   \
+  do {                                         \
+    ASSERT ((x) != 0);                         \
+    (count) = __builtin_clzl (x);              \
   } while (0)
 #endif
 
 #ifdef _LONG_LONG_LIMB
-#define count_trailing_zeros_gcc_ctz(count,x)   \
-  do {                                          \
-    ASSERT ((x) != 0);                          \
-    (count) = __builtin_ctzll (x);              \
+#define count_trailing_zeros_gcc_ctz(count,x)  \
+  do {                                         \
+    ASSERT ((x) != 0);                         \
+    (count) = __builtin_ctzll (x);             \
   } while (0)
 #else
-#define count_trailing_zeros_gcc_ctz(count,x)   \
-  do {                                          \
-    ASSERT ((x) != 0);                          \
-    (count) = __builtin_ctzl (x);               \
+#define count_trailing_zeros_gcc_ctz(count,x)  \
+  do {                                         \
+    ASSERT ((x) != 0);                         \
+    (count) = __builtin_ctzl (x);              \
   } while (0)
 #endif
 
@@ -223,27 +236,27 @@ along with this file.  If not, see http://www.gnu.org/licenses/.  */
   __asm__("cttz %1,%0" : "=r"(COUNT) : "r"(X))
 #endif /* clz/ctz using cix */
 
-#if ! defined (count_leading_zeros)                             \
+#if ! defined (count_leading_zeros)                            \
   && defined (__GNUC__) && ! defined (LONGLONG_STANDALONE)
 /* ALPHA_CMPBGE_0 gives "cmpbge $31,src,dst", ie. test src bytes == 0.
    "$31" is written explicitly in the asm, since an "r" constraint won't
    select reg 31.  There seems no need to worry about "r31" syntax for cray,
-   since gcc itself (pre-release 3.4) emits just $31 in various places.  */
-#define ALPHA_CMPBGE_0(dst, src)                                        \
+   since gcc itself (pre-release 3.4) emits just $31 in various places.         */
+#define ALPHA_CMPBGE_0(dst, src)                                       \
   do { asm ("cmpbge $31, %1, %0" : "=r" (dst) : "r" (src)); } while (0)
 /* Zero bytes are turned into bits with cmpbge, a __clz_tab lookup counts
    them, locating the highest non-zero byte.  A second __clz_tab lookup
    counts the leading zero bits in that byte, giving the result.  */
-#define count_leading_zeros(count, x)                                   \
-  do {                                                                  \
-    UWtype  __clz__b, __clz__c, __clz__x = (x);                         \
-    ALPHA_CMPBGE_0 (__clz__b,  __clz__x);           /* zero bytes */    \
-    __clz__b = __clz_tab [(__clz__b >> 1) ^ 0x7F];  /* 8 to 1 byte */   \
-    __clz__b = __clz__b * 8 - 7;                    /* 57 to 1 shift */ \
-    __clz__x >>= __clz__b;                                              \
-    __clz__c = __clz_tab [__clz__x];                /* 8 to 1 bit */    \
-    __clz__b = 65 - __clz__b;                                           \
-    (count) = __clz__b - __clz__c;                                      \
+#define count_leading_zeros(count, x)                                  \
+  do {                                                                 \
+    UWtype  __clz__b, __clz__c, __clz__x = (x);                                \
+    ALPHA_CMPBGE_0 (__clz__b,  __clz__x);          /* zero bytes */    \
+    __clz__b = __clz_tab [(__clz__b >> 1) ^ 0x7F];  /* 8 to 1 byte */  \
+    __clz__b = __clz__b * 8 - 7;                   /* 57 to 1 shift */ \
+    __clz__x >>= __clz__b;                                             \
+    __clz__c = __clz_tab [__clz__x];               /* 8 to 1 bit */    \
+    __clz__b = 65 - __clz__b;                                          \
+    (count) = __clz__b - __clz__c;                                     \
   } while (0)
 #define COUNT_LEADING_ZEROS_NEED_CLZ_TAB
 #endif /* clz using cmpbge */
@@ -299,14 +312,14 @@ long __MPN(count_leading_zeros) (UDItype);
    code using "al<bl" arithmetically comes out making an actual 0 or 1 in a
    register, which takes an extra cycle.  */
 #define sub_ddmmss(sh, sl, ah, al, bh, bl)      \
-  do {                                          \
-    UWtype __x;                                 \
-    __x = (al) - (bl);                          \
-    if ((al) < (bl))                            \
-      (sh) = (ah) - (bh) - 1;                   \
-    else                                        \
-      (sh) = (ah) - (bh);                       \
-    (sl) = __x;                                 \
+  do {                                         \
+    UWtype __x;                                        \
+    __x = (al) - (bl);                         \
+    if ((al) < (bl))                           \
+      (sh) = (ah) - (bh) - 1;                  \
+    else                                       \
+      (sh) = (ah) - (bh);                      \
+    (sl) = __x;                                        \
   } while (0)
 #if defined (__GNUC__) && ! defined (__INTEL_COMPILER)
 /* Do both product parts in assembly, since that gives better code with
@@ -514,7 +527,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
 #define UDIV_TIME 200
 #endif /* LONGLONG_STANDALONE */
 #endif
-/* This is a bizarre test, but GCC doesn't define useful common symbol. */
+/* This is a bizarre test, but GCC doesn't define any useful common symbol. */
 #if defined (__ARM_ARCH_5__)  || defined (__ARM_ARCH_5T__) || \
     defined (__ARM_ARCH_5E__) || defined (__ARM_ARCH_5TE__)|| \
     defined (__ARM_ARCH_6__)  || defined (__ARM_ARCH_6J__) || \
@@ -548,6 +561,8 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
   } while (0)
 #define count_leading_zeros(count, x) \
   __asm__ ("clz\t%0, %1" : "=r" (count) : "r" (x))
+#define count_trailing_zeros(count, x) \
+  __asm__ ("rbit\t%0, %1\n\tclz\t%0, %0" : "=r" (count) : "r" (x))
 #define COUNT_LEADING_ZEROS_0 64
 #endif /* __aarch64__ */
 
@@ -946,7 +961,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
    being 1 code byte smaller.  "31-__cbtmp" is a workaround, probably at the
    cost of one extra instruction.  Do this for "i386" too, since that means
    generic x86.  */
-#if ! defined (count_leading_zeros) && __GNUC__ < 3                     \
+#if ! defined (count_leading_zeros) && __GNUC__ < 3                    \
   && (HAVE_HOST_CPU_i386                                               \
       || HAVE_HOST_CPU_i686                                            \
       || HAVE_HOST_CPU_pentiumpro                                      \
@@ -1027,7 +1042,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
     ASSERT ((x) != 0);                                                 \
     __asm__ ("bsfq %1,%q0" : "=r" (count) : "rm" ((UDItype)(x)));      \
   } while (0)
-#endif /* x86_64 */
+#endif /* __amd64__ */
 
 #if defined (__i860__) && W_TYPE_SIZE == 32
 #define rshift_rhlc(r,h,l,c) \
@@ -1156,7 +1171,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
      || defined (__mc68030__) || defined (mc68030) \
      || defined (__mc68040__) || defined (mc68040) \
      || defined (__mc68060__) || defined (mc68060) \
-     || defined (__NeXT__))                        \
+     || defined (__NeXT__))                       \
   && ! defined (__mcpu32__)
 #define count_leading_zeros(count, x) \
   __asm__ ("bfffo %1{%b2:%b2},%0"                                      \
@@ -1309,37 +1324,37 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
    the system vendor compilers.  (Is that vendor compilers with inline asm,
    or what?)  */
 
-#if (HAVE_HOST_CPU_FAMILY_power || HAVE_HOST_CPU_FAMILY_powerpc)        \
+#if (HAVE_HOST_CPU_FAMILY_power || HAVE_HOST_CPU_FAMILY_powerpc)       \
   && W_TYPE_SIZE == 32
 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
   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));\
+      __asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2"                       \
+            : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl)); \
     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));\
+      __asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2"                       \
+            : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl)); \
     else                                                               \
-      __asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3"             \
+      __asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3"                     \
             : "=r" (sh), "=&r" (sl)                                    \
             : "r" (ah), "r" (bh), "%r" (al), "rI" (bl));               \
   } 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"     \
+      __asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2"                     \
               : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\
     else if (__builtin_constant_p (ah) && (ah) == ~(USItype) 0)                \
-      __asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2"     \
+      __asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2"                     \
               : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\
     else if (__builtin_constant_p (bh) && (bh) == 0)                   \
-      __asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2"              \
+      __asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2"                      \
               : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\
     else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0)                \
-      __asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2"              \
+      __asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2"                      \
               : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\
     else                                                               \
-      __asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2"   \
+      __asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2"                   \
               : "=r" (sh), "=&r" (sl)                                  \
               : "r" (ah), "r" (bh), "rI" (al), "r" (bl));              \
   } while (0)
@@ -1392,55 +1407,55 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
   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));\
+      __asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2"                       \
+            : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl)); \
     else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0)                \
-      __asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2"               \
-            : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\
+      __asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2"                       \
+            : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl)); \
     else                                                               \
-      __asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3"             \
+      __asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3"                     \
             : "=r" (sh), "=&r" (sl)                                    \
             : "r" (ah), "r" (bh), "%r" (al), "rI" (bl));               \
   } 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.  */
 #define sub_ddmmss(sh, sl, ah, al, bh, bl) \
-  do {                                                                       \
-    if (__builtin_constant_p (bl) && bl > -0x8000 && bl <= 0x8000) {         \
-       if (__builtin_constant_p (ah) && (ah) == 0)                           \
-         __asm__ ("addic %1,%3,%4\n\tsubfze %0,%2"                   \
+  do {                                                                 \
+    if (__builtin_constant_p (bl) && bl > -0x8000 && bl <= 0x8000) {   \
+       if (__builtin_constant_p (ah) && (ah) == 0)                     \
+         __asm__ ("addic %1,%3,%4\n\tsubfze %0,%2"                     \
                   : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "*rI" (-bl)); \
-       else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0)           \
-         __asm__ ("addic %1,%3,%4\n\tsubfme %0,%2"                   \
+       else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0)     \
+         __asm__ ("addic %1,%3,%4\n\tsubfme %0,%2"                     \
                   : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "*rI" (-bl)); \
-       else if (__builtin_constant_p (bh) && (bh) == 0)                      \
-         __asm__ ("addic %1,%3,%4\n\taddme %0,%2"                    \
+       else if (__builtin_constant_p (bh) && (bh) == 0)                \
+         __asm__ ("addic %1,%3,%4\n\taddme %0,%2"                      \
                   : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "*rI" (-bl)); \
-       else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0)           \
-         __asm__ ("addic %1,%3,%4\n\taddze %0,%2"                    \
+       else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0)     \
+         __asm__ ("addic %1,%3,%4\n\taddze %0,%2"                      \
                   : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "*rI" (-bl)); \
-       else                                                                  \
-         __asm__ ("addic %1,%4,%5\n\tsubfe %0,%3,%2"         \
-                  : "=r" (sh), "=&r" (sl)                                    \
-                  : "r" (ah), "r" (bh), "rI" (al), "*rI" (-bl));             \
-      } else {                                                               \
-       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));  \
-       else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0)           \
-         __asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2"        \
-                  : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));  \
-       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));  \
-       else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0)           \
-         __asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2"         \
-                  : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));  \
-       else                                                                  \
-         __asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2"              \
-                  : "=r" (sh), "=&r" (sl)                                    \
-                  : "r" (ah), "r" (bh), "rI" (al), "r" (bl));                \
-      }                                                                              \
+       else                                                            \
+         __asm__ ("addic %1,%4,%5\n\tsubfe %0,%3,%2"                   \
+                  : "=r" (sh), "=&r" (sl)                              \
+                  : "r" (ah), "r" (bh), "rI" (al), "*rI" (-bl));       \
+    } else {                                                           \
+       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)); \
+       else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0)     \
+         __asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2"                  \
+                  : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl)); \
+       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)); \
+       else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0)     \
+         __asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2"                   \
+                  : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl)); \
+       else                                                            \
+         __asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2"                \
+                  : "=r" (sh), "=&r" (sl)                              \
+                  : "r" (ah), "r" (bh), "rI" (al), "r" (bl));          \
+    }                                                                  \
   } while (0)
 #endif /* ! _LONG_LONG_LIMB */
 #define count_leading_zeros(count, x) \
@@ -1754,9 +1769,28 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
       "        subccc  %r6,%7,%%g0\n"                                          \
       "        subc    %r2,%3,%0"                                              \
          : "=r" (sh), "=&r" (sl)                                       \
-         : "rJ" (ah), "rI" (bh), "rJ" (al), "rI" (bl),         \
+         : "rJ" (ah), "rI" (bh), "rJ" (al), "rI" (bl),                 \
            "rJ" ((al) >> 32), "rI" ((bl) >> 32)                        \
           __CLOBBER_CC)
+#if __VIS__ >= 0x300
+#undef add_ssaaaa
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+  __asm__ (                                                            \
+       "addcc  %r4, %5, %1\n"                                          \
+      "        addxc   %r2, %r3, %0"                                           \
+         : "=r" (sh), "=&r" (sl)                                       \
+         : "rJ" (ah), "rJ" (bh), "%rJ" (al), "rI" (bl) __CLOBBER_CC)
+#define umul_ppmm(ph, pl, m0, m1) \
+  do {                                                                 \
+    UDItype __m0 = (m0), __m1 = (m1);                                  \
+    (pl) = __m0 * __m1;                                                        \
+    __asm__ ("umulxhi\t%2, %1, %0"                                     \
+            : "=r" (ph)                                                \
+            : "%r" (__m0), "r" (__m1));                                \
+  } while (0)
+#define count_leading_zeros(count, x) \
+  __asm__ ("lzd\t%1,%0" : "=r" (count) : "r" (x))
+#endif
 #endif
 
 #if (defined (__vax) || defined (__vax__)) && W_TYPE_SIZE == 32
@@ -1860,11 +1894,11 @@ extern UWtype mpn_umul_ppmm (UWtype *, UWtype, UWtype);
 
 #if ! defined (umul_ppmm) && HAVE_NATIVE_mpn_umul_ppmm  \
   && ! defined (LONGLONG_STANDALONE)
-#define umul_ppmm(wh, wl, u, v)                                                      \
-  do {                                                                       \
-    UWtype __umul_ppmm__p0;                                                  \
-    (wh) = mpn_umul_ppmm (&__umul_ppmm__p0, (UWtype) (u), (UWtype) (v));      \
-    (wl) = __umul_ppmm__p0;                                                  \
+#define umul_ppmm(wh, wl, u, v)                                                \
+  do {                                                                 \
+    UWtype __umul_ppmm__p0;                                            \
+    (wh) = mpn_umul_ppmm (&__umul_ppmm__p0, (UWtype) (u), (UWtype) (v));\
+    (wl) = __umul_ppmm__p0;                                            \
   } while (0)
 #endif
 
@@ -1873,11 +1907,11 @@ extern UWtype mpn_umul_ppmm_r (UWtype, UWtype, UWtype *);
 
 #if ! defined (umul_ppmm) && HAVE_NATIVE_mpn_umul_ppmm_r       \
   && ! defined (LONGLONG_STANDALONE)
-#define umul_ppmm(wh, wl, u, v)                                                      \
-  do {                                                                       \
-    UWtype __umul_ppmm__p0;                                                  \
-    (wh) = mpn_umul_ppmm_r ((UWtype) (u), (UWtype) (v), &__umul_ppmm__p0);    \
-    (wl) = __umul_ppmm__p0;                                                  \
+#define umul_ppmm(wh, wl, u, v)                                                \
+  do {                                                                 \
+    UWtype __umul_p0;                                                  \
+    (wh) = mpn_umul_ppmm_r ((UWtype) (u), (UWtype) (v), &__umul_p0);   \
+    (wl) = __umul_p0;                                                  \
   } while (0)
 #endif
 
@@ -1888,10 +1922,10 @@ extern UWtype mpn_udiv_qrnnd (UWtype *, UWtype, UWtype, UWtype);
   && ! defined (LONGLONG_STANDALONE)
 #define udiv_qrnnd(q, r, n1, n0, d)                                    \
   do {                                                                 \
-    UWtype __udiv_qrnnd__r;                                            \
-    (q) = mpn_udiv_qrnnd (&__udiv_qrnnd__r,                            \
+    UWtype __udiv_qrnnd_r;                                             \
+    (q) = mpn_udiv_qrnnd (&__udiv_qrnnd_r,                             \
                          (UWtype) (n1), (UWtype) (n0), (UWtype) d);    \
-    (r) = __udiv_qrnnd__r;                                             \
+    (r) = __udiv_qrnnd_r;                                              \
   } while (0)
 #endif
 
@@ -1902,10 +1936,10 @@ extern UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *);
   && ! defined (LONGLONG_STANDALONE)
 #define udiv_qrnnd(q, r, n1, n0, d)                                    \
   do {                                                                 \
-    UWtype __udiv_qrnnd__r;                                            \
+    UWtype __udiv_qrnnd_r;                                             \
     (q) = mpn_udiv_qrnnd_r ((UWtype) (n1), (UWtype) (n0), (UWtype) d,  \
-                           &__udiv_qrnnd__r);                          \
-    (r) = __udiv_qrnnd__r;                                             \
+                           &__udiv_qrnnd_r);                           \
+    (r) = __udiv_qrnnd_r;                                              \
   } while (0)
 #endif
 
@@ -1927,7 +1961,7 @@ extern UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *);
   do {                                                                 \
     UWtype __x;                                                                \
     __x = (al) - (bl);                                                 \
-    (sh) = (ah) - (bh) - ((al) < (bl));                                 \
+    (sh) = (ah) - (bh) - ((al) < (bl));                                        \
     (sl) = __x;                                                                \
   } while (0)
 #endif
index b9e858d74771a807f1b2881168e465d476a9305b..4475f37de37418d7e8b2ddbc39a04f042a912793 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -1,22 +1,32 @@
 /* Memory allocation routines.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2012 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 2000-2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <stdlib.h> /* for malloc, realloc, free */
@@ -39,7 +49,7 @@ __gmp_default_allocate (size_t size)
   void *ret;
 #ifdef DEBUG
   size_t req_size = size;
-  size += 2 * BYTES_PER_MP_LIMB;
+  size += 2 * GMP_LIMB_BYTES;
 #endif
   ret = malloc (size);
   if (ret == 0)
@@ -53,8 +63,8 @@ __gmp_default_allocate (size_t size)
     mp_ptr p = ret;
     p++;
     p[-1] = (0xdeadbeef << 31) + 0xdeafdeed;
-    if (req_size % BYTES_PER_MP_LIMB == 0)
-      p[req_size / BYTES_PER_MP_LIMB] = ~((0xdeadbeef << 31) + 0xdeafdeed);
+    if (req_size % GMP_LIMB_BYTES == 0)
+      p[req_size / GMP_LIMB_BYTES] = ~((0xdeadbeef << 31) + 0xdeafdeed);
     ret = p;
   }
 #endif
@@ -77,8 +87,8 @@ __gmp_default_reallocate (void *oldptr, size_t old_size, size_t new_size)
          fprintf (stderr, "gmp: (realloc) data clobbered before allocation block\n");
          abort ();
        }
-      if (old_size % BYTES_PER_MP_LIMB == 0)
-       if (p[old_size / BYTES_PER_MP_LIMB] != ~((0xdeadbeef << 31) + 0xdeafdeed))
+      if (old_size % GMP_LIMB_BYTES == 0)
+       if (p[old_size / GMP_LIMB_BYTES] != ~((0xdeadbeef << 31) + 0xdeafdeed))
          {
            fprintf (stderr, "gmp: (realloc) data clobbered after allocation block\n");
            abort ();
@@ -86,7 +96,7 @@ __gmp_default_reallocate (void *oldptr, size_t old_size, size_t new_size)
       oldptr = p - 1;
     }
 
-  new_size += 2 * BYTES_PER_MP_LIMB;
+  new_size += 2 * GMP_LIMB_BYTES;
 #endif
 
   ret = realloc (oldptr, new_size);
@@ -101,8 +111,8 @@ __gmp_default_reallocate (void *oldptr, size_t old_size, size_t new_size)
     mp_ptr p = ret;
     p++;
     p[-1] = (0xdeadbeef << 31) + 0xdeafdeed;
-    if (req_size % BYTES_PER_MP_LIMB == 0)
-      p[req_size / BYTES_PER_MP_LIMB] = ~((0xdeadbeef << 31) + 0xdeafdeed);
+    if (req_size % GMP_LIMB_BYTES == 0)
+      p[req_size / GMP_LIMB_BYTES] = ~((0xdeadbeef << 31) + 0xdeafdeed);
     ret = p;
   }
 #endif
@@ -122,8 +132,8 @@ __gmp_default_free (void *blk_ptr, size_t blk_size)
            fprintf (stderr, "gmp: (free) data clobbered before allocation block\n");
            abort ();
          }
-       if (blk_size % BYTES_PER_MP_LIMB == 0)
-         if (p[blk_size / BYTES_PER_MP_LIMB] != ~((0xdeadbeef << 31) + 0xdeafdeed))
+       if (blk_size % GMP_LIMB_BYTES == 0)
+         if (p[blk_size / GMP_LIMB_BYTES] != ~((0xdeadbeef << 31) + 0xdeafdeed))
            {
              fprintf (stderr, "gmp: (free) data clobbered after allocation block\n");
              abort ();
index a767d7cf085d42b98244f250ecd4f4b02e1c2ccb..f291489ea3eafcb80ef6df8b13c71f007b2b499e 100644 (file)
@@ -1,19 +1,30 @@
-Copyright 2011, 2012, 2013 Free Software Foundation, Inc.
+Copyright 2011-2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+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
index f3b43fbe844c37523c03907e121ea79a52d537c8..b9186951cbb5f8039d60a43cde33b9ab2ae06325 100644 (file)
@@ -2,24 +2,33 @@
 
    Contributed to the GNU project by Niels Möller
 
-Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
-Free Software Foundation, Inc.
+Copyright 1991-1997, 1999-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* NOTE: All functions in this file which are not declared in
    mini-gmp.h are internal, and are not intended to be compatible
@@ -222,11 +231,13 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
   } while (0)
 #define MPZ_SRCPTR_SWAP(x, y)                                          \
   do {                                                                 \
-    mpz_srcptr __mpz_srcptr_swap__tmp = (x);                   \
+    mpz_srcptr __mpz_srcptr_swap__tmp = (x);                           \
     (x) = (y);                                                         \
     (y) = __mpz_srcptr_swap__tmp;                                      \
   } while (0)
 
+const int mp_bits_per_limb = GMP_LIMB_BITS;
+
 \f
 /* Memory allocation and other helper functions. */
 static void
@@ -342,12 +353,10 @@ mpn_copyd (mp_ptr d, mp_srcptr s, mp_size_t n)
 int
 mpn_cmp (mp_srcptr ap, mp_srcptr bp, mp_size_t n)
 {
-  for (; n > 0; n--)
+  while (--n >= 0)
     {
-      if (ap[n-1] < bp[n-1])
-       return -1;
-      else if (ap[n-1] > bp[n-1])
-       return 1;
+      if (ap[n] != bp[n])
+       return ap[n] > bp[n] ? 1 : -1;
     }
   return 0;
 }
@@ -355,10 +364,8 @@ mpn_cmp (mp_srcptr ap, mp_srcptr bp, mp_size_t n)
 static int
 mpn_cmp4 (mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
 {
-  if (an > bn)
-    return 1;
-  else if (an < bn)
-    return -1;
+  if (an != bn)
+    return an < bn ? -1 : 1;
   else
     return mpn_cmp (ap, bp, an);
 }
@@ -373,20 +380,31 @@ mpn_normalized_size (mp_srcptr xp, mp_size_t n)
 
 #define mpn_zero_p(xp, n) (mpn_normalized_size ((xp), (n)) == 0)
 
+void
+mpn_zero (mp_ptr rp, mp_size_t n)
+{
+  mp_size_t i;
+
+  for (i = 0; i < n; i++)
+    rp[i] = 0;
+}
+
 mp_limb_t
 mpn_add_1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t b)
 {
   mp_size_t i;
 
   assert (n > 0);
-
-  for (i = 0; i < n; i++)
+  i = 0;
+  do
     {
       mp_limb_t r = ap[i] + b;
       /* Carry out */
       b = (r < b);
       rp[i] = r;
     }
+  while (++i < n);
+
   return b;
 }
 
@@ -429,7 +447,8 @@ mpn_sub_1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t b)
 
   assert (n > 0);
 
-  for (i = 0; i < n; i++)
+  i = 0;
+  do
     {
       mp_limb_t a = ap[i];
       /* Carry out */
@@ -437,6 +456,8 @@ mpn_sub_1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t b)
       rp[i] = a - b;
       b = cy;
     }
+  while (++i < n);
+
   return b;
 }
 
@@ -602,7 +623,7 @@ mpn_lshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
   retval = low_limb >> tnc;
   high_limb = (low_limb << cnt);
 
-  for (i = n - 1; i != 0; i--)
+  for (i = n; --i != 0;)
     {
       low_limb = *--up;
       *--rp = high_limb | (low_limb >> tnc);
@@ -630,7 +651,7 @@ mpn_rshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
   retval = (high_limb << tnc);
   low_limb = high_limb >> cnt;
 
-  for (i = n - 1; i != 0; i--)
+  for (i = n; --i != 0;)
     {
       high_limb = *up++;
       *rp++ = low_limb | (high_limb << tnc);
@@ -641,6 +662,46 @@ mpn_rshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
   return retval;
 }
 
+static mp_bitcnt_t
+mpn_common_scan (mp_limb_t limb, mp_size_t i, mp_srcptr up, mp_size_t un,
+                mp_limb_t ux)
+{
+  unsigned cnt;
+
+  assert (ux == 0 || ux == GMP_LIMB_MAX);
+  assert (0 <= i && i <= un );
+
+  while (limb == 0)
+    {
+      i++;
+      if (i == un)
+       return (ux == 0 ? ~(mp_bitcnt_t) 0 : un * GMP_LIMB_BITS);
+      limb = ux ^ up[i];
+    }
+  gmp_ctz (cnt, limb);
+  return (mp_bitcnt_t) i * GMP_LIMB_BITS + cnt;
+}
+
+mp_bitcnt_t
+mpn_scan1 (mp_srcptr ptr, mp_bitcnt_t bit)
+{
+  mp_size_t i;
+  i = bit / GMP_LIMB_BITS;
+
+  return mpn_common_scan ( ptr[i] & (GMP_LIMB_MAX << (bit % GMP_LIMB_BITS)),
+                         i, ptr, i, 0);
+}
+
+mp_bitcnt_t
+mpn_scan0 (mp_srcptr ptr, mp_bitcnt_t bit)
+{
+  mp_size_t i;
+  i = bit / GMP_LIMB_BITS;
+
+  return mpn_common_scan (~ptr[i] & (GMP_LIMB_MAX << (bit % GMP_LIMB_BITS)),
+                         i, ptr, i, GMP_LIMB_MAX);
+}
+
 \f
 /* MPN division interface. */
 mp_limb_t
@@ -715,8 +776,7 @@ mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0)
       if (r < th)
        {
          m--;
-         if (r > u1 || (r == u1 && tl > u0))
-           m--;
+         m -= ((r > u1) | ((r == u1) & (tl > u0)));
        }
     }
 
@@ -836,14 +896,20 @@ 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 > 1 && (d & (d-1)) == 0)
+  if ((d & (d-1)) == 0)
     {
-      unsigned shift;
       mp_limb_t r = np[0] & (d-1);
-      gmp_ctz (shift, d);
       if (qp)
-       mpn_rshift (qp, np, nn, shift);
-
+       {
+         if (d <= 1)
+           mpn_copyi (qp, np, nn);
+         else
+           {
+             unsigned shift;
+             gmp_ctz (shift, d);
+             mpn_rshift (qp, np, nn, shift);
+           }
+       }
       return r;
     }
   else
@@ -880,7 +946,8 @@ mpn_div_qr_2_preinv (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
 
   r0 = np[nn - 1];
 
-  for (i = nn - 2; i >= 0; i--)
+  i = nn - 2;
+  do
     {
       mp_limb_t n0, q;
       n0 = np[i];
@@ -889,6 +956,7 @@ mpn_div_qr_2_preinv (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
       if (qp)
        qp[i] = q;
     }
+  while (--i >= 0);
 
   if (shift > 0)
     {
@@ -941,7 +1009,8 @@ mpn_div_qr_pi1 (mp_ptr qp,
    * by            <d1,          d0,        dp[dn-3],  ..., dp[0] >
    */
 
-  for (i = nn - dn; i >= 0; i--)
+  i = nn - dn;
+  do
     {
       mp_limb_t n0 = np[dn-1+i];
 
@@ -973,6 +1042,7 @@ mpn_div_qr_pi1 (mp_ptr qp,
       if (qp)
        qp[i] = q;
     }
+  while (--i >= 0);
 
   np[dn - 1] = n1;
 }
@@ -1237,15 +1307,14 @@ mpn_set_str_other (mp_ptr rp, const unsigned char *sp, size_t sn,
 {
   mp_size_t rn;
   mp_limb_t w;
-  unsigned first;
   unsigned k;
   size_t j;
 
-  first = 1 + (sn - 1) % info->exp;
+  k = 1 + (sn - 1) % info->exp;
 
   j = 0;
   w = sp[j++];
-  for (k = 1; k < first; k++)
+  for (; --k > 0; )
     w = w * b + sp[j++];
 
   rp[0] = w;
@@ -1299,7 +1368,7 @@ mpz_init (mpz_t r)
 }
 
 /* The utility of this function is a bit limited, since many functions
-   assings the result variable using mpz_swap. */
+   assigns the result variable using mpz_swap. */
 void
 mpz_init2 (mpz_t r, mp_bitcnt_t bits)
 {
@@ -1421,7 +1490,7 @@ mpz_fits_ulong_p (const mpz_t u)
 {
   mp_size_t us = u->_mp_size;
 
-  return us == 0 || us == 1;
+  return (us == (us > 0));
 }
 
 long int
@@ -1458,6 +1527,48 @@ mpz_getlimbn (const mpz_t u, mp_size_t n)
     return 0;
 }
 
+void
+mpz_realloc2 (mpz_t x, mp_bitcnt_t n)
+{
+  mpz_realloc (x, 1 + (n - (n != 0)) / GMP_LIMB_BITS);
+}
+
+mp_srcptr
+mpz_limbs_read (mpz_srcptr x)
+{
+  return x->_mp_d;;
+}
+
+mp_ptr
+mpz_limbs_modify (mpz_t x, mp_size_t n)
+{
+  assert (n > 0);
+  return MPZ_REALLOC (x, n);
+}
+
+mp_ptr
+mpz_limbs_write (mpz_t x, mp_size_t n)
+{
+  return mpz_limbs_modify (x, n);
+}
+
+void
+mpz_limbs_finish (mpz_t x, mp_size_t xs)
+{
+  mp_size_t xn;
+  xn = mpn_normalized_size (x->_mp_d, GMP_ABS (xs));
+  x->_mp_size = xs < 0 ? -xn : xn;
+}
+
+mpz_srcptr
+mpz_roinit_n (mpz_t x, mp_srcptr xp, mp_size_t xs)
+{
+  x->_mp_alloc = 0;
+  x->_mp_d = (mp_ptr) xp;
+  mpz_limbs_finish (x, xs);
+  return x;
+}
+
 \f
 /* Conversions and comparison to double. */
 void
@@ -1472,19 +1583,15 @@ mpz_set_d (mpz_t r, double x)
 
   /* x != x is true when x is a NaN, and x == x * 0.5 is true when x is
      zero or infinity. */
-  if (x == 0.0 || x != x || x == x * 0.5)
+  if (x != x || x == x * 0.5)
     {
       r->_mp_size = 0;
       return;
     }
 
-  if (x < 0.0)
-    {
-      x = - x;
-      sign = 1;
-    }
-  else
-    sign = 0;
+  sign = x < 0.0 ;
+  if (sign)
+    x = - x;
 
   if (x < 1.0)
     {
@@ -1501,8 +1608,9 @@ mpz_set_d (mpz_t r, double x)
   f = (mp_limb_t) x;
   x -= f;
   assert (x < 1.0);
-  rp[rn-1] = f;
-  for (i = rn-1; i-- > 0; )
+  i = rn-1;
+  rp[i] = f;
+  while (--i >= 0)
     {
       x = B * x;
       f = (mp_limb_t) x;
@@ -1610,12 +1718,7 @@ mpz_sgn (const mpz_t u)
 {
   mp_size_t usize = u->_mp_size;
 
-  if (usize > 0)
-    return 1;
-  else if (usize < 0)
-    return -1;
-  else
-    return 0;
+  return (usize > 0) - (usize < 0);
 }
 
 int
@@ -1634,10 +1737,9 @@ mpz_cmp_si (const mpz_t u, long v)
       mp_limb_t ul = u->_mp_d[0];
       if ((mp_limb_t)GMP_NEG_CAST (unsigned long int, v) < ul)
        return -1;
-      else if ( (mp_limb_t)GMP_NEG_CAST (unsigned long int, v) > ul)
-       return 1;
+      else
+       return (mp_limb_t)GMP_NEG_CAST (unsigned long int, v) > ul;
     }
-  return 0;
 }
 
 int
@@ -1652,12 +1754,8 @@ mpz_cmp_ui (const mpz_t u, unsigned long v)
   else
     {
       mp_limb_t ul = (usize > 0) ? u->_mp_d[0] : 0;
-      if (ul > v)
-       return 1;
-      else if (ul < v)
-       return -1;
+      return (ul > v) - (ul < v);
     }
-  return 0;
 }
 
 int
@@ -1666,16 +1764,12 @@ mpz_cmp (const mpz_t a, const mpz_t b)
   mp_size_t asize = a->_mp_size;
   mp_size_t bsize = b->_mp_size;
 
-  if (asize > bsize)
-    return 1;
-  else if (asize < bsize)
-    return -1;
-  else if (asize > 0)
+  if (asize != bsize)
+    return (asize < bsize) ? -1 : 1;
+  else if (asize >= 0)
     return mpn_cmp (a->_mp_d, b->_mp_d, asize);
-  else if (asize < 0)
-    return -mpn_cmp (a->_mp_d, b->_mp_d, -asize);
   else
-    return 0;
+    return mpn_cmp (b->_mp_d, a->_mp_d, -asize);
 }
 
 int
@@ -1689,12 +1783,7 @@ mpz_cmpabs_ui (const mpz_t u, unsigned long v)
 
   ul = (un == 1) ? u->_mp_d[0] : 0;
 
-  if (ul > v)
-    return 1;
-  else if (ul < v)
-    return -1;
-  else
-    return 0;
+  return (ul > v) - (ul < v);
 }
 
 int
@@ -1752,7 +1841,7 @@ mpz_abs_add_ui (mpz_t r, const mpz_t a, unsigned long b)
 
   cy = mpn_add_1 (rp, a->_mp_d, an, b);
   rp[an] = cy;
-  an += (cy > 0);
+  an += cy;
 
   return an;
 }
@@ -1814,20 +1903,21 @@ mpz_abs_add (mpz_t r, const mpz_t a, const mpz_t b)
 {
   mp_size_t an = GMP_ABS (a->_mp_size);
   mp_size_t bn = GMP_ABS (b->_mp_size);
-  mp_size_t rn;
   mp_ptr rp;
   mp_limb_t cy;
 
-  rn = GMP_MAX (an, bn);
-  rp = MPZ_REALLOC (r, rn + 1);
-  if (an >= bn)
-    cy = mpn_add (rp, a->_mp_d, an, b->_mp_d, bn);
-  else
-    cy = mpn_add (rp, b->_mp_d, bn, a->_mp_d, an);
+  if (an < bn)
+    {
+      MPZ_SRCPTR_SWAP (a, b);
+      MP_SIZE_T_SWAP (an, bn);
+    }
+
+  rp = MPZ_REALLOC (r, an + 1);
+  cy = mpn_add (rp, a->_mp_d, an, b->_mp_d, bn);
 
-  rp[rn] = cy;
+  rp[an] = cy;
 
-  return rn + (cy > 0);
+  return an + cy;
 }
 
 static mp_size_t
@@ -1898,31 +1988,26 @@ mpz_mul_si (mpz_t r, const mpz_t u, long int v)
 void
 mpz_mul_ui (mpz_t r, const mpz_t u, unsigned long int v)
 {
-  mp_size_t un;
-  mpz_t t;
+  mp_size_t un, us;
   mp_ptr tp;
   mp_limb_t cy;
 
-  un = GMP_ABS (u->_mp_size);
+  us = u->_mp_size;
 
-  if (un == 0 || v == 0)
+  if (us == 0 || v == 0)
     {
       r->_mp_size = 0;
       return;
     }
 
-  mpz_init2 (t, (un + 1) * GMP_LIMB_BITS);
+  un = GMP_ABS (us);
 
-  tp = t->_mp_d;
+  tp = MPZ_REALLOC (r, un + 1);
   cy = mpn_mul_1 (tp, u->_mp_d, un, v);
   tp[un] = cy;
 
-  t->_mp_size = un + (cy > 0);
-  if (u->_mp_size < 0)
-    t->_mp_size = - t->_mp_size;
-
-  mpz_swap (r, t);
-  mpz_clear (t);
+  un += (cy > 0);
+  r->_mp_size = (us < 0) ? - un : un;
 }
 
 void
@@ -1933,8 +2018,8 @@ mpz_mul (mpz_t r, const mpz_t u, const mpz_t v)
   mpz_t t;
   mp_ptr tp;
 
-  un = GMP_ABS (u->_mp_size);
-  vn = GMP_ABS (v->_mp_size);
+  un = u->_mp_size;
+  vn = v->_mp_size;
 
   if (un == 0 || vn == 0)
     {
@@ -1942,7 +2027,10 @@ mpz_mul (mpz_t r, const mpz_t u, const mpz_t v)
       return;
     }
 
-  sign = (u->_mp_size ^ v->_mp_size) < 0;
+  sign = (un ^ vn) < 0;
+
+  un = GMP_ABS (un);
+  vn = GMP_ABS (vn);
 
   mpz_init2 (t, (un + vn) * GMP_LIMB_BITS);
 
@@ -1995,6 +2083,46 @@ mpz_mul_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bits)
   r->_mp_size = (u->_mp_size < 0) ? - rn : rn;
 }
 
+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_add (r, r, t);
+  mpz_clear (t);
+}
+
+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_sub (r, r, t);
+  mpz_clear (t);
+}
+
+void
+mpz_addmul (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mpz_t t;
+  mpz_init (t);
+  mpz_mul (t, u, v);
+  mpz_add (r, r, t);
+  mpz_clear (t);
+}
+
+void
+mpz_submul (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mpz_t t;
+  mpz_init (t);
+  mpz_mul (t, u, v);
+  mpz_sub (r, r, t);
+  mpz_clear (t);
+}
+
 \f
 /* MPZ division */
 enum mpz_div_round_mode { GMP_DIV_FLOOR, GMP_DIV_CEIL, GMP_DIV_TRUNC };
@@ -2059,8 +2187,7 @@ mpz_div_qr (mpz_t q, mpz_t r,
       mp_size_t qn, rn;
       mpz_t tq, tr;
 
-      mpz_init (tr);
-      mpz_set (tr, n);
+      mpz_init_set (tr, n);
       np = tr->_mp_d;
 
       qn = nn - dn + 1;
@@ -2170,10 +2297,7 @@ mpz_tdiv_r (mpz_t r, const mpz_t n, const mpz_t d)
 void
 mpz_mod (mpz_t r, const mpz_t n, const mpz_t d)
 {
-  if (d->_mp_size >= 0)
-    mpz_div_qr (NULL, r, n, d, GMP_DIV_FLOOR);
-  else
-    mpz_div_qr (NULL, r, n, d, GMP_DIV_CEIL);
+  mpz_div_qr (NULL, r, n, d, d->_mp_size >= 0 ? GMP_DIV_FLOOR : GMP_DIV_CEIL);
 }
 
 static void
@@ -2183,7 +2307,7 @@ mpz_div_q_2exp (mpz_t q, const mpz_t u, mp_bitcnt_t bit_index,
   mp_size_t un, qn;
   mp_size_t limb_cnt;
   mp_ptr qp;
-  mp_limb_t adjust;
+  int adjust;
 
   un = u->_mp_size;
   if (un == 0)
@@ -2225,7 +2349,8 @@ mpz_div_q_2exp (mpz_t q, const mpz_t u, mp_bitcnt_t bit_index,
 
   q->_mp_size = qn;
 
-  mpz_add_ui (q, q, adjust);
+  if (adjust)
+    mpz_add_ui (q, q, 1);
   if (un < 0)
     mpz_neg (q, q);
 }
@@ -2302,7 +2427,7 @@ mpz_div_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bit_index,
            {
              /* r > 0, need to flip sign. */
              rp[i] = ~rp[i] + 1;
-             for (i++; i < rn; i++)
+             while (++i < rn)
                rp[i] = ~rp[i];
 
              rp[rn-1] &= mask;
@@ -2365,6 +2490,24 @@ mpz_divisible_p (const mpz_t n, const mpz_t d)
   return mpz_div_qr (NULL, NULL, n, d, GMP_DIV_TRUNC) == 0;
 }
 
+int
+mpz_congruent_p (const mpz_t a, const mpz_t b, const mpz_t m)
+{
+  mpz_t t;
+  int res;
+
+  /* a == b (mod 0) iff a == b */
+  if (mpz_sgn (m) == 0)
+    return (mpz_cmp (a, b) == 0);
+
+  mpz_init (t);
+  mpz_sub (t, a, b);
+  res = mpz_divisible_p (t, m);
+  mpz_clear (t);
+
+  return res;
+}
+
 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)
@@ -2578,32 +2721,16 @@ mpz_gcd_ui (mpz_t g, const mpz_t u, unsigned long v)
 }
 
 static mp_bitcnt_t
-mpz_make_odd (mpz_t r, const mpz_t u)
+mpz_make_odd (mpz_t r)
 {
-  mp_size_t un, rn, i;
-  mp_ptr rp;
-  unsigned shift;
-
-  un = GMP_ABS (u->_mp_size);
-  assert (un > 0);
-
-  for (i = 0; u->_mp_d[i] == 0; i++)
-    ;
-
-  gmp_ctz (shift, u->_mp_d[i]);
+  mp_bitcnt_t shift;
 
-  rn = un - i;
-  rp = MPZ_REALLOC (r, rn);
-  if (shift > 0)
-    {
-      mpn_rshift (rp, u->_mp_d + i, rn, shift);
-      rn -= (rp[rn-1] == 0);
-    }
-  else
-    mpn_copyi (rp, u->_mp_d + i, rn);
+  assert (r->_mp_size > 0);
+  /* Count trailing zeros, equivalent to mpn_scan1, because we know that there is a 1 */
+  shift = mpn_common_scan (r->_mp_d[0], 0, r->_mp_d, 0, 0);
+  mpz_tdiv_q_2exp (r, r, shift);
 
-  r->_mp_size = rn;
-  return i * GMP_LIMB_BITS + shift;
+  return shift;
 }
 
 void
@@ -2626,8 +2753,10 @@ mpz_gcd (mpz_t g, const mpz_t u, const mpz_t v)
   mpz_init (tu);
   mpz_init (tv);
 
-  uz = mpz_make_odd (tu, u);
-  vz = mpz_make_odd (tv, v);
+  mpz_abs (tu, u);
+  uz = mpz_make_odd (tu);
+  mpz_abs (tv, v);
+  vz = mpz_make_odd (tv);
   gz = GMP_MIN (uz, vz);
 
   if (tu->_mp_size < tv->_mp_size)
@@ -2643,7 +2772,7 @@ mpz_gcd (mpz_t g, const mpz_t u, const mpz_t v)
       {
        int c;
 
-       mpz_make_odd (tu, tu);
+       mpz_make_odd (tu);
        c = mpz_cmp (tu, tv);
        if (c == 0)
          {
@@ -2705,8 +2834,10 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
   mpz_init (t0);
   mpz_init (t1);
 
-  uz = mpz_make_odd (tu, u);
-  vz = mpz_make_odd (tv, v);
+  mpz_abs (tu, u);
+  uz = mpz_make_odd (tu);
+  mpz_abs (tv, v);
+  vz = mpz_make_odd (tv);
   gz = GMP_MIN (uz, vz);
 
   uz -= gz;
@@ -2754,7 +2885,7 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
   if (tu->_mp_size > 0)
     {
       mp_bitcnt_t shift;
-      shift = mpz_make_odd (tu, tu);
+      shift = mpz_make_odd (tu);
       mpz_mul_2exp (t0, t0, shift);
       mpz_mul_2exp (s0, s0, shift);
       power += shift;
@@ -2777,7 +2908,7 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
              mpz_add (t0, t0, t1);
              mpz_add (s0, s0, s1);
 
-             shift = mpz_make_odd (tv, tv);
+             shift = mpz_make_odd (tv);
              mpz_mul_2exp (t1, t1, shift);
              mpz_mul_2exp (s1, s1, shift);
            }
@@ -2787,7 +2918,7 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
              mpz_add (t1, t0, t1);
              mpz_add (s1, s0, s1);
 
-             shift = mpz_make_odd (tu, tu);
+             shift = mpz_make_odd (tu);
              mpz_mul_2exp (t0, t0, shift);
              mpz_mul_2exp (s0, s0, shift);
            }
@@ -2925,12 +3056,16 @@ mpz_pow_ui (mpz_t r, const mpz_t b, unsigned long e)
   mpz_t tr;
   mpz_init_set_ui (tr, 1);
 
-  for (bit = GMP_ULONG_HIGHBIT; bit > 0; bit >>= 1)
+  bit = GMP_ULONG_HIGHBIT;
+  do
     {
       mpz_mul (tr, tr, tr);
       if (e & bit)
        mpz_mul (tr, tr, b);
+      bit >>= 1;
     }
+  while (bit > 0);
+
   mpz_swap (r, tr);
   mpz_clear (tr);
 }
@@ -2986,7 +3121,7 @@ mpz_powm (mpz_t r, const mpz_t b, const mpz_t e, const mpz_t m)
   if (e->_mp_size < 0)
     {
       if (!mpz_invert (base, b, m))
-       gmp_die ("mpz_powm: Negative exponent and non-invertibe base.");
+       gmp_die ("mpz_powm: Negative exponent and non-invertible base.");
     }
   else
     {
@@ -3018,7 +3153,8 @@ mpz_powm (mpz_t r, const mpz_t b, const mpz_t e, const mpz_t m)
       mp_limb_t w = e->_mp_d[en];
       mp_limb_t bit;
 
-      for (bit = GMP_LIMB_HIGHBIT; bit > 0; bit >>= 1)
+      bit = GMP_LIMB_HIGHBIT;
+      do
        {
          mpz_mul (tr, tr, tr);
          if (w & bit)
@@ -3028,7 +3164,9 @@ mpz_powm (mpz_t r, const mpz_t b, const mpz_t e, const mpz_t m)
              mpn_div_qr_preinv (NULL, tr->_mp_d, tr->_mp_size, mp, mn, &minv);
              tr->_mp_size = mpn_normalized_size (tr->_mp_d, mn);
            }
+         bit >>= 1;
        }
+      while (bit > 0);
     }
 
   /* Final reduction */
@@ -3063,21 +3201,26 @@ mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, unsigned long z)
   mpz_t t, u;
 
   sgn = y->_mp_size < 0;
-  if (sgn && (z & 1) == 0)
+  if ((~z & sgn) != 0)
     gmp_die ("mpz_rootrem: Negative argument, with even root.");
   if (z == 0)
     gmp_die ("mpz_rootrem: Zeroth root.");
 
   if (mpz_cmpabs_ui (y, 1) <= 0) {
-    mpz_set (x, y);
+    if (x)
+      mpz_set (x, y);
     if (r)
       r->_mp_size = 0;
     return;
   }
 
-  mpz_init (t);
   mpz_init (u);
-  mpz_setbit (t, mpz_sizeinbase (y, 2) / z + 1);
+  {
+    mp_bitcnt_t tb;
+    tb = mpz_sizeinbase (y, 2) / z + 1;
+    mpz_init2 (t, tb);
+    mpz_setbit (t, tb);
+  }
 
   if (z == 2) /* simplify sqrt loop: z-1 == 1 */
     do {
@@ -3109,7 +3252,8 @@ mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, unsigned long z)
     mpz_pow_ui (t, u, z);
     mpz_sub (r, y, t);
   }
-  mpz_swap (x, u);
+  if (x)
+    mpz_swap (x, u);
   mpz_clear (u);
   mpz_clear (t);
 }
@@ -3141,19 +3285,56 @@ mpz_sqrt (mpz_t s, const mpz_t u)
   mpz_rootrem (s, NULL, u, 2);
 }
 
+int
+mpz_perfect_square_p (const mpz_t u)
+{
+  if (u->_mp_size <= 0)
+    return (u->_mp_size == 0);
+  else
+    return mpz_root (NULL, u, 2);
+}
+
+int
+mpn_perfect_square_p (mp_srcptr p, mp_size_t n)
+{
+  mpz_t t;
+
+  assert (n > 0);
+  assert (p [n-1] != 0);
+  return mpz_root (NULL, mpz_roinit_n (t, p, n), 2);
+}
+
+mp_size_t
+mpn_sqrtrem (mp_ptr sp, mp_ptr rp, mp_srcptr p, mp_size_t n)
+{
+  mpz_t s, r, u;
+  mp_size_t res;
+
+  assert (n > 0);
+  assert (p [n-1] != 0);
+
+  mpz_init (r);
+  mpz_init (s);
+  mpz_rootrem (s, r, mpz_roinit_n (u, p, n), 2);
+
+  assert (s->_mp_size == (n+1)/2);
+  mpn_copyd (sp, s->_mp_d, s->_mp_size);
+  mpz_clear (s);
+  res = r->_mp_size;
+  if (rp)
+    mpn_copyd (rp, r->_mp_d, res);
+  mpz_clear (r);
+  return res;
+}
 \f
 /* Combinatorics */
 
 void
 mpz_fac_ui (mpz_t x, unsigned long n)
 {
-  if (n < 2) {
-    mpz_set_ui (x, 1);
-    return;
-  }
-  mpz_set_ui (x, n);
-  for (;--n > 1;)
-    mpz_mul_ui (x, x, n);
+  mpz_set_ui (x, n + (n == 0));
+  for (;n > 2;)
+    mpz_mul_ui (x, x, --n);
 }
 
 void
@@ -3161,25 +3342,123 @@ mpz_bin_uiui (mpz_t r, unsigned long n, unsigned long k)
 {
   mpz_t t;
 
-  if (k > n) {
-    r->_mp_size = 0;
-    return;
-  }
-  mpz_fac_ui (r, n);
+  mpz_set_ui (r, k <= n);
+
+  if (k > (n >> 1))
+    k = (k <= n) ? n - k : 0;
+
   mpz_init (t);
   mpz_fac_ui (t, k);
-  mpz_divexact (r, r, t);
-  mpz_fac_ui (t, n - k);
+
+  for (; k > 0; k--)
+      mpz_mul_ui (r, r, n--);
+
   mpz_divexact (r, r, t);
   mpz_clear (t);
 }
 
+\f
+/* Primality testing */
+static int
+gmp_millerrabin (const mpz_t n, const mpz_t nm1, mpz_t y,
+                const mpz_t q, mp_bitcnt_t k)
+{
+  assert (k > 0);
+
+  /* Caller must initialize y to the base. */
+  mpz_powm (y, y, q, n);
+
+  if (mpz_cmp_ui (y, 1) == 0 || mpz_cmp (y, nm1) == 0)
+    return 1;
+
+  while (--k > 0)
+    {
+      mpz_powm_ui (y, y, 2, n);
+      if (mpz_cmp (y, nm1) == 0)
+       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.
+        In either case, n is not prime. */
+      if (mpz_cmp_ui (y, 1) <= 0)
+       return 0;
+    }
+  return 0;
+}
+
+/* This product is 0xc0cfd797, and fits in 32 bits. */
+#define GMP_PRIME_PRODUCT \
+  (3UL*5UL*7UL*11UL*13UL*17UL*19UL*23UL*29UL)
+
+/* Bit (p+1)/2 is set, for each odd prime <= 61 */
+#define GMP_PRIME_MASK 0xc96996dcUL
+
+int
+mpz_probab_prime_p (const mpz_t n, int reps)
+{
+  mpz_t nm1;
+  mpz_t q;
+  mpz_t y;
+  mp_bitcnt_t k;
+  int is_prime;
+  int j;
+
+  /* Note that we use the absolute value of n only, for compatibility
+     with the real GMP. */
+  if (mpz_even_p (n))
+    return (mpz_cmpabs_ui (n, 2) == 0) ? 2 : 0;
+
+  /* Above test excludes n == 0 */
+  assert (n->_mp_size != 0);
+
+  if (mpz_cmpabs_ui (n, 64) < 0)
+    return (GMP_PRIME_MASK >> (n->_mp_d[0] >> 1)) & 2;
+
+  if (mpz_gcd_ui (NULL, n, GMP_PRIME_PRODUCT) != 1)
+    return 0;
+
+  /* All prime factors are >= 31. */
+  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);
+  k = mpz_scan1 (nm1, 0);
+  mpz_tdiv_q_2exp (q, nm1, k);
+
+  for (j = 0, is_prime = 1; is_prime & (j < reps); j++)
+    {
+      mpz_set_ui (y, (unsigned long) j*j+j+41);
+      if (mpz_cmp (y, nm1) >= 0)
+       {
+         /* Don't try any further bases. This "early" break does not affect
+            the result for any reasonable reps value (<=5000 was tested) */
+         assert (j >= 30);
+         break;
+       }
+      is_prime = gmp_millerrabin (n, nm1, y, q, k);
+    }
+  mpz_clear (nm1);
+  mpz_clear (q);
+  mpz_clear (y);
+
+  return is_prime;
+}
+
 \f
 /* Logical operations and bit manipulation. */
 
 /* Numbers are treated as if represented in two's complement (and
    infinitely sign extended). For a negative values we get the two's
-   complement from -x = ~x + 1, where ~ is bitwise complementt.
+   complement from -x = ~x + 1, where ~ is bitwise complement.
    Negation transforms
 
      xxxx10...0
@@ -3373,7 +3652,8 @@ mpz_and (mpz_t r, const mpz_t u, const mpz_t v)
   up = u->_mp_d;
   vp = v->_mp_d;
 
-  for (i = 0; i < vn; i++)
+  i = 0;
+  do
     {
       ul = (up[i] ^ ux) + uc;
       uc = ul < uc;
@@ -3385,6 +3665,7 @@ mpz_and (mpz_t r, const mpz_t u, const mpz_t v)
       rc = rl < rc;
       rp[i] = rl;
     }
+  while (++i < vn);
   assert (vc == 0);
 
   for (; i < rn; i++)
@@ -3444,7 +3725,8 @@ mpz_ior (mpz_t r, const mpz_t u, const mpz_t v)
   up = u->_mp_d;
   vp = v->_mp_d;
 
-  for (i = 0; i < vn; i++)
+  i = 0;
+  do
     {
       ul = (up[i] ^ ux) + uc;
       uc = ul < uc;
@@ -3456,6 +3738,7 @@ mpz_ior (mpz_t r, const mpz_t u, const mpz_t v)
       rc = rl < rc;
       rp[i] = rl;
     }
+  while (++i < vn);
   assert (vc == 0);
 
   for (; i < rn; i++)
@@ -3511,7 +3794,8 @@ mpz_xor (mpz_t r, const mpz_t u, const mpz_t v)
   up = u->_mp_d;
   vp = v->_mp_d;
 
-  for (i = 0; i < vn; i++)
+  i = 0;
+  do
     {
       ul = (up[i] ^ ux) + uc;
       uc = ul < uc;
@@ -3523,6 +3807,7 @@ mpz_xor (mpz_t r, const mpz_t u, const mpz_t v)
       rc = rl < rc;
       rp[i] = rl;
     }
+  while (++i < vn);
   assert (vc == 0);
 
   for (; i < un; i++)
@@ -3560,20 +3845,28 @@ gmp_popcount_limb (mp_limb_t x)
 }
 
 mp_bitcnt_t
-mpz_popcount (const mpz_t u)
+mpn_popcount (mp_srcptr p, mp_size_t n)
 {
-  mp_size_t un, i;
+  mp_size_t i;
   mp_bitcnt_t c;
 
+  for (c = 0, i = 0; i < n; i++)
+    c += gmp_popcount_limb (p[i]);
+
+  return c;
+}
+
+mp_bitcnt_t
+mpz_popcount (const mpz_t u)
+{
+  mp_size_t un;
+
   un = u->_mp_size;
 
   if (un < 0)
     return ~(mp_bitcnt_t) 0;
 
-  for (c = 0, i = 0; i < un; i++)
-    c += gmp_popcount_limb (u->_mp_d[i]);
-
-  return c;
+  return mpn_popcount (u->_mp_d, un);
 }
 
 mp_bitcnt_t
@@ -3590,16 +3883,13 @@ mpz_hamdist (const mpz_t u, const mpz_t v)
   if ( (un ^ vn) < 0)
     return ~(mp_bitcnt_t) 0;
 
-  if (un < 0)
+  comp = - (uc = vc = (un < 0));
+  if (uc)
     {
       assert (vn < 0);
       un = -un;
       vn = -vn;
-      uc = vc = 1;
-      comp = - (mp_limb_t) 1;
     }
-  else
-    uc = vc = comp = 0;
 
   up = u->_mp_d;
   vp = v->_mp_d;
@@ -3635,10 +3925,8 @@ mpz_scan1 (const mpz_t u, mp_bitcnt_t starting_bit)
 {
   mp_ptr up;
   mp_size_t us, un, i;
-  mp_limb_t limb, ux, uc;
-  unsigned cnt;
+  mp_limb_t limb, ux;
 
-  up = u->_mp_d;
   us = u->_mp_size;
   un = GMP_ABS (us);
   i = starting_bit / GMP_LIMB_BITS;
@@ -3648,36 +3936,24 @@ mpz_scan1 (const mpz_t u, mp_bitcnt_t starting_bit)
   if (i >= un)
     return (us >= 0 ? ~(mp_bitcnt_t) 0 : starting_bit);
 
-  if (us < 0)
-    {
-      ux = GMP_LIMB_MAX;
-      uc = mpn_zero_p (up, i);
-    }
-  else
-    ux = uc = 0;
-
-  limb = (ux ^ up[i]) + uc;
-  uc = limb < uc;
-
-  /* Mask to 0 all bits before starting_bit, thus ignoring them. */
-  limb &= (GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS));
+  up = u->_mp_d;
+  ux = 0;
+  limb = up[i];
 
-  while (limb == 0)
+  if (starting_bit != 0)
     {
-      i++;
-      if (i == un)
+      if (us < 0)
        {
-         assert (uc == 0);
-         /* For the u > 0 case, this can happen only for the first
-            masked limb. For the u < 0 case, it happens when the
-            highest limbs of the absolute value are all ones. */
-         return (us >= 0 ? ~(mp_bitcnt_t) 0 : un * GMP_LIMB_BITS);
+         ux = mpn_zero_p (up, i);
+         limb = ~ limb + ux;
+         ux = - (mp_limb_t) (limb >= ux);
        }
-      limb = (ux ^ up[i]) + uc;
-      uc = limb < uc;
+
+      /* Mask to 0 all bits before starting_bit, thus ignoring them. */
+      limb &= (GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS));
     }
-  gmp_ctz (cnt, limb);
-  return (mp_bitcnt_t) i * GMP_LIMB_BITS + cnt;
+
+  return mpn_common_scan (limb, i, up, un, ux);
 }
 
 mp_bitcnt_t
@@ -3685,46 +3961,28 @@ mpz_scan0 (const mpz_t u, mp_bitcnt_t starting_bit)
 {
   mp_ptr up;
   mp_size_t us, un, i;
-  mp_limb_t limb, ux, uc;
-  unsigned cnt;
+  mp_limb_t limb, ux;
 
-  up = u->_mp_d;
   us = u->_mp_size;
+  ux = - (mp_limb_t) (us >= 0);
   un = GMP_ABS (us);
   i = starting_bit / GMP_LIMB_BITS;
 
   /* When past end, there's an immediate 0 bit for u>=0, or no 0 bits for
      u<0.  Notice this test picks up all cases of u==0 too. */
   if (i >= un)
-    return (us >= 0 ? starting_bit : ~(mp_bitcnt_t) 0);
+    return (ux ? starting_bit : ~(mp_bitcnt_t) 0);
 
-  if (us < 0)
-    {
-      ux = GMP_LIMB_MAX;
-      uc = mpn_zero_p (up, i);
-    }
-  else
-    ux = uc = 0;
+  up = u->_mp_d;
+  limb = up[i] ^ ux;
 
-  limb = (ux ^ up[i]) + uc;
-  uc = limb < uc;
+  if (ux == 0)
+    limb -= mpn_zero_p (up, i); /* limb = ~(~limb + zero_p) */
 
-  /* Mask to 1 all bits before starting_bit, thus ignoring them. */
-  limb |= ((mp_limb_t) 1 << (starting_bit % GMP_LIMB_BITS)) - 1;
+  /* Mask all bits before starting_bit, thus ignoring them. */
+  limb &= (GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS));
 
-  while (limb == GMP_LIMB_MAX)
-    {
-      i++;
-      if (i == un)
-       {
-         assert (uc == 0);
-         return (us >= 0 ? un * GMP_LIMB_BITS : ~(mp_bitcnt_t) 0);
-       }
-      limb = (ux ^ up[i]) + uc;
-      uc = limb < uc;
-    }
-  gmp_ctz (cnt, ~limb);
-  return (mp_bitcnt_t) i * GMP_LIMB_BITS + cnt;
+  return mpn_common_scan (limb, i, up, un, ux);
 }
 
 \f
@@ -3770,11 +4028,15 @@ mpz_sizeinbase (const mpz_t u, int base)
   mpn_copyi (tp, up, un);
   mpn_div_qr_1_invert (&bi, base);
 
-  for (ndigits = 0; un > 0; ndigits++)
+  ndigits = 0;
+  do
     {
+      ndigits++;
       mpn_div_qr_1_preinv (tp, tp, un, &bi);
       un -= (tp[un-1] == 0);
     }
+  while (un > 0);
+
   gmp_free (tp);
   return ndigits;
 }
@@ -3851,7 +4113,6 @@ mpz_set_str (mpz_t r, const char *sp, int base)
   mp_size_t rn, alloc;
   mp_ptr rp;
   size_t sn;
-  size_t dn;
   int sign;
   unsigned char *dp;
 
@@ -3860,13 +4121,8 @@ mpz_set_str (mpz_t r, const char *sp, int base)
   while (isspace( (unsigned char) *sp))
     sp++;
 
-  if (*sp == '-')
-    {
-      sign = 1;
-      sp++;
-    }
-  else
-    sign = 0;
+  sign = (*sp == '-');
+  sp += sign;
 
   if (base == 0)
     {
@@ -3893,7 +4149,7 @@ mpz_set_str (mpz_t r, const char *sp, int base)
   sn = strlen (sp);
   dp = gmp_xalloc (sn + (sn == 0));
 
-  for (dn = 0; *sp; sp++)
+  for (sn = 0; *sp; sp++)
     {
       unsigned digit;
 
@@ -3915,7 +4171,7 @@ mpz_set_str (mpz_t r, const char *sp, int base)
          return -1;
        }
 
-      dp[dn++] = digit;
+      dp[sn++] = digit;
     }
 
   bits = mpn_base_power_of_two_p (base);
@@ -3924,7 +4180,7 @@ mpz_set_str (mpz_t r, const char *sp, int base)
     {
       alloc = (sn * bits + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
       rp = MPZ_REALLOC (r, alloc);
-      rn = mpn_set_str_bits (rp, dp, dn, bits);
+      rn = mpn_set_str_bits (rp, dp, sn, bits);
     }
   else
     {
@@ -3932,7 +4188,7 @@ mpz_set_str (mpz_t r, const char *sp, int base)
       mpn_get_base_info (&info, base);
       alloc = (sn + info.exp - 1) / info.exp;
       rp = MPZ_REALLOC (r, alloc);
-      rn = mpn_set_str_other (rp, dp, dn, base, &info);
+      rn = mpn_set_str_other (rp, dp, sn, base, &info);
     }
   assert (rn <= alloc);
   gmp_free (dp);
@@ -3966,14 +4222,9 @@ mpz_out_str (FILE *stream, int base, const mpz_t x)
 static int
 gmp_detect_endian (void)
 {
-  static const int i = 1;
+  static const int i = 2;
   const unsigned char *p = (const unsigned char *) &i;
-  if (*p == 1)
-    /* Little endian */
-    return -1;
-  else
-    /* Big endian */
-    return 1;
+  return 1 - *p;
 }
 
 /* Import and export. Does not support nails. */
@@ -4036,29 +4287,22 @@ mpz_import (mpz_t r, size_t count, int order, size_t size, int endian,
            }
        }
     }
-  if (bytes > 0)
+  assert (i + (bytes > 0) == rn);
+  if (limb != 0)
     rp[i++] = limb;
-  assert (i == rn);
+  else
+    i = mpn_normalized_size (rp, i);
 
-  r->_mp_size = mpn_normalized_size (rp, i);
+  r->_mp_size = i;
 }
 
 void *
 mpz_export (void *r, size_t *countp, int order, size_t size, int endian,
            size_t nails, const mpz_t u)
 {
-  unsigned char *p;
-  ptrdiff_t word_step;
-  size_t count, k;
+  size_t count;
   mp_size_t un;
 
-  /* The current (partial) limb. */
-  mp_limb_t limb;
-  /* The number of bytes left to to in this limb. */
-  size_t bytes;
-  /* The index where the limb was read. */
-  mp_size_t i;
-
   if (nails != 0)
     gmp_die ("mpz_import: Nails not supported.");
 
@@ -4066,62 +4310,74 @@ mpz_export (void *r, size_t *countp, int order, size_t size, int endian,
   assert (endian >= -1 && endian <= 1);
   assert (size > 0 || u->_mp_size == 0);
 
-  un = GMP_ABS (u->_mp_size);
-  if (un == 0)
-    {
-      if (countp)
-       *countp = 0;
-      return r;
-    }
+  un = u->_mp_size;
+  count = 0;
+  if (un != 0)
+    {
+      size_t k;
+      unsigned char *p;
+      ptrdiff_t word_step;
+      /* The current (partial) limb. */
+      mp_limb_t limb;
+      /* The number of bytes left to to in this limb. */
+      size_t bytes;
+      /* The index where the limb was read. */
+      mp_size_t i;
 
-  /* Count bytes in top limb. */
-  for (limb = u->_mp_d[un-1], k = 0; limb > 0; k++, limb >>= CHAR_BIT)
-    ;
+      un = GMP_ABS (un);
 
-  assert (k > 0);
+      /* Count bytes in top limb. */
+      limb = u->_mp_d[un-1];
+      assert (limb != 0);
 
-  count = (k + (un-1) * sizeof (mp_limb_t) + size - 1) / size;
+      k = 0;
+      do {
+       k++; limb >>= CHAR_BIT;
+      } while (limb != 0);
 
-  if (!r)
-    r = gmp_xalloc (count * size);
+      count = (k + (un-1) * sizeof (mp_limb_t) + size - 1) / size;
 
-  if (endian == 0)
-    endian = gmp_detect_endian ();
+      if (!r)
+       r = gmp_xalloc (count * size);
 
-  p = (unsigned char *) r;
+      if (endian == 0)
+       endian = gmp_detect_endian ();
 
-  word_step = (order != endian) ? 2 * size : 0;
+      p = (unsigned char *) r;
 
-  /* Process bytes from the least significant end, so point p at the
-     least significant word. */
-  if (order == 1)
-    {
-      p += size * (count - 1);
-      word_step = - word_step;
-    }
+      word_step = (order != endian) ? 2 * size : 0;
 
-  /* And at least significant byte of that word. */
-  if (endian == 1)
-    p += (size - 1);
+      /* Process bytes from the least significant end, so point p at the
+        least significant word. */
+      if (order == 1)
+       {
+         p += size * (count - 1);
+         word_step = - word_step;
+       }
 
-  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)
-         {
-           if (bytes == 0)
-             {
-               if (i < un)
-                 limb = u->_mp_d[i++];
-               bytes = sizeof (mp_limb_t);
-             }
-           *p = limb;
-           limb >>= CHAR_BIT;
-           bytes--;
-         }
-      }
-  assert (i == un);
-  assert (k == count);
+      /* And at least significant byte of that word. */
+      if (endian == 1)
+       p += (size - 1);
+
+      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)
+           {
+             if (bytes == 0)
+               {
+                 if (i < un)
+                   limb = u->_mp_d[i++];
+                 bytes = sizeof (mp_limb_t);
+               }
+             *p = limb;
+             limb >>= CHAR_BIT;
+             bytes--;
+           }
+       }
+      assert (i == un);
+      assert (k == count);
+    }
 
   if (countp)
     *countp = count;
index 8c94ca2ed0dd809f54d61762bbb7a199115c5bd9..c043ca7e661b9ad413b37a811229b6f7ad74ae59 100644 (file)
@@ -1,21 +1,32 @@
 /* mini-gmp, a minimalistic implementation of a GNU GMP subset.
 
-Copyright 2011, 2012, 2013 Free Software Foundation, Inc.
+Copyright 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* About mini-gmp: This is a minimal implementation of a subset of the
    GMP interface. It is intended for inclusion into applications which
@@ -64,8 +75,11 @@ typedef __mpz_struct mpz_t[1];
 typedef __mpz_struct *mpz_ptr;
 typedef const __mpz_struct *mpz_srcptr;
 
+extern const int mp_bits_per_limb;
+
 void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t);
 void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
+void mpn_zero (mp_ptr, mp_size_t);
 
 int mpn_cmp (mp_srcptr, mp_srcptr, mp_size_t);
 
@@ -84,10 +98,17 @@ mp_limb_t mpn_submul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
 mp_limb_t mpn_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
 void mpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
 void mpn_sqr (mp_ptr, mp_srcptr, mp_size_t);
+int mpn_perfect_square_p (mp_srcptr, mp_size_t);
+mp_size_t mpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t);
 
 mp_limb_t mpn_lshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
 mp_limb_t mpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
 
+mp_bitcnt_t mpn_scan0 (mp_srcptr, mp_bitcnt_t);
+mp_bitcnt_t mpn_scan1 (mp_srcptr, mp_bitcnt_t);
+
+mp_bitcnt_t mpn_popcount (mp_srcptr, mp_size_t);
+
 mp_limb_t mpn_invert_3by2 (mp_limb_t, mp_limb_t);
 #define mpn_invert_limb(x) mpn_invert_3by2 ((x), 0)
 
@@ -124,6 +145,10 @@ void mpz_mul_si (mpz_t, const mpz_t, long int);
 void mpz_mul_ui (mpz_t, const mpz_t, unsigned long int);
 void mpz_mul (mpz_t, const mpz_t, const mpz_t);
 void mpz_mul_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_addmul_ui (mpz_t, const mpz_t, unsigned long int);
+void mpz_addmul (mpz_t, const mpz_t, const mpz_t);
+void mpz_submul_ui (mpz_t, const mpz_t, unsigned long int);
+void mpz_submul (mpz_t, const mpz_t, const mpz_t);
 
 void mpz_cdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
 void mpz_fdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
@@ -147,6 +172,7 @@ void mpz_mod (mpz_t, const mpz_t, const mpz_t);
 void mpz_divexact (mpz_t, const mpz_t, const mpz_t);
 
 int mpz_divisible_p (const mpz_t, const mpz_t);
+int mpz_congruent_p (const mpz_t, const mpz_t, const mpz_t);
 
 unsigned long mpz_cdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
 unsigned long mpz_fdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
@@ -176,6 +202,7 @@ int mpz_invert (mpz_t, const mpz_t, const mpz_t);
 
 void mpz_sqrtrem (mpz_t, mpz_t, const mpz_t);
 void mpz_sqrt (mpz_t, const mpz_t);
+int mpz_perfect_square_p (const mpz_t);
 
 void mpz_pow_ui (mpz_t, const mpz_t, unsigned long);
 void mpz_ui_pow_ui (mpz_t, unsigned long, unsigned long);
@@ -188,6 +215,8 @@ int mpz_root (mpz_t, const mpz_t, unsigned long);
 void mpz_fac_ui (mpz_t, unsigned long);
 void mpz_bin_uiui (mpz_t, unsigned long, unsigned long);
 
+int mpz_probab_prime_p (const mpz_t, int);
+
 int mpz_tstbit (const mpz_t, mp_bitcnt_t);
 void mpz_setbit (mpz_t, mp_bitcnt_t);
 void mpz_clrbit (mpz_t, mp_bitcnt_t);
@@ -211,6 +240,15 @@ double mpz_get_d (const mpz_t);
 size_t mpz_size (const mpz_t);
 mp_limb_t mpz_getlimbn (const mpz_t, mp_size_t);
 
+void mpz_realloc2 (mpz_t, mp_bitcnt_t);
+mp_srcptr mpz_limbs_read (mpz_srcptr);
+mp_ptr mpz_limbs_modify (mpz_t, mp_size_t);
+mp_ptr mpz_limbs_write (mpz_t, mp_size_t);
+void mpz_limbs_finish (mpz_t, mp_size_t);
+mpz_srcptr mpz_roinit_n (mpz_t, mp_srcptr, mp_size_t);
+
+#define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }}
+
 void mpz_set_si (mpz_t, signed long int);
 void mpz_set_ui (mpz_t, unsigned long int);
 void mpz_set (mpz_t, const mpz_t);
index 2476f28f1c0025207f62581b0598334622fe87d2..fe052a02f7b8618fd3795a8636f2444f32431022 100644 (file)
@@ -1,6 +1,6 @@
 # Note: Requires GNU make
 
-# Copyright 2011, 2012 Free Software Foundation, Inc.
+# Copyright 2011, 2012, 2014 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
@@ -15,7 +15,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 
 srcdir=.
 MINI_GMP_DIR=..
@@ -30,7 +30,7 @@ LIBS = -lgmp -lm -lmcheck
 CHECK_PROGRAMS = t-add t-sub t-mul t-invert t-div t-div_2exp \
        t-double t-cmp_d t-gcd t-lcm t-import t-comb t-signed \
        t-sqrt t-root t-powm t-logops t-bitops t-scan t-str \
-       t-reuse
+       t-reuse t-aorsmul t-limbs t-cong t-pprime_p
 
 MISC_OBJS = hex-random.o mini-random.o testutils.o
 
index 53b4460b409000d03c8888128dd92a58f20d9a80..eb8d3f84ecca6e7bcc097cc73f82f31f06a58d41 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 996bc4bd8b624dedc24a35d7d557646eabcfa6e8..7a3913a0bc65daa97358cca1488f4e3dfc8ce022 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 enum hex_random_op
   {
index 87a9cea527738143e84d4f6f5b38f5347eac1fcc..300d386b2cbe9f0d6f0f5a374f0c55cbdefdd5f0 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index def83b092259cee46a350a5fa70bcf5592eeb0cf..f36c56fc82239ffa4104009ecadaf13e08b16b6a 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "mini-gmp.h"
 #include "hex-random.h"
index 3d5655cf382fe3b3b4465f3a2db683e090eb321b..5fc2952d76ad55855327dd7521d5065a1ff8332b 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# Copyright (C) 2000, 2001, 2002, 2004, 2005, 2011, 2012  Niels Möller
+# Copyright (C) 2000-2002, 2004, 2005, 2011, 2012  Niels Möller
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
index 0d3a0daaede3c495fd767e42e53260d02b487bf4..0a093efd90aec16adfe45a260c1e9f2e37560d4e 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -25,14 +25,6 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 #define MAXBITS 400
 #define COUNT 10000
 
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  testfree (buf);
-}
-
 void
 testmain (int argc, char **argv)
 {
diff --git a/mini-gmp/tests/t-aorsmul.c b/mini-gmp/tests/t-aorsmul.c
new file mode 100644 (file)
index 0000000..eb275a8
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+
+Copyright 2012, 2014, Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite 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 a copy of the GNU General Public License along with
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
+
+#include <limits.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "testutils.h"
+
+#define MAXBITS 400
+#define COUNT 10000
+
+#define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT)
+#define MAXLIMBS ((MAXBITS + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS)
+
+void
+testmain (int argc, char **argv)
+{
+  unsigned i;
+  mpz_t a, b, res, ref;
+
+  mpz_init (a);
+  mpz_init (b);
+  mpz_init_set_ui (res, 5);
+  mpz_init (ref);
+
+  for (i = 0; i < COUNT; i++)
+    {
+      mini_random_op3 (OP_MUL, MAXBITS, a, b, ref);
+      if (i & 1) {
+       mpz_add (ref, ref, res);
+       if (mpz_fits_ulong_p (b))
+         mpz_addmul_ui (res, a, mpz_get_ui (b));
+       else
+         mpz_addmul (res, a, b);
+      } else {
+       mpz_sub (ref, res, ref);
+       if (mpz_fits_ulong_p (b))
+         mpz_submul_ui (res, a, mpz_get_ui (b));
+       else
+         mpz_submul (res, a, b);
+      }
+      if (mpz_cmp (res, ref))
+       {
+         if (i & 1)
+           fprintf (stderr, "mpz_addmul failed:\n");
+         else
+           fprintf (stderr, "mpz_submul failed:\n");
+         dump ("a", a);
+         dump ("b", b);
+         dump ("r", res);
+         dump ("ref", ref);
+         abort ();
+       }
+    }
+  mpz_clear (a);
+  mpz_clear (b);
+  mpz_clear (res);
+  mpz_clear (ref);
+}
index 7d8bdc2418e93921029b12e9b7fe58b24fea3142..7e1688e66218fddf708daac015817caeb3d19dc8 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <limits.h>
 #include <stdlib.h>
@@ -26,14 +26,6 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 #define MAXBITS 400
 #define COUNT 10000
 
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  testfree (buf);
-}
-
 void
 testmain (int argc, char **argv)
 {
index c08e3a59118ab337b17d2bb1d24dda72596c6c47..4eab2785273d8a7ab3b69c0ee595616611052932 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mpz_cmp_d and mpz_cmpabs_d.
 
-Copyright 2001, 2002, 2003, 2005, 2013 Free Software Foundation, Inc.
+Copyright 2001-2003, 2005, 2013 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <math.h>
 
@@ -64,18 +64,6 @@ check_one (const char *name, mpz_srcptr x, double y, int cmp, int cmpabs)
     }
 }
 
-static void
-mpz_set_str_or_abort (mpz_ptr z, const char *str, int base)
-{
-  if (mpz_set_str (z, str, base) != 0)
-    {
-      fprintf (stderr, "ERROR: mpz_set_str failed\n");
-      fprintf (stderr, "   str  = \"%s\"\n", str);
-      fprintf (stderr, "   base = %d\n", base);
-      abort();
-    }
-}
-
 void
 check_data (void)
 {
index 2fe097d0d0a29bf608e5d439c670f19fac92fb71..31ee5a6ad66147e37aa0e77c6cd89ba70f489556 100644 (file)
@@ -1,6 +1,6 @@
 /* Exercise mpz_fac_ui and mpz_bin_uiui.
 
-Copyright 2000, 2001, 2002, 2012, 2013 Free Software Foundation, Inc.
+Copyright 2000-2002, 2012, 2013 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/mini-gmp/tests/t-cong.c b/mini-gmp/tests/t-cong.c
new file mode 100644 (file)
index 0000000..8ddfe9b
--- /dev/null
@@ -0,0 +1,212 @@
+/* test mpz_congruent_p
+
+Copyright 2001, 2002, 2012, 2014 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite 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 a copy of the GNU General Public License along with
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
+
+#include "testutils.h"
+
+#define MPZ_SRCPTR_SWAP(x, y)                                          \
+  do {                                                                 \
+    mpz_srcptr __mpz_srcptr_swap__tmp = (x);                           \
+    (x) = (y);                                                         \
+    (y) = __mpz_srcptr_swap__tmp;                                      \
+  } while (0)
+
+void
+check_one (mpz_srcptr a, mpz_srcptr c, mpz_srcptr d, int want)
+{
+  int   got;
+  int   swap;
+
+  for (swap = 0; swap <= 1; swap++)
+    {
+      got = (mpz_congruent_p (a, c, d) != 0);
+      if (want != got)
+       {
+         printf ("mpz_congruent_p wrong\n");
+         printf ("   expected %d got %d\n", want, got);
+         dump ("        a", a);
+         dump ("        c", c);
+         dump ("        d", d);
+         abort ();
+       }
+
+#if 0
+      if (mpz_fits_ulong_p (c) && mpz_fits_ulong_p (d))
+       {
+         unsigned long  uc = mpz_get_ui (c);
+         unsigned long  ud = mpz_get_ui (d);
+         got = (mpz_congruent_ui_p (a, uc, ud) != 0);
+         if (want != got)
+           {
+             printf    ("mpz_congruent_ui_p wrong\n");
+             printf    ("   expected %d got %d\n", want, got);
+             dump ("   a", a);
+             printf    ("   c=%lu\n", uc);
+             printf    ("   d=%lu\n", ud);
+             abort ();
+           }
+       }
+#endif
+      MPZ_SRCPTR_SWAP (a, c);
+    }
+}
+
+
+void
+check_data (void)
+{
+  static const struct {
+    const char *a;
+    const char *c;
+    const char *d;
+    int        want;
+
+  } data[] = {
+
+    /* strict equality mod 0 */
+    { "0", "0", "0", 1 },
+    { "11", "11", "0", 1 },
+    { "3", "11", "0", 0 },
+
+    /* anything congruent mod 1 */
+    { "0", "0", "1", 1 },
+    { "1", "0", "1", 1 },
+    { "0", "1", "1", 1 },
+    { "123", "456", "1", 1 },
+    { "0x123456789123456789", "0x987654321987654321", "1", 1 },
+
+    /* csize==1, dsize==2 changing to 1 after stripping 2s */
+    { "0x3333333333333333",  "0x33333333",
+      "0x180000000", 1 },
+    { "0x33333333333333333333333333333333", "0x3333333333333333",
+      "0x18000000000000000", 1 },
+
+    /* another dsize==2 becoming 1, with opposite signs this time */
+    {  "0x444444441",
+      "-0x22222221F",
+       "0x333333330", 1 },
+    {  "0x44444444444444441",
+      "-0x2222222222222221F",
+       "0x33333333333333330", 1 },
+  };
+
+  mpz_t   a, c, d;
+  int     i;
+
+  mpz_init (a);
+  mpz_init (c);
+  mpz_init (d);
+
+  for (i = 0; i < numberof (data); i++)
+    {
+      mpz_set_str_or_abort (a, data[i].a, 0);
+      mpz_set_str_or_abort (c, data[i].c, 0);
+      mpz_set_str_or_abort (d, data[i].d, 0);
+      check_one (a, c, d, data[i].want);
+    }
+
+  mpz_clear (a);
+  mpz_clear (c);
+  mpz_clear (d);
+}
+
+
+void
+check_random (int argc, char *argv[])
+{
+  mpz_t   a, c, d, ra, rc;
+  int     i;
+  int     want;
+  int     reps = 10000;
+  mpz_t bs;
+  unsigned long size_range, size;
+
+  if (argc >= 2)
+    reps = atoi (argv[1]);
+
+  mpz_init (bs);
+
+  mpz_init (a);
+  mpz_init (c);
+  mpz_init (d);
+  mpz_init (ra);
+  mpz_init (rc);
+
+  for (i = 0; i < reps; i++)
+    {
+      mini_urandomb (bs, 32);
+      size_range = mpz_get_ui (bs) % 13 + 1; /* 0..8192 bit operands */
+
+      mini_urandomb (bs, size_range);
+      size = mpz_get_ui (bs);
+      mini_rrandomb (a, size);
+
+      mini_urandomb (bs, 32);
+      size_range = mpz_get_ui (bs) % 13 + 1; /* 0..8192 bit operands */
+
+      mini_urandomb (bs, size_range);
+      size = mpz_get_ui (bs);
+      mini_rrandomb (c, size);
+
+      do
+       {
+         mini_urandomb (bs, 32);
+         size_range = mpz_get_ui (bs) % 13 + 1; /* 0..8192 bit operands */
+
+         mini_urandomb (bs, size_range);
+         size = mpz_get_ui (bs);
+         mini_rrandomb (d, size);
+       }
+      while (mpz_sgn(d) == 0);
+
+      mini_urandomb (bs, 3);
+      if (mpz_tstbit (bs, 0))
+       mpz_neg (a, a);
+      if (mpz_tstbit (bs, 1))
+       mpz_neg (c, c);
+      if (mpz_tstbit (bs, 2))
+       mpz_neg (d, d);
+
+      mpz_fdiv_r (ra, a, d);
+      mpz_fdiv_r (rc, c, d);
+
+      want = (mpz_cmp (ra, rc) == 0);
+      check_one (a, c, d, want);
+
+      mpz_sub (ra, ra, rc);
+      mpz_sub (a, a, ra);
+      check_one (a, c, d, 1);
+
+    }
+
+  mpz_clear (bs);
+
+  mpz_clear (a);
+  mpz_clear (c);
+  mpz_clear (d);
+  mpz_clear (ra);
+  mpz_clear (rc);
+}
+
+
+void
+testmain (int argc, char *argv[])
+{
+  check_data ();
+  check_random (argc, argv);
+}
index 1eece297fe4db84236ab982686cbab1564dd7e4a..a114a0f180c80f64cfe325c3bd093ad33ea62739 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <assert.h>
 #include <stdlib.h>
@@ -26,14 +26,6 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 #define MAXBITS 400
 #define COUNT 10000
 
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  testfree (buf);
-}
-
 typedef void div_qr_func (mpz_t, mpz_t, const mpz_t, const mpz_t);
 typedef unsigned long div_qr_ui_func (mpz_t, mpz_t, const mpz_t, unsigned long);
 typedef void div_func (mpz_t, const mpz_t, const mpz_t);
index c407f7fb51fb3d0e98772ec571929cf3925a6f32..53d3f2b84d9b1f8500e41a970d7cb4dc9e9f707c 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <assert.h>
 #include <stdlib.h>
@@ -26,14 +26,6 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 #define MAXBITS 400
 #define COUNT 10000
 
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  testfree (buf);
-}
-
 typedef void div_func (mpz_t, const mpz_t, mp_bitcnt_t);
 
 void
index e62345ec8ca40252476092cc587902c9de6bc1b6..9e8101ecfd432d85acc81dd890cbecbb07301b77 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <limits.h>
 #include <math.h>
@@ -29,14 +29,6 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 
 #define COUNT 10000
 
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  testfree (buf);
-}
-
 static const struct
 {
   double d;
index d70514de34370a1e918a1c6d07034670490f13be..1278000296a3893fee2e78295b87187703a322b6 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <limits.h>
 #include <stdlib.h>
@@ -26,14 +26,6 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 #define MAXBITS 400
 #define COUNT 10000
 
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  testfree (buf);
-}
-
 /* Called when g is supposed to be gcd(a,b), and g = s a + t b. */
 static int
 gcdext_valid_p (const mpz_t a, const mpz_t b,
index baefe6767b64883c84f17d705fc9b00d70169e92..66c9d5e8d5d6c7278565968ca32063546436eb33 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -26,14 +26,6 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 #define MAX_WORDS 20
 #define MAX_WORD_SIZE 10
 
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  testfree (buf);
-}
-
 static void
 dump_bytes (const char *label, const unsigned char *s, size_t n)
 {
index c6bc5c36a520b29db61d3dd51b4a2ffca78433fb..496e8d4f53c75a5968139cbeb0d4c4660a293bf6 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <limits.h>
 #include <stdlib.h>
@@ -27,14 +27,6 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 
 #define COUNT 10000
 
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  testfree (buf);
-}
-
 void
 testmain (int argc, char **argv)
 {
index dfb0916af7e8ef014ddd81e9d96857928ea829b0..f21a39a66a227eafe1396ef1e429ae29216c3e57 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <limits.h>
 #include <stdlib.h>
@@ -26,14 +26,6 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 #define MAXBITS 400
 #define COUNT 10000
 
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  testfree (buf);
-}
-
 void
 testmain (int argc, char **argv)
 {
diff --git a/mini-gmp/tests/t-limbs.c b/mini-gmp/tests/t-limbs.c
new file mode 100644 (file)
index 0000000..fa65782
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+
+Copyright 2012, 2014, Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite 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 a copy of the GNU General Public License along with
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
+
+#include <limits.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "testutils.h"
+
+#define MAXBITS 400
+#define COUNT 100
+
+void
+my_mpz_mul (mpz_t r, mpz_srcptr a,  mpz_srcptr b)
+{
+  mp_limb_t *tp;
+  mp_size_t tn, an, bn;
+
+  an = mpz_size (a);
+  bn = mpz_size (b);
+  tn = an + bn;
+
+  tp = mpz_limbs_write (r, tn);
+  if (mpz_sgn (a) * mpz_sgn(b) == 0)
+    mpn_zero (tp, tn);
+  else if (an > bn)
+    mpn_mul (tp, mpz_limbs_read (a), an, mpz_limbs_read (b), bn);
+  else
+    mpn_mul (tp, mpz_limbs_read (b), bn, mpz_limbs_read (a), an);
+
+  if (mpz_sgn (a) != mpz_sgn(b))
+    tn = - tn;
+
+  mpz_limbs_finish (r, tn);
+}
+
+void
+testmain (int argc, char **argv)
+{
+  unsigned i;
+  mpz_t a, b, t, res, ref;
+
+  mpz_init (a);
+  mpz_init (b);
+  mpz_init (res);
+  mpz_init (ref);
+
+  for (i = 0; i < COUNT; i++)
+    {
+      mini_random_op3 (OP_MUL, MAXBITS, a, b, ref);
+      my_mpz_mul (res, a, b);
+      if (mpz_cmp (res, ref))
+       {
+         fprintf (stderr, "my_mpz_mul failed:\n");
+         dump ("a", a);
+         dump ("b", b);
+         dump ("r", res);
+         dump ("ref", ref);
+         abort ();
+       }
+      /* The following test exploits a side-effect of my_mpz_mul: res
+        points to a buffer with at least an+bn limbs, and the limbs
+        above the result are zeroed. */
+      if (mpz_size (b) > 0 && mpz_getlimbn (res, mpz_size(a)) != mpz_limbs_read (res) [mpz_size(a)])
+       {
+         fprintf (stderr, "getlimbn - limbs_read differ.\n");
+         abort ();
+       }
+      if ((i % 4 == 0) && mpz_size (res) > 1)
+       {
+         mpz_realloc2 (res, 1);
+         if (mpz_cmp_ui (res, 0))
+           {
+             fprintf (stderr, "mpz_realloc2 did not clear res.\n");
+             abort ();
+           }
+         mpz_limbs_finish (ref, 0);
+         if (mpz_cmp_d (ref, 0))
+           {
+             fprintf (stderr, "mpz_limbs_finish did not clear res.\n");
+             abort ();
+           }
+       }
+    }
+  mpz_clear (a);
+  mpz_clear (b);
+  mpz_clear (res);
+  mpz_clear (ref);
+}
index 1b93ff21d5b025d691755d9f8fdc0da176776b2d..7e2d68187ab1f6b17791c0253a0c94c7c6eefa1d 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <limits.h>
 #include <stdlib.h>
@@ -26,14 +26,6 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 #define MAXBITS 400
 #define COUNT 10000
 
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  testfree (buf);
-}
-
 void
 testlogops (int count)
 {
index a36b73adb0ad816b359d46b31c4137d2ce3c0163..57ec4ed36cc344a115d1f13fff48882056df5a21 100644 (file)
@@ -1,6 +1,6 @@
 /*
 
-Copyright 2012, Free Software Foundation, Inc.
+Copyright 2012, 2014, Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <limits.h>
 #include <stdlib.h>
@@ -30,21 +30,13 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 #define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT)
 #define MAXLIMBS ((MAXBITS + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS)
 
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  testfree (buf);
-}
-
 void
 testmain (int argc, char **argv)
 {
   unsigned i;
-  mpz_t a, b, res, res_ui, ref;
+  mpz_t a, b, res, res_ui, ref, tz;
   mp_limb_t t[2*MAXLIMBS];
-  mp_size_t an, rn;
+  mp_size_t an;
 
   mpz_init (a);
   mpz_init (b);
@@ -67,13 +59,14 @@ testmain (int argc, char **argv)
        }
       if (mpz_size (a) == mpz_size (b))
        {
-         memset (t, 0, sizeof(t));
+         memset (t, 0x55, sizeof(t));
          an = mpz_size (a);
          if (an > 0)
            {
              mpn_mul_n (t, a->_mp_d, b->_mp_d, an);
-             rn = 2*an - (res->_mp_d[2*an-1] == 0);
-             if (rn != mpz_size (ref) || mpn_cmp (t, ref->_mp_d, rn))
+
+             mpz_roinit_n (tz, t, 2*an);
+             if (mpz_cmpabs (tz, ref))
                {
                  fprintf (stderr, "mpn_mul_n failed:\n");
                  dump ("a", a);
@@ -99,11 +92,11 @@ testmain (int argc, char **argv)
       an = mpz_size (a);
       if (an > 0)
        {
-         memset (t, 0, sizeof(t));
-         mpn_sqr (t, a->_mp_d, an);
+         memset (t, 0x33, sizeof(t));
+         mpn_sqr (t, mpz_limbs_read (a), an);
 
-         rn = 2*an - (t[2*an-1] == 0);
-         if (rn != mpz_size (ref) || mpn_cmp (t, ref->_mp_d, rn))
+         mpz_roinit_n (tz, t, 2*an);
+         if (mpz_cmp (tz, ref))
            {
              fprintf (stderr, "mpn (squaring) failed:\n");
              dump ("a", a);
index 9068d57fdc9d6e7ba9d21f0f468d133ea217f1c5..d6c108d47a7068f2f278993dbc7caecc3f0242a3 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <limits.h>
 #include <stdlib.h>
@@ -26,14 +26,6 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 #define MAXBITS 400
 #define COUNT 1000
 
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  testfree (buf);
-}
-
 void
 testmain (int argc, char **argv)
 {
diff --git a/mini-gmp/tests/t-pprime_p.c b/mini-gmp/tests/t-pprime_p.c
new file mode 100644 (file)
index 0000000..a7ffcdb
--- /dev/null
@@ -0,0 +1,182 @@
+/* test mpz_probab_prime_p
+
+Copyright 2001, 2002, 2004, 2011, 2012, 2014 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite 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 a copy of the GNU General Public License along with
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
+
+#include "testutils.h"
+
+static int
+isprime (unsigned long int t)
+{
+  unsigned long int q, r, d;
+
+  if (t < 32)
+    return (0xa08a28acUL >> t) & 1;
+  if ((t & 1) == 0)
+    return 0;
+
+  if (t % 3 == 0)
+    return 0;
+  if (t % 5 == 0)
+    return 0;
+  if (t % 7 == 0)
+    return 0;
+
+  for (d = 11;;)
+    {
+      q = t / d;
+      r = t - q * d;
+      if (q < d)
+       return 1;
+      if (r == 0)
+       break;
+      d += 2;
+      q = t / d;
+      r = t - q * d;
+      if (q < d)
+       return 1;
+      if (r == 0)
+       break;
+      d += 4;
+    }
+  return 0;
+}
+
+static void
+check_one (mpz_srcptr n, int want)
+{
+  int  got;
+
+  got = mpz_probab_prime_p (n, 25);
+
+  /* "definitely prime" is fine if we only wanted "probably prime" */
+  if (got == 2 && want == 1)
+    want = 2;
+
+  if (got != want)
+    {
+      printf ("mpz_probab_prime_p\n");
+      dump   ("  n    ", n);
+      printf ("  got =%d", got);
+      printf ("  want=%d\n", want);
+      abort ();
+    }
+}
+
+static void
+check_pn (mpz_ptr n, int want)
+{
+  check_one (n, want);
+  mpz_neg (n, n);
+  check_one (n, want);
+}
+
+static void
+check_small (void)
+{
+  mpz_t  n;
+  long   i;
+
+  mpz_init (n);
+
+  for (i = 0; i < 1700; i++)
+    {
+      mpz_set_si (n, i);
+      check_pn (n, isprime (i));
+    }
+
+  mpz_clear (n);
+}
+
+void
+check_composites (void)
+{
+  int i;
+  int reps = 1000;
+  mpz_t a, b, n, bs;
+  unsigned long size_range, size;
+
+  mpz_init (a);
+  mpz_init (b);
+  mpz_init (n);
+  mpz_init (bs);
+
+  for (i = 0; i < reps; i++)
+    {
+      mini_urandomb (bs, 32);
+      size_range = mpz_get_ui (bs) % 12 + 1; /* 0..4096 bit operands */
+
+      mini_urandomb (bs, size_range);
+      size = mpz_get_ui (bs);
+      mini_rrandomb (a, size);
+
+      mini_urandomb (bs, 32);
+      size_range = mpz_get_ui (bs) % 12 + 1; /* 0..4096 bit operands */
+      mini_rrandomb (b, size);
+
+      /* Exclude trivial factors */
+      if (mpz_cmp_ui (a, 1) == 0)
+       mpz_set_ui (a, 2);
+      if (mpz_cmp_ui (b, 1) == 0)
+       mpz_set_ui (b, 2);
+
+      mpz_mul (n, a, b);
+
+      check_pn (n, 0);
+    }
+  mpz_clear (a);
+  mpz_clear (b);
+  mpz_clear (n);
+  mpz_clear (bs);
+}
+
+static void
+check_primes (void)
+{
+  static const char * const primes[] = {
+    "2", "17", "65537",
+    /* diffie-hellman-group1-sha1, also "Well known group 2" in RFC
+       2412, 2^1024 - 2^960 - 1 + 2^64 * { [2^894 pi] + 129093 } */
+    "0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"
+    "29024E088A67CC74020BBEA63B139B22514A08798E3404DD"
+    "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"
+    "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED"
+    "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381"
+    "FFFFFFFFFFFFFFFF",
+    NULL
+  };
+
+  mpz_t n;
+  int i;
+
+  mpz_init (n);
+
+  for (i = 0; primes[i]; i++)
+    {
+      mpz_set_str_or_abort (n, primes[i], 0);
+      check_one (n, 1);
+    }
+  mpz_clear (n);
+}
+
+void
+testmain (int argc, char *argv[])
+{
+  check_small ();
+  check_composites ();
+  check_primes ();
+}
index 1bab241e4740038dbfc0f844206cbd420fa5b696..018f8fd632138f5398eb7a21bb493d92120438bb 100644 (file)
@@ -1,6 +1,6 @@
 /* Test that routines allow reusing a source variable as destination.
 
-Copyright 1996, 1999, 2000, 2001, 2002, 2009, 2012 Free Software Foundation, Inc.
+Copyright 1996, 1999-2002, 2009, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -25,7 +25,7 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 
 #define COUNT 100
 
-void dump (const char *, mpz_t, mpz_t, mpz_t);
+void dump3 (const char *, mpz_t, mpz_t, mpz_t);
 void mpz_check_format (const mpz_t);
 
 typedef void (*dss_func) (mpz_t, const mpz_t, const mpz_t);
@@ -133,12 +133,12 @@ const char *ds_func_names[] =
 #define FAIL(class,indx,op1,op2,op3) \
   do {                                                                 \
   class##_funcs[indx] = 0;                                             \
-  dump (class##_func_names[indx], op1, op2, op3);                      \
+  dump3 (class##_func_names[indx], op1, op2, op3);                     \
   failures++;                                                          \
   } while (0)
 #define FAIL2(fname,op1,op2,op3) \
   do {                                                                 \
-  dump (#fname, op1, op2, op3);                                                \
+  dump3 (#fname, op1, op2, op3);                                               \
   failures++;                                                          \
   } while (0)
 
@@ -625,7 +625,7 @@ testmain (int argc, char **argv)
 }
 
 void
-dump (const char *name, mpz_t in1, mpz_t in2, mpz_t in3)
+dump3 (const char *name, mpz_t in1, mpz_t in2, mpz_t in3)
 {
   printf ("failure in %s (", name);
   mpz_out_str (stdout, -16, in1);
index 45305e0dd6962e0b3fba59b5802920e289c8b7df..1f46c435c0c8eff6ede6609e6cff036d43086b63 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <limits.h>
 #include <stdlib.h>
@@ -26,14 +26,6 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 #define MAXBITS 400
 #define COUNT 10000
 
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  testfree (buf);
-}
-
 /* Called when s is supposed to be floor(root(u,z)), and r = u - s^z */
 static int
 rootrem_valid_p (const mpz_t u, const mpz_t s, const mpz_t r, unsigned long z)
@@ -46,7 +38,7 @@ rootrem_valid_p (const mpz_t u, const mpz_t s, const mpz_t r, unsigned long z)
   else
     mpz_pow_ui (t, s, z);
   mpz_sub (t, u, t);
-  if (mpz_sgn (t) != mpz_sgn(u) || mpz_cmp (t, r) != 0)
+  if ((mpz_sgn (t) != mpz_sgn(u) && mpz_sgn (t) != 0) || mpz_cmp (t, r) != 0)
     {
       mpz_clear (t);
       return 0;
@@ -82,7 +74,7 @@ testmain (int argc, char **argv)
     {
       mini_rrandomb (u, MAXBITS);
       mini_rrandomb (bs, 12);
-      e = mpz_getlimbn (bs, 0) % mpz_sizeinbase (u, 2) + 2;
+      e = mpz_getlimbn (bs, 0) % mpz_sizeinbase (u, 2) + 1;
       if ((e & 1) && (mpz_getlimbn (bs, 0) & (1L<<10)))
        mpz_neg (u, u);
       mpz_rootrem (s, r, u, e);
index d7e27ec859fdac62315d86fe96747a157298d38e..39b1f35cf4e7d3df90bf4e88f43722f37d0698c0 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <limits.h>
 #include <stdlib.h>
@@ -26,14 +26,6 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 #define MAXBITS 400
 #define COUNT 10000
 
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  testfree (buf);
-}
-
 void
 testmain (int argc, char **argv)
 {
@@ -56,6 +48,19 @@ testmain (int argc, char **argv)
          fprintf (stderr, "ref: %lu\n", ref);
          abort ();
        }
+      if (mpz_sgn (a) > 0 && ref < mpz_sizeinbase (a, 2))
+       {
+         res = mpn_scan0 (a->_mp_d, b);
+         if (res != ref)
+           {
+             fprintf (stderr, "mpn_scan0 failed:\n");
+             dump ("a", a);
+             fprintf (stderr, "b: %lu\n", b);
+             fprintf (stderr, "r: %lu\n", res);
+             fprintf (stderr, "ref: %lu\n", ref);
+             abort ();
+           }
+       }
       mini_random_scan_op (OP_SCAN1, MAXBITS, a, &b, &ref);
       res = mpz_scan1 (a, b);
       if (res != ref)
@@ -67,6 +72,19 @@ testmain (int argc, char **argv)
          fprintf (stderr, "ref: %lu\n", ref);
          abort ();
        }
+      if (mpz_sgn (a) > 0 && ref != ~ (mp_bitcnt_t) 0)
+       {
+         res = mpn_scan1 (a->_mp_d, b);
+         if (res != ref)
+           {
+             fprintf (stderr, "mpn_scan1 failed:\n");
+             dump ("a", a);
+             fprintf (stderr, "b: %lu\n", b);
+             fprintf (stderr, "r: %lu\n", res);
+             fprintf (stderr, "ref: %lu\n", ref);
+             abort ();
+           }
+       }
     }
   mpz_clear (a);
 }
index 3fe54a2fcc2527150ba52b6efe1a8291abb3df88..e2502d6e9fd4cdad0947cee59d7d01d6073b8766 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 980ae3574f207d39c35a88e379af69d249833e49..f4ce7cbb4dc711f859d2a2c12bd0d210b636127d 100644 (file)
@@ -1,6 +1,6 @@
 /*
 
-Copyright 2012, Free Software Foundation, Inc.
+Copyright 2012, 2014, Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <limits.h>
 #include <stdlib.h>
@@ -24,15 +24,7 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 #include "testutils.h"
 
 #define MAXBITS 400
-#define COUNT 10000
-
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  testfree (buf);
-}
+#define COUNT 9000
 
 /* Called when s is supposed to be floor(sqrt(u)), and r = u - s^2 */
 static int
@@ -60,19 +52,80 @@ sqrtrem_valid_p (const mpz_t u, const mpz_t s, const mpz_t r)
   return 1;
 }
 
+void
+mpz_mpn_sqrtrem (mpz_t s, mpz_t r, const mpz_t u)
+{
+  mp_limb_t *sp, *rp;
+  mp_size_t un, sn, ret;
+
+  un = mpz_size (u);
+
+  mpz_xor (s, s, u);
+  sn = (un + 1) / 2;
+  sp = mpz_limbs_write (s, sn + 1);
+  sp [sn] = 11;
+
+  if (un & 1)
+    rp = NULL; /* Exploits the fact that r already is correct. */
+  else {
+    mpz_add (r, u, s);
+    rp = mpz_limbs_write (r, un + 1);
+    rp [un] = 19;
+  }
+
+  ret = mpn_sqrtrem (sp, rp, mpz_limbs_read (u), un);
+
+  if (sp [sn] != 11)
+    {
+      fprintf (stderr, "mpn_sqrtrem buffer overrun on sp.\n");
+      abort ();
+    }
+  if (un & 1) {
+    if ((ret != 0) != (mpz_size (r) != 0)) {
+      fprintf (stderr, "mpn_sqrtrem wrong return value with NULL.\n");
+      abort ();
+    }
+  } else {
+    mpz_limbs_finish (r, ret);
+    if (ret != mpz_size (r)) {
+      fprintf (stderr, "mpn_sqrtrem wrong return value.\n");
+      abort ();
+    }
+    if (rp [un] != 19)
+      {
+       fprintf (stderr, "mpn_sqrtrem buffer overrun on rp.\n");
+       abort ();
+      }
+  }
+
+  mpz_limbs_finish (s, (un + 1) / 2);
+}
+
 void
 testmain (int argc, char **argv)
 {
   unsigned i;
   mpz_t u, s, r;
 
-  mpz_init (u);
   mpz_init (s);
   mpz_init (r);
 
+  mpz_init_set_si (u, -1);
+  if (mpz_perfect_square_p (u))
+    {
+      fprintf (stderr, "mpz_perfect_square_p failed on -1.\n");
+      abort ();
+    }
+
+  if (!mpz_perfect_square_p (s))
+    {
+      fprintf (stderr, "mpz_perfect_square_p failed on 0.\n");
+      abort ();
+    }
+
   for (i = 0; i < COUNT; i++)
     {
-      mini_rrandomb (u, MAXBITS);
+      mini_rrandomb (u, MAXBITS - (i & 0xFF));
       mpz_sqrtrem (s, r, u);
 
       if (!sqrtrem_valid_p (u, s, r))
@@ -83,6 +136,44 @@ testmain (int argc, char **argv)
          dump ("rem", r);
          abort ();
        }
+
+      mpz_mpn_sqrtrem (s, r, u);
+
+      if (!sqrtrem_valid_p (u, s, r))
+       {
+         fprintf (stderr, "mpn_sqrtrem failed:\n");
+         dump ("u", u);
+         dump ("sqrt", s);
+         dump ("rem", r);
+         abort ();
+       }
+
+      if (mpz_sgn (r) == 0) {
+       mpz_neg (u, u);
+       mpz_sub_ui (u, u, 1);
+      }
+
+      if ((mpz_sgn (u) <= 0 || (i & 1)) ?
+         mpz_perfect_square_p (u) :
+         mpn_perfect_square_p (mpz_limbs_read (u), mpz_size (u)))
+       {
+         fprintf (stderr, "mp%s_perfect_square_p failed on non square:\n",
+                  (mpz_sgn (u) <= 0 || (i & 1)) ? "z" : "n");
+         dump ("u", u);
+         abort ();
+       }
+
+      mpz_mul (u, s, s);
+      if (!((mpz_sgn (u) <= 0 || (i & 1)) ?
+           mpz_perfect_square_p (u) :
+           mpn_perfect_square_p (mpz_limbs_read (u), mpz_size (u))))
+       {
+         fprintf (stderr, "mp%s_perfect_square_p failed on square:\n",
+                  (mpz_sgn (u) <= 0 || (i & 1)) ? "z" : "n");
+         dump ("u", u);
+         abort ();
+       }
+
     }
   mpz_clear (u);
   mpz_clear (s);
index 00f82ab6c7bf676cc13796cb66fbace39ab960c3..2c384bd1d2c785813973234f4ebb0a898fad1f25 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <assert.h>
 #include <limits.h>
@@ -31,14 +31,6 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 #define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT)
 #define MAXLIMBS ((MAXBITS + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS)
 
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  testfree (buf);
-}
-
 static void
 test_small (void)
 {
index 2a1e113cc1c8383369f7d59b514025b4ed51bdfd..e230fda1fb5a26a5699189f8afe9240ac559702d 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -25,14 +25,6 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 #define MAXBITS 400
 #define COUNT 10000
 
-static void
-dump (const char *label, const mpz_t x)
-{
-  char *buf = mpz_get_str (NULL, 16, x);
-  fprintf (stderr, "%s: %s\n", label, buf);
-  free (buf);
-}
-
 void
 testmain (int argc, char **argv)
 {
index 7e0f09df88b971402f7c2cfef3557fbc6e06813b..c3840b36bc65b183ed9b22cd6bea9fe502f9bcb0 100644 (file)
@@ -1,6 +1,6 @@
 /*
 
-Copyright 2013, Free Software Foundation, Inc.
+Copyright 2013, 2014, Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "testutils.h"
 
@@ -151,3 +151,23 @@ testhalves (int count, void (*tested_fun) (int))
   (*tested_fun) (count / 2);
   mp_set_memory_functions (allocfunc, reallocfunc, freefunc);
 }
+
+void
+dump (const char *label, const mpz_t x)
+{
+  char *buf = mpz_get_str (NULL, 16, x);
+  fprintf (stderr, "%s: %s\n", label, buf);
+  testfree (buf);
+}
+
+void
+mpz_set_str_or_abort (mpz_ptr z, const char *str, int base)
+{
+  if (mpz_set_str (z, str, base) != 0)
+    {
+      fprintf (stderr, "ERROR: mpz_set_str failed\n");
+      fprintf (stderr, "   str  = \"%s\"\n", str);
+      fprintf (stderr, "   base = %d\n", base);
+      abort();
+    }
+}
index 4b22b94c183993cc1c2a44e74a0c7af66b5ee336..bc56c06a759862b769e88c7d586d357e0c02bd6c 100644 (file)
@@ -1,6 +1,6 @@
 /*
 
-Copyright 2013, Free Software Foundation, Inc.
+Copyright 2013, 2014, Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -29,3 +29,9 @@ void testmain (int argc, char **argv);
 void testhalves (int count, void (*tested_fun) (int));
 
 void testfree (void *p);
+
+void
+dump (const char *label, const mpz_t x);
+
+void
+mpz_set_str_or_abort (mpz_ptr z, const char *str, int base);
diff --git a/missing b/missing
index c3a0147fecb0e5cf719a28efd03b54017b471984..86a8fc31e3c2aa268688a5be47d161c586772e78 100755 (executable)
--- a/missing
+++ b/missing
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Common stub for a few missing GNU programs while installing.
 
-scriptversion=2009-11-15.01
+scriptversion=2012-01-06.13; # UTC
 
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003
-#   Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
@@ -18,9 +18,7 @@ scriptversion=2009-11-15.01
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -33,6 +31,8 @@ if test $# -eq 0; then
 fi
 
 run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
 
 # In the cases where this matters, `missing' is being run in the
 # srcdir already.
@@ -44,7 +44,7 @@ fi
 
 msg="missing on your system"
 
-case "$1" in
+case $1 in
 --run)
   # Try to run requested program, and just exit if it succeeds.
   run=
@@ -60,11 +60,6 @@ case "$1" in
     msg="probably too old"
   fi
   ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case "$1" in
 
   -h|--h|--he|--hel|--help)
     echo "\
@@ -82,20 +77,25 @@ Supported PROGRAM values:
   aclocal      touch file \`aclocal.m4'
   autoconf     touch file \`configure'
   autoheader   touch file \`config.h.in'
+  autom4te     touch the output file, or create a stub one
   automake     touch all \`Makefile.in' files
   bison        create \`y.tab.[ch]', if possible, from existing .[ch]
   flex         create \`lex.yy.c', if possible, from existing .c
   help2man     touch the output file
   lex          create \`lex.yy.c', if possible, from existing .c
   makeinfo     touch the output file
-  tar          try tar, gnutar, gtar, then tar without non-portable flags
   yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
 
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
 Send bug reports to <bug-automake@gnu.org>."
+    exit $?
     ;;
 
   -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
     echo "missing $scriptversion (GNU Automake)"
+    exit $?
     ;;
 
   -*)
@@ -104,12 +104,40 @@ Send bug reports to <bug-automake@gnu.org>."
     exit 1
     ;;
 
-  aclocal*)
+esac
+
+# normalize program name to check for.
+program=`echo "$1" | sed '
+  s/^gnu-//; t
+  s/^gnu//; t
+  s/^g//; t'`
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).  This is about non-GNU programs, so use $1 not
+# $program.
+case $1 in
+  lex*|yacc*)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  *)
     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
        # We have it, but it failed.
        exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
     fi
+    ;;
+esac
 
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $program in
+  aclocal*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
@@ -118,12 +146,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     touch aclocal.m4
     ;;
 
-  autoconf)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
+  autoconf*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`${configure_ac}'.  You might want to install the
@@ -132,12 +155,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     touch configure
     ;;
 
-  autoheader)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
+  autoheader*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`acconfig.h' or \`${configure_ac}'.  You might want
@@ -147,7 +165,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     test -z "$files" && files="config.h"
     touch_files=
     for f in $files; do
-      case "$f" in
+      case $f in
       *:*) touch_files="$touch_files "`echo "$f" |
                                       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
       *) touch_files="$touch_files $f.in";;
@@ -157,11 +175,6 @@ WARNING: \`$1' is $msg.  You should only need it if
     ;;
 
   automake*)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
@@ -172,12 +185,7 @@ WARNING: \`$1' is $msg.  You should only need it if
           while read f; do touch "$f"; done
     ;;
 
-  autom4te)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
+  autom4te*)
     echo 1>&2 "\
 WARNING: \`$1' is needed, but is $msg.
          You might have modified some files without having the
@@ -185,8 +193,8 @@ WARNING: \`$1' is needed, but is $msg.
          You can get \`$1' as part of \`Autoconf' from any GNU
          archive site."
 
-    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
-    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
     if test -f "$file"; then
        touch $file
     else
@@ -200,90 +208,78 @@ WARNING: \`$1' is needed, but is $msg.
     fi
     ;;
 
-  bison|yacc)
+  bison*|yacc*)
     echo 1>&2 "\
 WARNING: \`$1' $msg.  You should only need it if
          you modified a \`.y' file.  You may need the \`Bison' package
          in order for those modifications to take effect.  You can get
          \`Bison' from any GNU archive site."
     rm -f y.tab.c y.tab.h
-    if [ $# -ne 1 ]; then
-        eval LASTARG="\${$#}"
-       case "$LASTARG" in
+    if test $# -ne 1; then
+        eval LASTARG=\${$#}
+       case $LASTARG in
        *.y)
            SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
-           if [ -f "$SRCFILE" ]; then
+           if test -f "$SRCFILE"; then
                 cp "$SRCFILE" y.tab.c
            fi
            SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
-           if [ -f "$SRCFILE" ]; then
+           if test -f "$SRCFILE"; then
                 cp "$SRCFILE" y.tab.h
            fi
          ;;
        esac
     fi
-    if [ ! -f y.tab.h ]; then
+    if test ! -f y.tab.h; then
        echo >y.tab.h
     fi
-    if [ ! -f y.tab.c ]; then
+    if test ! -f y.tab.c; then
        echo 'main() { return 0; }' >y.tab.c
     fi
     ;;
 
-  lex|flex)
+  lex*|flex*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified a \`.l' file.  You may need the \`Flex' package
          in order for those modifications to take effect.  You can get
          \`Flex' from any GNU archive site."
     rm -f lex.yy.c
-    if [ $# -ne 1 ]; then
-        eval LASTARG="\${$#}"
-       case "$LASTARG" in
+    if test $# -ne 1; then
+        eval LASTARG=\${$#}
+       case $LASTARG in
        *.l)
            SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
-           if [ -f "$SRCFILE" ]; then
+           if test -f "$SRCFILE"; then
                 cp "$SRCFILE" lex.yy.c
            fi
          ;;
        esac
     fi
-    if [ ! -f lex.yy.c ]; then
+    if test ! -f lex.yy.c; then
        echo 'main() { return 0; }' >lex.yy.c
     fi
     ;;
 
-  help2man)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
+  help2man*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
         you modified a dependency of a manual page.  You may need the
         \`Help2man' package in order for those modifications to take
         effect.  You can get \`Help2man' from any GNU archive site."
 
-    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
-    if test -z "$file"; then
-       file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
-    fi
-    if [ -f "$file" ]; then
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -f "$file"; then
        touch $file
     else
        test -z "$file" || exec >$file
        echo ".ab help2man is required to generate this page"
-       exit 1
+       exit $?
     fi
     ;;
 
-  makeinfo)
-    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
-       # We have makeinfo, but it failed.
-       exit 1
-    fi
-
+  makeinfo*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified a \`.texi' or \`.texinfo' file, or any other file
@@ -291,53 +287,27 @@ WARNING: \`$1' is $msg.  You should only need it if
          call might also be the consequence of using a buggy \`make' (AIX,
          DU, IRIX).  You might want to install the \`Texinfo' package or
          the \`GNU make' package.  Grab either from any GNU archive site."
-    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    # The file to touch is that specified with -o ...
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
     if test -z "$file"; then
-      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '
+       /^@setfilename/{
+         s/.* \([^ ]*\) *$/\1/
+         p
+         q
+       }' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
     fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
     touch $file
     ;;
 
-  tar)
-    shift
-    if test -n "$run"; then
-      echo 1>&2 "ERROR: \`tar' requires --run"
-      exit 1
-    fi
-
-    # We have already tried tar in the generic part.
-    # Look for gnutar/gtar before invocation to avoid ugly error
-    # messages.
-    if (gnutar --version > /dev/null 2>&1); then
-       gnutar "$@" && exit 0
-    fi
-    if (gtar --version > /dev/null 2>&1); then
-       gtar "$@" && exit 0
-    fi
-    firstarg="$1"
-    if shift; then
-       case "$firstarg" in
-       *o*)
-           firstarg=`echo "$firstarg" | sed s/o//`
-           tar "$firstarg" "$@" && exit 0
-           ;;
-       esac
-       case "$firstarg" in
-       *h*)
-           firstarg=`echo "$firstarg" | sed s/h//`
-           tar "$firstarg" "$@" && exit 0
-           ;;
-       esac
-    fi
-
-    echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
-         You may want to install GNU tar or Free paxutils, or check the
-         command line arguments."
-    exit 1
-    ;;
-
   *)
     echo 1>&2 "\
 WARNING: \`$1' is needed, and is $msg.
@@ -356,5 +326,6 @@ exit 0
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
index 1fc1ca9602af74c3788a4e81b40278ea8897718b..6328057965dd8e866eeb4a15532c15e407b0cd47 100644 (file)
--- a/mp_bpl.c
+++ b/mp_bpl.c
@@ -4,17 +4,28 @@ Copyright 1996 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index ec56b4b26631b5b6311c78e31350c4b99984320e..7c9227e8b32395b2fe3c6b043c3ce6421a38f4ea 100644 (file)
@@ -9,17 +9,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index c7e4c13b4767828a3076e52ea6bc19004d01d825..c6d74eb3f2965e8261611abdf9b4b71a022c351f 100644 (file)
@@ -3,22 +3,33 @@
    THE CONTENTS OF THIS FILE ARE FOR INTERNAL USE AND MAY CHANGE
    INCOMPATIBLY OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
 
-Copyright 2003 Free Software Foundation, Inc.
+Copyright 2003, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -29,7 +40,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
    First part of table supports common usages, where 'A' and 'a' have the same
    value; this supports bases 2..36
 
-   At offset 224, values for bases 37..62 start.  Here, 'A' has the value 10
+   At offset 208, values for bases 37..62 start.  Here, 'A' has the value 10
    (in decimal) and 'a' has the value 36.  */
 
 #define X 0xff
@@ -51,7 +62,6 @@ const unsigned char __gmp_digit_value_tab[] =
   X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X,
   X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X,
   X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X,
-  X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X,
   0, 1, 2, 3, 4, 5, 6, 7, 8, 9, X, X, X, X, X, X,
   X,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,
   25,26,27,28,29,30,31,32,33,34,35,X, X, X, X, X,
index 8d7c69f4f68ba66fb013ced8e44c94b5a91756ab..c77980fbeb6ffa26f94bc220f3fde2d9af554834 100644 (file)
@@ -5,17 +5,28 @@ Copyright 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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"
index a7f342b7c85eb3a1f0e02d90d14c42e934936a9b..522bd0184bfe6a638e9fc5eeb6feb340e3ffbcc3 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2000 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 3d2aaf3eca5e30943be1b8a1d3f3876bc43e22fc..7be60066b9fdc6cd1f5b7a4bbe3482e0957822fb 100644 (file)
@@ -6,17 +6,28 @@ Copyright 1991, 1993, 1994, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 4285e0b659424f855ff78cadeeabab044db1f395..30b0ea8f5f22c6efe6cb6327d4858b51310f8c56 100644 (file)
@@ -1,22 +1,32 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
-# Inc.
+# Copyright 1996, 1998-2002 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
index 3cc2a49668cfa11de9836cdca4a1226e45a8362c..2f5238be585a6fbc7edc2547a488f7f1198625b0 100644 (file)
 
 @SET_MAKE@
 
-# Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
-# Inc.
+# Copyright 1996, 1998-2002 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 VPATH = @srcdir@
 am__make_dryrun = \
index 4f8a76e488a3f8cdeafe4b9dd1d64315a1d5d1c2..a2bde2a4f8570525fa8b913c3b131654a23897af 100644 (file)
--- a/mpf/abs.c
+++ b/mpf/abs.c
@@ -1,21 +1,32 @@
 /* mpf_abs -- Compute the absolute value of a float.
 
-Copyright 1993, 1994, 1995, 2001 Free Software Foundation, Inc.
+Copyright 1993-1995, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 48f73e95439f737b36179d7d0afb6b09ec748b38..d2a5c097c57805c015b73c8fa34d81514806f567 100644 (file)
--- a/mpf/add.c
+++ b/mpf/add.c
@@ -5,17 +5,28 @@ Copyright 1993, 1994, 1996, 2000, 2001, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 549ca99e1e285aa2f67f61798e96a2f75d9b22e6..b1e57d04c1eb61f659a35de30d9643c1cca111ba 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1993, 1994, 1996, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 3a34c1b44c66bdf37921de6ae35920000ecef33c..302e2b8ae5a845ab298ceed94661c48b3fe7f6e9 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 78fc1386de5414ff9f6195475b2d6c9cc473481e..2df0de579b083b2d237d46ea8ce0f4efddd60615 100644 (file)
@@ -1,22 +1,33 @@
 /* mpf_clear -- de-allocate the space occupied by the dynamic digit space of
    an integer.
 
-Copyright 1993, 1994, 1995, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1993-1995, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -24,5 +35,5 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 void
 mpf_clear (mpf_ptr m)
 {
-  (*__gmp_free_func) (m->_mp_d, (m->_mp_prec + 1) * BYTES_PER_MP_LIMB);
+  (*__gmp_free_func) (m->_mp_d, (size_t) (m->_mp_prec + 1) * GMP_LIMB_BYTES);
 }
index 8d43006c4dce9a2b8a0dee7f881882390ecf88bf..addbe8faf3b0910706eaf8a41ecd1dfbf3c847d8 100644 (file)
@@ -1,55 +1,48 @@
 /* mpf_clears() -- Clear multiple mpf_t variables.
 
-Copyright 2009 Free Software Foundation, Inc.
+Copyright 2009, 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>             /* for NULL */
 #include "gmp.h"
 #include "gmp-impl.h"
 
 void
-#if HAVE_STDARG
 mpf_clears (mpf_ptr x, ...)
-#else
-mpf_clears (va_alist)
-     va_dcl
-#endif
 {
   va_list  ap;
 
-#if HAVE_STDARG
   va_start (ap, x);
-#else
-  mpf_ptr x;
-  va_start (ap);
-  x = va_arg (ap, mpf_ptr);
-#endif
 
   while (x != NULL)
     {
-      mpf_clear (x);
+      (*__gmp_free_func) (x->_mp_d, (size_t) (x->_mp_prec + 1) * GMP_LIMB_BYTES);
       x = va_arg (ap, mpf_ptr);
     }
   va_end (ap);
index 9a3c7ae74ca17a78d6bf24b9424ea2a4d627f3aa..ab22c3f89cc8b474d866ce61c72a88f44698578a 100644 (file)
--- a/mpf/cmp.c
+++ b/mpf/cmp.c
@@ -5,17 +5,28 @@ Copyright 1993, 1994, 1996, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 09f1b65207f2fdd7119c5cba5a9c5112084b6e65..52893a781ecc1ad441d5e710b448adc5748b9f28 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index e1af23c01a0d523a18ed025a32c0d78b5ceba669..eaa8b87da9b914619d39d351b98dfa761e09f0b7 100644 (file)
@@ -1,22 +1,32 @@
 /* mpf_cmp_si -- Compare a float with a signed integer.
 
-Copyright 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2004, 2012 Free Software
-Foundation, Inc.
+Copyright 1993-1995, 1999-2002, 2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 5e5ed00effee5ecc10906bc7fd976dcbfcb945f9..ccb76c6ce0a8abfd9adf1e20067f04d298c6a33f 100644 (file)
@@ -1,21 +1,32 @@
 /* mpf_cmp_ui -- Compare a float with an unsigned integer.
 
-Copyright 1993, 1994, 1995, 1999, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1993-1995, 1999, 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index ea3297ccc131e362524669b1fd3baedd879dc4ad..af38cb8698fc4c748f1fdf439fa74dde674b4639 100644 (file)
--- a/mpf/div.c
+++ b/mpf/div.c
@@ -1,22 +1,33 @@
 /* mpf_div -- Divide two floats.
 
-Copyright 1993, 1994, 1996, 2000, 2001, 2002, 2004, 2005, 2010, 2012 Free
-Software Foundation, Inc.
+Copyright 1993, 1994, 1996, 2000-2002, 2004, 2005, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index f74cd8bcda0dae3c980167aff31c090f400d41c6..fef81520503d04ffff7f9c74fdd8c6ac361f8865 100644 (file)
@@ -1,22 +1,32 @@
 /* mpf_div_2exp -- Divide a float by 2^n.
 
-Copyright 1993, 1994, 1996, 2000, 2001, 2002, 2004 Free Software Foundation,
-Inc.
+Copyright 1993, 1994, 1996, 2000-2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 5ccc00ec3381fd9d243dad907e043a0a8bb13e6e..9be7e680bef68441d8b26cc39ff6309d9d5006ee 100644 (file)
@@ -1,22 +1,33 @@
 /* mpf_div_ui -- Divide a float with an unsigned integer.
 
-Copyright 1993, 1994, 1996, 2000, 2001, 2002, 2004, 2005, 2012 Free Software
+Copyright 1993, 1994, 1996, 2000-2002, 2004, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index ded3606cc35986ee353377bc837783579381f53d..af671059237b89c12b90a5edc532ba14fd57cb91 100644 (file)
@@ -5,22 +5,33 @@
    FUNCTION WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
 
 
-Copyright 1993, 1994, 1995, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1993-1995, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <string.h> /* for strlen */
index 9efa21220c5065694fd860fd35e1ef9134363164..30c6befd0615e6189aadf9e195005aaec6630d17 100644 (file)
--- a/mpf/eq.c
+++ b/mpf/eq.c
@@ -6,17 +6,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index f10f2c741873e892e59d2655b01d907e6ddc72dc..ec2635f6569994ff5699bdeb9c2527e91b92e0a2 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index c8b245a55d64122b6de33a676cbc724e6384d844..26ace07c38021d78bdb683f2efa1599d9fd28ef7 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 FUNCTION   mpf_fits_sint_p
index 42f54169351b2e0f03fcc56fe3ead41bad2cd6a9..25db68c47d4582046e8840c343fec38184d48889 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 FUNCTION   mpf_fits_slong_p
index bd2492bab78ed4f90287e85a5100f8feb256ef20..3bfc5a4a3450a4e56749be4fdff43aa30b044826 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 FUNCTION   mpf_fits_sshort_p
index 4503f037f6574d40ff0ed85affc6995343feb086..65ac60e09af252b54d8a9b14b5dbf343aa7fe368 100644 (file)
@@ -1,21 +1,32 @@
 /* mpf_fits_u*_p -- test whether an mpf fits a C unsigned type.
 
-Copyright 2001, 2002 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -31,14 +42,14 @@ FUNCTION (mpf_srcptr f) __GMP_NOTHROW
   mp_exp_t   exp;
   mp_limb_t  fl;
 
+  exp = EXP(f);
+  if (exp < 1)
+    return 1;  /* -1 < f < 1 truncates to zero, so fits */
+
   fn = SIZ(f);
   if (fn <= 0)
     return fn == 0;  /* zero fits, negatives don't */
 
-  exp = EXP(f);
-  if (exp < 1)
-    return 1;  /* 0 < f < 1 truncates to zero, so fits */
-
   fp = PTR(f);
 
   if (exp == 1)
index c2ae6fc55769e6189c18b6fa5bc729f4166dba01..4b107b04d8983e8957a825728e73a55525a08c47 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 FUNCTION  mpf_fits_uint_p
index 6fd4b8d0cf8f6a5294e44b5b729e9630d807423e..1db688ce4c6f75c06d14647c9884fc5bb0ed8991 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 FUNCTION  mpf_fits_ulong_p
index 8228c793c149703da8ef2f3ea57f7ee4bb0d0791..76a3fd9d528dccd54e1a36da670a733751406577 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 FUNCTION  mpf_fits_ushort_p
index 7be1c6be04854452c86ced6c9abd14c30636433c..8f6f9bbea1dea7c5b605416c21984e7408153671 100644 (file)
@@ -1,21 +1,32 @@
 /* double mpf_get_d (mpf_t src) -- return SRC truncated to a double.
 
-Copyright 1996, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright 1996, 2001-2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index a097ab68048d92ac261ab74ecae5b8c37a762e32..17ce229f2511f9f2d0b3c8299da9b8fccd6a5349 100644 (file)
@@ -1,21 +1,32 @@
 /* double mpf_get_d_2exp (signed long int *exp, mpf_t src).
 
-Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright 2001-2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 14606f0379001364975a713b59571c48490287c3..9a773d83acb68d93862b1ebe5585dc2160c352ed 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index ca7a056291e22774b5ca02b7c1a7238ff8e4b4f8..3b3283a48c5bc84afb9efc74458f13fed6137bbb 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1996, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index e3d18e89fa89ea85869574e45c86ec04c8a16540..5b63dbd4256bc66540595158223c92f166e59889 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index d0cba5936f5b0ead3bfe4ea2059c3e48d07314f3..98af03272e6d40aa05cf4baaa5c4b6a99d1eeac3 100644 (file)
@@ -4,23 +4,33 @@
    example, the number 3.1416 would be returned as "31416" in DIGIT_PTR and
    1 in EXP.
 
-Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2005, 2006, 2011
-Free Software Foundation, Inc.
+Copyright 1993-1997, 2000-2003, 2005, 2006, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>            /* for NULL */
 #include "gmp.h"
index 0d909d4ab89a9b03be8ac476219199a6211fd3ed..eb9b30e69c066e8a94f8b7a6742a170ef0dd79f9 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index fae6f199bda747c6a4876eb5b093c2fd96af3290..d8590f27a717258fe7591e629f8673dde4522830 100644 (file)
@@ -1,21 +1,32 @@
 /* mpf_init() -- Make a new multiple precision number with value 0.
 
-Copyright 1993, 1994, 1995, 2000, 2001, 2004 Free Software Foundation, Inc.
+Copyright 1993-1995, 2000, 2001, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -27,5 +38,5 @@ mpf_init (mpf_ptr r)
   r->_mp_size = 0;
   r->_mp_exp = 0;
   r->_mp_prec = prec;
-  r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
+  r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
 }
index 8298a6b809941dc4f5e1f851b6106be66c38edf4..a7891e33dd3d8c8d36abbc6b768e9f27a1b7bb9b 100644 (file)
@@ -1,21 +1,32 @@
 /* mpf_init2() -- Make a new multiple precision number with value 0.
 
-Copyright 1993, 1994, 1995, 2000, 2001, 2004 Free Software Foundation, Inc.
+Copyright 1993-1995, 2000, 2001, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -29,5 +40,5 @@ mpf_init2 (mpf_ptr r, mp_bitcnt_t prec_in_bits)
   r->_mp_size = 0;
   r->_mp_exp = 0;
   r->_mp_prec = prec;
-  r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
+  r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
 }
index 33471f6949ac7e325d64aab8595faf5ba36d71aa..fb14c6b0fd809f6868e9de4f7ed42b1312ffea82 100644 (file)
@@ -5,47 +5,40 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>             /* for NULL */
 #include "gmp.h"
 #include "gmp-impl.h"
 
 void
-#if HAVE_STDARG
 mpf_inits (mpf_ptr x, ...)
-#else
-mpf_inits (va_alist)
-     va_dcl
-#endif
 {
   va_list  ap;
 
-#if HAVE_STDARG
   va_start (ap, x);
-#else
-  mpf_ptr x;
-  va_start (ap);
-  x = va_arg (ap, mpf_ptr);
-#endif
 
   while (x != NULL)
     {
index 042a20d8ecc44ae2d655050b4d56c7b0ca31c3a2..45cc34cebbabd6cf5c2247db2e1440269f400889 100644 (file)
@@ -1,22 +1,33 @@
 /* mpf_inp_str(dest_float, stream, base) -- Input a number in base
    BASE from stdio stream STREAM and store the result in DEST_FLOAT.
 
-Copyright 1996, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
+Copyright 1996, 2000-2002, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <ctype.h>
index 3168314665bfa621d328aed51659b826eaa55a6d..91e62266bef90cdb2af2b8da4999067bdcc1b18f 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 60ccebc6c10c1a48a30e170bc1f57572e0f00d4f..c8c35e50e9fb9a68f59598ec0135e0ed7d038886 100644 (file)
@@ -1,21 +1,32 @@
 /* mpf_init_set -- Initialize a float and assign it from another float.
 
-Copyright 1993, 1994, 1995, 2000, 2001, 2004 Free Software Foundation, Inc.
+Copyright 1993-1995, 2000, 2001, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -28,7 +39,7 @@ mpf_init_set (mpf_ptr r, mpf_srcptr s)
   mp_size_t prec;
 
   prec = __gmp_default_fp_limb_precision;
-  r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
+  r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
   r->_mp_prec = prec;
 
   prec++;              /* lie not to lose precision in assignment */
index e0ac14196a069262bdad3bcfba42ab621c1f942e..d128db9b4d3881f2a60dfe71f3b7f847c1ae137e 100644 (file)
@@ -1,21 +1,32 @@
 /* mpf_init_set_d -- Initialize a float and assign it from a double.
 
-Copyright 1993, 1994, 1995, 2000, 2001, 2004 Free Software Foundation, Inc.
+Copyright 1993-1995, 2000, 2001, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -25,7 +36,7 @@ mpf_init_set_d (mpf_ptr r, double val)
 {
   mp_size_t prec = __gmp_default_fp_limb_precision;
   r->_mp_prec = prec;
-  r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
+  r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
 
   mpf_set_d (r, val);
 }
index 7eaf08cff44ea9e4a5b2f3f9a2d524b9fb2b9714..f7e9005086cbb55e57475ce1bfb3b351faf023b5 100644 (file)
@@ -1,22 +1,33 @@
 /* mpf_init_set_si() -- Initialize a float and assign it from a signed int.
 
-Copyright 1993, 1994, 1995, 2000, 2001, 2003, 2004, 2012 Free Software
-Foundation, Inc.
+Copyright 1993-1995, 2000, 2001, 2003, 2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -29,7 +40,7 @@ mpf_init_set_si (mpf_ptr r, long int val)
   mp_limb_t vl;
 
   r->_mp_prec = prec;
-  r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
+  r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
 
   vl = (mp_limb_t) ABS_CAST (unsigned long int, val);
 
index 82a6f2e4f822413e83bb084c7419ee765eff05be..a181f80c935927842a6c70a81963871f457967a0 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1995, 1996, 2000, 2001, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -27,7 +38,7 @@ mpf_init_set_str (mpf_ptr r, const char *s, int base)
   r->_mp_size = 0;
   r->_mp_exp = 0;
   r->_mp_prec = prec;
-  r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
+  r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
 
   return mpf_set_str (r, s, base);
 }
index 4ac1771e98f8a77c1b50bdd372a983e4e666ee5c..f047982116e7e249877d33bbfa462032aa4bb087 100644 (file)
@@ -1,22 +1,32 @@
 /* mpf_init_set_ui() -- Initialize a float and assign it from an unsigned int.
 
-Copyright 1993, 1994, 1995, 2000, 2001, 2003, 2004 Free Software Foundation,
-Inc.
+Copyright 1993-1995, 2000, 2001, 2003, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -28,7 +38,7 @@ mpf_init_set_ui (mpf_ptr r, unsigned long int val)
   mp_size_t size;
 
   r->_mp_prec = prec;
-  r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
+  r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
   r->_mp_d[0] = val & GMP_NUMB_MASK;
   size = (val != 0);
 
index 0082aa40ad7f97ef2e1cf882ef984bdea655a26a..41d1db7c14a41c9c9eedf1caa88e7a1239db1a9e 100644 (file)
--- a/mpf/mul.c
+++ b/mpf/mul.c
@@ -5,17 +5,28 @@ Copyright 1993, 1994, 1996, 2001, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 5ec70e46a95c8bfada6a86083a64ad90dfae7ad9..83df2176d3b6fbb4e0f96ff52422de59d820b701 100644 (file)
@@ -1,22 +1,32 @@
 /* mpf_mul_2exp -- Multiply a float by 2^n.
 
-Copyright 1993, 1994, 1996, 2000, 2001, 2002, 2004 Free Software Foundation,
-Inc.
+Copyright 1993, 1994, 1996, 2000-2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 96e8012a46eff07b9bd67ea221b6902e11bc25ca..031b2fe06fea8d328c0dd221343cc7d7baba2a55 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1993, 1994, 1996, 2001, 2003, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index c7d7d47d0a11be61fb74197f5f72c483a89244b4..553018f306a99294037335baecfba88180a04523 100644 (file)
--- a/mpf/neg.c
+++ b/mpf/neg.c
@@ -1,21 +1,32 @@
 /* mpf_neg -- Negate a float.
 
-Copyright 1993, 1994, 1995, 2001 Free Software Foundation, Inc.
+Copyright 1993-1995, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 3e34a5341cae772b7cd5ed1d8930daec070b8bf8..200da7480637bb8d6ff2ec6580edcb95cb2a2736 100644 (file)
@@ -7,17 +7,28 @@ Copyright 1996, 1997, 2001, 2002, 2005, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 _GNU_SOURCE    /* for DECIMAL_POINT in langinfo.h */
 
index 589bbee2f97c1c30e4cefa5f8dbd29330c11470c..a5af431059018aacac571b3d14ac895919202dce 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1998, 1999, 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index d1bef107243a2af524a4719411cf1bfe5ed198bc..4d7f37e976dcd76af05c2f780a1fd16a9bfdf097 100644 (file)
@@ -2,22 +2,33 @@
    long runs of consecutive ones and zeros in the binary representation.
    Intended for testing of other MP routines.
 
-Copyright 1995, 1996, 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 1995, 1996, 2001-2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 6a941b893f0c2a5b73f3340428d7a49ccac7ea81..f49da081665cc0b4609e42c30599e79c8e01735a 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1996, 2001, 2004, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 115ab710e433132828c3b6111345f331b458c3d7..ec8161d779f4cd491124223856c0ba14cab1c813 100644 (file)
--- a/mpf/set.c
+++ b/mpf/set.c
@@ -1,21 +1,32 @@
 /* mpf_set -- Assign a float from another float.
 
-Copyright 1993, 1994, 1995, 2001, 2004 Free Software Foundation, Inc.
+Copyright 1993-1995, 2001, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index d72865ddcc00c1268ef80bfc0a7e62196f33fac0..100194d116752391b946de03b234d22b5f7b35f2 100644 (file)
@@ -1,22 +1,32 @@
 /* mpf_set_d -- Assign a float from a double.
 
-Copyright 1993, 1994, 1995, 1996, 2001, 2003, 2004 Free Software Foundation,
-Inc.
+Copyright 1993-1996, 2001, 2003, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index c209dd99760bfbda71deab978d0208948d12837a..04c9a5513544a241f0427bbf3c6d675e33fb43bf 100644 (file)
@@ -1,21 +1,32 @@
 /* mpf_set_default_prec --
 
-Copyright 1993, 1994, 1995, 2001 Free Software Foundation, Inc.
+Copyright 1993-1995, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 873b12e85cff45e07356849dad51fe8065e45a2a..30ba06c6e657286a01e6d69c54e105c78a803a5b 100644 (file)
@@ -1,21 +1,32 @@
 /* mpf_set_prec(x) -- Change the precision of x.
 
-Copyright 1993, 1994, 1995, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1993-1995, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 0473b5d137895bc15a9c19704ac77531f9c14bcf..779944229948b5daa2bb6d71891a0d2a388591a6 100644 (file)
@@ -7,17 +7,28 @@ Copyright 1996, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index a54aa3b1653466d4619e0b650344fc148e8e8fee..c5739b2abecea4105b6e09db0f87452cb06c050d 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1996, 1999, 2001, 2002, 2004, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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"
index b9dfae3ef2d68db8f525e6300f7455612cf09fc2..9c47c7511ffcfca3e2da5ec47b5efd3e1f40e539 100644 (file)
@@ -1,22 +1,32 @@
 /* mpf_set_si() -- Assign a float from a signed int.
 
-Copyright 1993, 1994, 1995, 2000, 2001, 2002, 2004, 2012 Free Software
-Foundation, Inc.
+Copyright 1993-1995, 2000-2002, 2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 644b201d8e9eff50dcaf57b23dfbbeb62283591d..9053accadeb15c0a6b937aa3ed0a4022f1b47b9e 100644 (file)
@@ -2,23 +2,34 @@
    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, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2005, 2007,
-2008, 2011 Free Software Foundation, Inc.
+Copyright 1993-1997, 2000-2003, 2005, 2007, 2008, 2011, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /*
   This still needs work, as suggested by some FIXME comments.
@@ -154,19 +165,19 @@ mpf_set_str (mpf_ptr x, const char *str, int base)
     {
       /* For bases > 36, use the collating sequence
         0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.  */
-      digit_value += 224;
+      digit_value += 208;
       if (base > 62)
        return -1;              /* too large base */
     }
 
   /* Require at least one digit, possibly after an initial decimal point.  */
-  if (digit_value[c] >= (base == 0 ? 10 : base))
+  if (digit_value[c] >= base)
     {
       /* not a digit, must be a decimal point */
       for (i = 0; i < pointlen; i++)
        if (str[i] != point[i])
          return -1;
-      if (digit_value[(unsigned char) str[pointlen]] >= (base == 0 ? 10 : base))
+      if (digit_value[(unsigned char) str[pointlen]] >= base)
        return -1;
     }
 
index 3a793c8929f1294fd5ef47164b60337409126bea..617bce13c148ac05a8a5c34e9e6944b9c87aa6f1 100644 (file)
@@ -1,21 +1,32 @@
 /* mpf_set_ui() -- Assign a float from an unsigned int.
 
-Copyright 1993, 1994, 1995, 2001, 2002, 2004 Free Software Foundation, Inc.
+Copyright 1993-1995, 2001, 2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 4b0f01beae46aa24e6583295e4df30896099847f..fe91904563d04f296e4da5f75283a1842c5cbcd3 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1996, 2001, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 34dfa5f759e8e61fdcd29ceb4aa026f8e9250cfb..c6b22b64cc3f9a951411e2c6dcd7ac9470282243 100644 (file)
@@ -1,22 +1,33 @@
 /* mpf_size(x) -- return the number of limbs currently used by the
    value of the float X.
 
-Copyright 1993, 1994, 1995, 2001 Free Software Foundation, Inc.
+Copyright 1993-1995, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index bdd79358b77bc74d3303b58e6cc5746723af2b26..44502244e24e0e47ac42d8b5da19a7705b3a0b0c 100644 (file)
@@ -6,17 +6,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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"
index c3222555eceb0f1803d8658a7797c2bd194fefc4..82dec7bcb3808d348901a03839fdc5694c854ba6 100644 (file)
@@ -6,17 +6,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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"
index 575b412960d7e0c7c6e8f22fccf4a9b6644bb122..3aaf192790ad7a5ef03967d1b198857b935bed9a 100644 (file)
--- a/mpf/sub.c
+++ b/mpf/sub.c
@@ -1,22 +1,32 @@
 /* mpf_sub -- Subtract two floats.
 
-Copyright 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2011 Free
-Software Foundation, Inc.
+Copyright 1993-1996, 1999-2002, 2004, 2005, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 4ce7595ed2255f083f5f18c0630c5ae492dac8ee..cf9b88eb004e69e9bcb34eb288de30371d8b125c 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1993, 1994, 1996, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 26934f641fe40a1a64ec2adfbfd072566480ec04..a370652876386e774a607aed4ebe3d7b571af5ac 100644 (file)
@@ -1,21 +1,32 @@
 /* mpf_swap (U, V) -- Swap U and V.
 
-Copyright 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1997, 1998, 2000, 2001, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -23,28 +34,24 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 void
 mpf_swap (mpf_ptr u, mpf_ptr v) __GMP_NOTHROW
 {
-  mp_ptr up, vp;
-  mp_size_t usize, vsize;
-  mp_size_t uprec, vprec;
-  mp_exp_t  uexp, vexp;
-
-  uprec = u->_mp_prec;
-  vprec = v->_mp_prec;
-  v->_mp_prec = uprec;
-  u->_mp_prec = vprec;
-
-  usize = u->_mp_size;
-  vsize = v->_mp_size;
-  v->_mp_size = usize;
-  u->_mp_size = vsize;
-
-  uexp = u->_mp_exp;
-  vexp = v->_mp_exp;
-  v->_mp_exp = uexp;
-  u->_mp_exp = vexp;
-
-  up = u->_mp_d;
-  vp = v->_mp_d;
-  v->_mp_d = up;
-  u->_mp_d = vp;
+  mp_ptr tptr;
+  mp_size_t tprec;
+  mp_size_t tsiz;
+  mp_exp_t  texp;
+
+  tprec = PREC(u);
+  PREC(u) = PREC(v);
+  PREC(v) = tprec;
+
+  tsiz = SIZ(u);
+  SIZ(u) = SIZ(v);
+  SIZ(v) = tsiz;
+
+  texp = EXP(u);
+  EXP(u) = EXP(v);
+  EXP(v) = texp;
+
+  tptr = PTR(u);
+  PTR(u) = PTR(v);
+  PTR(v) = tptr;
 }
index d329bc1bc573ca5158b5cbdb58832452a08e7938..5f94f7aec85cc73f2bd05f11cf6df6aa743fbe79 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 3ca717e7512b051a812c7beb99a8af5b7f1b114e..ceb881ebcc2807ca07944d5a5a867823df5e9cd5 100644 (file)
@@ -1,22 +1,32 @@
 /* mpf_ui_div -- Divide an unsigned integer with a float.
 
-Copyright 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2004, 2005, 2012 Free
-Software Foundation, Inc.
+Copyright 1993-1996, 2000-2002, 2004, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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"
index 081ca345f588cca53002d83a6424835504511225..b7a536eb8bc92c6093630ab258aab5df1b77f0cf 100644 (file)
@@ -1,22 +1,32 @@
 /* mpf_ui_sub -- Subtract a float from an unsigned long int.
 
-Copyright 1993, 1994, 1995, 1996, 2001, 2002, 2005 Free Software Foundation,
-Inc.
+Copyright 1993-1996, 2001, 2002, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 02307e0fa21b2c822de428d5dda3216bdfd82717..72271e8762ad12e1bdca3f04a09eb037fd062d9c 100644 (file)
@@ -3,22 +3,33 @@
    using STATE as the random state previously initialized by a call to
    gmp_randinit().
 
-Copyright 1999, 2000, 2001, 2002  Free Software Foundation, Inc.
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index bb66700384a4ab83525c6a7bb0c279f0179ecee8..5d7306c221ec8d1604fe7b65e105caba252a231d 100644 (file)
@@ -1,22 +1,32 @@
 ## Automake asm file rules.
 
-# Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
-# Inc.
+# Copyright 1996, 1998-2002 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 # COMPILE minus CC.
index 6b81e4c98ec931c27a62a9d0119ac32dc10fe7a5..20b8a4a1168e58e8a94beb9aca10a1c4fdccbfcc 100644 (file)
@@ -1,22 +1,32 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2005, 2011 Free Software
-# Foundation, Inc.
+# Copyright 1996, 1998-2002, 2005, 2011, 2013 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) \
@@ -29,9 +39,9 @@ nodist_libmpn_la_SOURCES = fib_table.c mp_bases.c
 libmpn_la_LIBADD = $(OFILES)
 libmpn_la_DEPENDENCIES = $(OFILES)
 
-TARG_DIST = a29k alpha arm clipper cray generic i960 ia64 lisp m68k m88k \
-  minithres mips32 mips64 ns32k pa32 pa64 power powerpc32 powerpc64 pyr \
-  s390_32 s390_64 sh sparc32 sparc64 thumb vax x86 x86_64 z8000
+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
 
 EXTRA_DIST = asm-defs.m4 cpp-ccas m4-ccas $(TARG_DIST)
 
index fe4fa2226e470c220e7bcc14b69ccfff74384f2d..099abf26ab31dd0aa580290cb586c2cb8432b011 100644 (file)
 
 @SET_MAKE@
 
-# Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2005, 2011 Free Software
-# Foundation, Inc.
+# Copyright 1996, 1998-2002, 2005, 2011, 2013 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
 #
-# This file is part of the GNU MP Library.
+#    * 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.
 #
-# The GNU MP Library is free software; you can redistribute it and/or modify
-# it under the terms of 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 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 Lesser General Public
-# License for more details.
+#  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 a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  You should have received copies of the GNU General Public License and the
+#  GNU Lesser General Public License along with the GNU MP Library.  If not,
+#  see https://www.gnu.org/licenses/.
 
-# Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
-# Inc.
+# Copyright 1996, 1998-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
 #
-# This file is part of the GNU MP Library.
+#    * 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.
 #
-# The GNU MP Library is free software; you can redistribute it and/or modify
-# it under the terms of 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 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 Lesser General Public
-# License for more details.
+#  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 a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  You should have received copies of the GNU General Public License and the
+#  GNU Lesser General Public License along with the GNU MP Library.  If not,
+#  see https://www.gnu.org/licenses/.
 
 VPATH = @srcdir@
 am__make_dryrun = \
@@ -292,9 +312,9 @@ noinst_LTLIBRARIES = libmpn.la
 nodist_libmpn_la_SOURCES = fib_table.c mp_bases.c
 libmpn_la_LIBADD = $(OFILES)
 libmpn_la_DEPENDENCIES = $(OFILES)
-TARG_DIST = a29k alpha arm clipper cray generic i960 ia64 lisp m68k m88k \
-  minithres mips32 mips64 ns32k pa32 pa64 power powerpc32 powerpc64 pyr \
-  s390_32 s390_64 sh sparc32 sparc64 thumb vax x86 x86_64 z8000
+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
 
 EXTRA_DIST = asm-defs.m4 cpp-ccas m4-ccas $(TARG_DIST)
 
index 32fc007e402facd6dd5308dd827e25cc6475ed58..bc046be7322ce8c056ff468fdd8657ae65f3d71f 100644 (file)
@@ -3,17 +3,28 @@ Copyright 1996, 1999 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU 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/mpn/a29k/add_n.s b/mpn/a29k/add_n.s
deleted file mode 100644 (file)
index 2d92604..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-; 29000 mpn_add_n -- Add two limb vectors of the same length > 0 and store
-; sum in a third limb vector.
-
-; Copyright 1992, 1994, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-; INPUT PARAMETERS
-; res_ptr      lr2
-; s1_ptr       lr3
-; s2_ptr       lr4
-; size         lr5
-
-; We use the loadm/storem instructions and operate on chunks of 8
-; limbs/per iteration, until less than 8 limbs remain.
-
-; The 29k has no addition or subtraction instructions that doesn't
-; affect carry, so we need to save and restore that as soon as we
-; adjust the pointers.  gr116 is used for this purpose.  Note that
-; gr116==0 means that carry should be set.
-
-       .sect .lit,lit
-       .text
-       .align  4
-       .global ___gmpn_add_n
-       .word   0x60000
-___gmpn_add_n:
-       srl     gr117,lr5,3
-       sub     gr118,gr117,1
-       jmpt    gr118,Ltail
-        constn gr116,-1                ; init cy reg
-       sub     gr117,gr117,2           ; count for jmpfdec
-
-; Main loop working 8 limbs/iteration.
-Loop:  mtsrim  cr,(8-1)
-       loadm   0,0,gr96,lr3
-       add     lr3,lr3,32
-       mtsrim  cr,(8-1)
-       loadm   0,0,gr104,lr4
-       add     lr4,lr4,32
-
-       subr    gr116,gr116,0           ; restore carry
-       addc    gr96,gr96,gr104
-       addc    gr97,gr97,gr105
-       addc    gr98,gr98,gr106
-       addc    gr99,gr99,gr107
-       addc    gr100,gr100,gr108
-       addc    gr101,gr101,gr109
-       addc    gr102,gr102,gr110
-       addc    gr103,gr103,gr111
-       subc    gr116,gr116,gr116       ; gr116 = not(cy)
-
-       mtsrim  cr,(8-1)
-       storem  0,0,gr96,lr2
-       jmpfdec gr117,Loop
-        add    lr2,lr2,32
-
-; Code for the last up-to-7 limbs.
-; This code might look very strange, but it's hard to write it
-; differently without major slowdown.
-
-       and     lr5,lr5,(8-1)
-Ltail: sub     gr118,lr5,1             ; count for CR
-       jmpt    gr118,Lend
-        sub    gr117,lr5,2             ; count for jmpfdec
-
-       mtsr    cr,gr118
-       loadm   0,0,gr96,lr3
-       mtsr    cr,gr118
-       loadm   0,0,gr104,lr4
-
-       subr    gr116,gr116,0           ; restore carry
-
-       jmpfdec gr117,L1
-        addc   gr96,gr96,gr104
-       jmp     Lstore
-        mtsr   cr,gr118
-L1:    jmpfdec gr117,L2
-        addc   gr97,gr97,gr105
-       jmp     Lstore
-        mtsr   cr,gr118
-L2:    jmpfdec gr117,L3
-        addc   gr98,gr98,gr106
-       jmp     Lstore
-        mtsr   cr,gr118
-L3:    jmpfdec gr117,L4
-        addc   gr99,gr99,gr107
-       jmp     Lstore
-        mtsr   cr,gr118
-L4:    jmpfdec gr117,L5
-        addc   gr100,gr100,gr108
-       jmp     Lstore
-        mtsr   cr,gr118
-L5:    jmpfdec gr117,L6
-        addc   gr101,gr101,gr109
-       jmp     Lstore
-        mtsr   cr,gr118
-L6:    addc    gr102,gr102,gr110
-
-Lstore:        storem  0,0,gr96,lr2
-       subc    gr116,gr116,gr116       ; gr116 = not(cy)
-
-Lend:  jmpi    lr0
-        add    gr96,gr116,1
diff --git a/mpn/a29k/addmul_1.s b/mpn/a29k/addmul_1.s
deleted file mode 100644 (file)
index fcf7fc2..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-; 29000 __gmpn_addmul_1 -- Multiply a limb vector with a single limb and
-; add the product to a second limb vector.
-
-; Copyright 1992, 1994, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-; INPUT PARAMETERS
-; res_ptr      lr2
-; s1_ptr       lr3
-; size         lr4
-; s2_limb      lr5
-
-       .cputype 29050
-       .sect .lit,lit
-       .text
-       .align  4
-       .global ___gmpn_addmul_1
-       .word   0x60000
-___gmpn_addmul_1:
-       sub     lr4,lr4,8
-       jmpt    lr4,Ltail
-        const  gr120,0                 ; init cylimb reg
-
-       srl     gr117,lr4,3             ; divide by 8
-       sub     gr117,gr117,1           ; count for jmpfdec
-
-Loop:  mtsrim  cr,(8-1)
-       loadm   0,0,gr96,lr3
-       add     lr3,lr3,32
-
-       multiplu gr104,gr96,lr5
-       multmu   gr96,gr96,lr5
-       multiplu gr105,gr97,lr5
-       multmu   gr97,gr97,lr5
-       multiplu gr106,gr98,lr5
-       multmu   gr98,gr98,lr5
-       multiplu gr107,gr99,lr5
-       multmu   gr99,gr99,lr5
-       multiplu gr108,gr100,lr5
-       multmu   gr100,gr100,lr5
-       multiplu gr109,gr101,lr5
-       multmu   gr101,gr101,lr5
-       multiplu gr110,gr102,lr5
-       multmu   gr102,gr102,lr5
-       multiplu gr111,gr103,lr5
-       multmu   gr103,gr103,lr5
-
-       add     gr104,gr104,gr120
-       addc    gr105,gr105,gr96
-       addc    gr106,gr106,gr97
-       addc    gr107,gr107,gr98
-       addc    gr108,gr108,gr99
-       addc    gr109,gr109,gr100
-       addc    gr110,gr110,gr101
-       addc    gr111,gr111,gr102
-       addc    gr120,gr103,0
-
-       mtsrim  cr,(8-1)
-       loadm   0,0,gr96,lr2
-
-       add     gr104,gr96,gr104
-       addc    gr105,gr97,gr105
-       addc    gr106,gr98,gr106
-       addc    gr107,gr99,gr107
-       addc    gr108,gr100,gr108
-       addc    gr109,gr101,gr109
-       addc    gr110,gr102,gr110
-       addc    gr111,gr103,gr111
-       addc    gr120,gr120,0
-
-       mtsrim  cr,(8-1)
-       storem  0,0,gr104,lr2
-       jmpfdec gr117,Loop
-        add    lr2,lr2,32
-
-Ltail: and     lr4,lr4,(8-1)
-       sub     gr118,lr4,1             ; count for CR
-       jmpt    gr118,Lend
-        sub    lr4,lr4,2
-       sub     lr2,lr2,4               ; offset res_ptr by one limb
-
-Loop2: load    0,0,gr116,lr3
-       add     lr3,lr3,4
-       multiplu gr117,gr116,lr5
-       multmu  gr118,gr116,lr5
-       add     lr2,lr2,4
-       load    0,0,gr119,lr2
-       add     gr117,gr117,gr120
-       addc    gr118,gr118,0
-       add     gr117,gr117,gr119
-       store   0,0,gr117,lr2
-       jmpfdec lr4,Loop2
-        addc   gr120,gr118,0
-
-Lend:  jmpi    lr0
-        or     gr96,gr120,0            ; copy
diff --git a/mpn/a29k/lshift.s b/mpn/a29k/lshift.s
deleted file mode 100644 (file)
index 3df6dab..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-; 29000 __gmpn_lshift --
-
-; Copyright 1992, 1994, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-; INPUT PARAMETERS
-; res_ptr      lr2
-; s1_ptr       lr3
-; s2_ptr       lr4
-; size         lr5
-
-; We use the loadm/storem instructions and operate on chunks of 8
-; limbs/per iteration, until less than 8 limbs remain.
-
-       .sect .lit,lit
-       .text
-       .align  4
-       .global ___gmpn_lshift
-       .word   0x60000
-___gmpn_lshift:
-       sll     gr116,lr4,2
-       add     lr3,gr116,lr3
-       add     lr2,gr116,lr2
-       sub     lr3,lr3,4
-       load    0,0,gr119,lr3
-
-       subr    gr116,lr5,32
-       srl     gr96,gr119,gr116        ; return value
-       sub     lr4,lr4,1               ; actual loop count is SIZE - 1
-
-       srl     gr117,lr4,3             ; chuck count = (actual count) / 8
-       cpeq    gr118,gr117,0
-       jmpt    gr118,Ltail
-        mtsr   fc,lr5
-
-       sub     gr117,gr117,2           ; count for jmpfdec
-
-; Main loop working 8 limbs/iteration.
-Loop:  sub     lr3,lr3,32
-       mtsrim  cr,(8-1)
-       loadm   0,0,gr100,lr3
-
-       extract gr109,gr119,gr107
-       extract gr108,gr107,gr106
-       extract gr107,gr106,gr105
-       extract gr106,gr105,gr104
-       extract gr105,gr104,gr103
-       extract gr104,gr103,gr102
-       extract gr103,gr102,gr101
-       extract gr102,gr101,gr100
-
-       sub     lr2,lr2,32
-       mtsrim  cr,(8-1)
-       storem  0,0,gr102,lr2
-       jmpfdec gr117,Loop
-        or     gr119,gr100,0
-
-; Code for the last up-to-7 limbs.
-
-       and     lr4,lr4,(8-1)
-Ltail: cpeq    gr118,lr4,0
-       jmpt    gr118,Lend
-        sub    lr4,lr4,2               ; count for jmpfdec
-
-Loop2: sub     lr3,lr3,4
-       load    0,0,gr116,lr3
-       extract gr117,gr119,gr116
-       sub     lr2,lr2,4
-       store   0,0,gr117,lr2
-       jmpfdec lr4,Loop2
-        or     gr119,gr116,0
-
-Lend:  extract gr117,gr119,0
-       sub     lr2,lr2,4
-       jmpi    lr0
-        store  0,0,gr117,lr2
diff --git a/mpn/a29k/mul_1.s b/mpn/a29k/mul_1.s
deleted file mode 100644 (file)
index a55fe3e..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-; 29000 __gmpn_mul_1 -- Multiply a limb vector with a single limb and
-; store the product in a second limb vector.
-
-; Copyright 1992, 1994, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-; INPUT PARAMETERS
-; res_ptr      lr2
-; s1_ptr       lr3
-; size         lr4
-; s2_limb      lr5
-
-       .cputype 29050
-       .sect .lit,lit
-       .text
-       .align  4
-       .global ___gmpn_mul_1
-       .word   0x60000
-___gmpn_mul_1:
-       sub     lr4,lr4,8
-       jmpt    lr4,Ltail
-        const  gr120,0                 ; init cylimb reg
-
-       srl     gr117,lr4,3             ; divide by 8
-       sub     gr117,gr117,1           ; count for jmpfdec
-
-Loop:  mtsrim  cr,(8-1)
-       loadm   0,0,gr96,lr3
-       add     lr3,lr3,32
-
-       multiplu gr104,gr96,lr5
-       multmu   gr96,gr96,lr5
-       multiplu gr105,gr97,lr5
-       multmu   gr97,gr97,lr5
-       multiplu gr106,gr98,lr5
-       multmu   gr98,gr98,lr5
-       multiplu gr107,gr99,lr5
-       multmu   gr99,gr99,lr5
-       multiplu gr108,gr100,lr5
-       multmu   gr100,gr100,lr5
-       multiplu gr109,gr101,lr5
-       multmu   gr101,gr101,lr5
-       multiplu gr110,gr102,lr5
-       multmu   gr102,gr102,lr5
-       multiplu gr111,gr103,lr5
-       multmu   gr103,gr103,lr5
-
-       add     gr104,gr104,gr120
-       addc    gr105,gr105,gr96
-       addc    gr106,gr106,gr97
-       addc    gr107,gr107,gr98
-       addc    gr108,gr108,gr99
-       addc    gr109,gr109,gr100
-       addc    gr110,gr110,gr101
-       addc    gr111,gr111,gr102
-       addc    gr120,gr103,0
-
-       mtsrim  cr,(8-1)
-       storem  0,0,gr104,lr2
-       jmpfdec gr117,Loop
-        add    lr2,lr2,32
-
-Ltail: and     lr4,lr4,(8-1)
-       sub     gr118,lr4,1             ; count for CR
-       jmpt    gr118,Lend
-        sub    lr4,lr4,2
-       sub     lr2,lr2,4               ; offset res_ptr by one limb
-
-Loop2: load    0,0,gr116,lr3
-       add     lr3,lr3,4
-       multiplu gr117,gr116,lr5
-       multmu  gr118,gr116,lr5
-       add     lr2,lr2,4
-       add     gr117,gr117,gr120
-       store   0,0,gr117,lr2
-       jmpfdec lr4,Loop2
-        addc   gr120,gr118,0
-
-Lend:  jmpi    lr0
-        or     gr96,gr120,0            ; copy
diff --git a/mpn/a29k/rshift.s b/mpn/a29k/rshift.s
deleted file mode 100644 (file)
index 8a30867..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-; 29000 __gmpn_rshift --
-
-; Copyright 1992, 1994, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-; INPUT PARAMETERS
-; res_ptr      lr2
-; s1_ptr       lr3
-; s2_ptr       lr4
-; size         lr5
-
-; We use the loadm/storem instructions and operate on chunks of 8
-; limbs/per iteration, until less than 8 limbs remain.
-
-       .sect .lit,lit
-       .text
-       .align  4
-       .global ___gmpn_rshift
-       .word   0x60000
-___gmpn_rshift:
-       load    0,0,gr119,lr3
-       add     lr3,lr3,4
-
-       subr    gr116,lr5,32
-       sll     gr96,gr119,gr116        ; return value
-       sub     lr4,lr4,1               ; actual loop count is SIZE - 1
-
-       srl     gr117,lr4,3             ; chuck count = (actual count) / 8
-       cpeq    gr118,gr117,0
-       jmpt    gr118,Ltail
-        mtsr   fc,gr116
-
-       sub     gr117,gr117,2           ; count for jmpfdec
-
-; Main loop working 8 limbs/iteration.
-Loop:  mtsrim  cr,(8-1)
-       loadm   0,0,gr100,lr3
-       add     lr3,lr3,32
-
-       extract gr98,gr100,gr119
-       extract gr99,gr101,gr100
-       extract gr100,gr102,gr101
-       extract gr101,gr103,gr102
-       extract gr102,gr104,gr103
-       extract gr103,gr105,gr104
-       extract gr104,gr106,gr105
-       extract gr105,gr107,gr106
-
-       mtsrim  cr,(8-1)
-       storem  0,0,gr98,lr2
-       add     lr2,lr2,32
-       jmpfdec gr117,Loop
-        or     gr119,gr107,0
-
-; Code for the last up-to-7 limbs.
-
-       and     lr4,lr4,(8-1)
-Ltail: cpeq    gr118,lr4,0
-       jmpt    gr118,Lend
-        sub    lr4,lr4,2               ; count for jmpfdec
-
-Loop2: load    0,0,gr100,lr3
-       add     lr3,lr3,4
-       extract gr117,gr100,gr119
-       store   0,0,gr117,lr2
-       add     lr2,lr2,4
-       jmpfdec lr4,Loop2
-        or     gr119,gr100,0
-
-Lend:  srl     gr117,gr119,lr5
-       jmpi    lr0
-        store  0,0,gr117,lr2
diff --git a/mpn/a29k/sub_n.s b/mpn/a29k/sub_n.s
deleted file mode 100644 (file)
index 42072a4..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-; 29000 mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
-; store difference in a third limb vector.
-
-; Copyright 1992, 1994, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-; INPUT PARAMETERS
-; res_ptr      lr2
-; s1_ptr       lr3
-; s2_ptr       lr4
-; size         lr5
-
-; We use the loadm/storem instructions and operate on chunks of 8
-; limbs/per iteration, until less than 8 limbs remain.
-
-; The 29k has no addition or subtraction instructions that doesn't
-; affect carry, so we need to save and restore that as soon as we
-; adjust the pointers.  gr116 is used for this purpose.  Note that
-; gr116==0 means that carry should be set.
-
-       .sect .lit,lit
-       .text
-       .align  4
-       .global ___gmpn_sub_n
-       .word   0x60000
-___gmpn_sub_n:
-       srl     gr117,lr5,3
-       sub     gr118,gr117,1
-       jmpt    gr118,Ltail
-        constn gr116,-1                ; init cy reg
-       sub     gr117,gr117,2           ; count for jmpfdec
-
-; Main loop working 8 limbs/iteration.
-Loop:  mtsrim  cr,(8-1)
-       loadm   0,0,gr96,lr3
-       add     lr3,lr3,32
-       mtsrim  cr,(8-1)
-       loadm   0,0,gr104,lr4
-       add     lr4,lr4,32
-
-       subr    gr116,gr116,0           ; restore carry
-       subc    gr96,gr96,gr104
-       subc    gr97,gr97,gr105
-       subc    gr98,gr98,gr106
-       subc    gr99,gr99,gr107
-       subc    gr100,gr100,gr108
-       subc    gr101,gr101,gr109
-       subc    gr102,gr102,gr110
-       subc    gr103,gr103,gr111
-       subc    gr116,gr116,gr116       ; gr116 = not(cy)
-
-       mtsrim  cr,(8-1)
-       storem  0,0,gr96,lr2
-       jmpfdec gr117,Loop
-        add    lr2,lr2,32
-
-; Code for the last up-to-7 limbs.
-; This code might look very strange, but it's hard to write it
-; differently without major slowdown.
-
-       and     lr5,lr5,(8-1)
-Ltail: sub     gr118,lr5,1             ; count for CR
-       jmpt    gr118,Lend
-        sub    gr117,lr5,2             ; count for jmpfdec
-
-       mtsr    cr,gr118
-       loadm   0,0,gr96,lr3
-       mtsr    cr,gr118
-       loadm   0,0,gr104,lr4
-
-       subr    gr116,gr116,0           ; restore carry
-
-       jmpfdec gr117,L1
-        subc   gr96,gr96,gr104
-       jmp     Lstore
-        mtsr   cr,gr118
-L1:    jmpfdec gr117,L2
-        subc   gr97,gr97,gr105
-       jmp     Lstore
-        mtsr   cr,gr118
-L2:    jmpfdec gr117,L3
-        subc   gr98,gr98,gr106
-       jmp     Lstore
-        mtsr   cr,gr118
-L3:    jmpfdec gr117,L4
-        subc   gr99,gr99,gr107
-       jmp     Lstore
-        mtsr   cr,gr118
-L4:    jmpfdec gr117,L5
-        subc   gr100,gr100,gr108
-       jmp     Lstore
-        mtsr   cr,gr118
-L5:    jmpfdec gr117,L6
-        subc   gr101,gr101,gr109
-       jmp     Lstore
-        mtsr   cr,gr118
-L6:    subc    gr102,gr102,gr110
-
-Lstore:        storem  0,0,gr96,lr2
-       subc    gr116,gr116,gr116       ; gr116 = not(cy)
-
-Lend:  jmpi    lr0
-        add    gr96,gr116,1
diff --git a/mpn/a29k/submul_1.s b/mpn/a29k/submul_1.s
deleted file mode 100644 (file)
index 8a02d88..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-; 29000 __gmpn_submul_1 -- Multiply a limb vector with a single limb and
-; subtract the product from a second limb vector.
-
-; Copyright 1992, 1994, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-; INPUT PARAMETERS
-; res_ptr      lr2
-; s1_ptr       lr3
-; size         lr4
-; s2_limb      lr5
-
-       .cputype 29050
-       .sect .lit,lit
-       .text
-       .align  4
-       .global ___gmpn_submul_1
-       .word   0x60000
-___gmpn_submul_1:
-       sub     lr4,lr4,8
-       jmpt    lr4,Ltail
-        const  gr120,0                 ; init cylimb reg
-
-       srl     gr117,lr4,3             ; divide by 8
-       sub     gr117,gr117,1           ; count for jmpfdec
-
-Loop:  mtsrim  cr,(8-1)
-       loadm   0,0,gr96,lr3
-       add     lr3,lr3,32
-
-       multiplu gr104,gr96,lr5
-       multmu   gr96,gr96,lr5
-       multiplu gr105,gr97,lr5
-       multmu   gr97,gr97,lr5
-       multiplu gr106,gr98,lr5
-       multmu   gr98,gr98,lr5
-       multiplu gr107,gr99,lr5
-       multmu   gr99,gr99,lr5
-       multiplu gr108,gr100,lr5
-       multmu   gr100,gr100,lr5
-       multiplu gr109,gr101,lr5
-       multmu   gr101,gr101,lr5
-       multiplu gr110,gr102,lr5
-       multmu   gr102,gr102,lr5
-       multiplu gr111,gr103,lr5
-       multmu   gr103,gr103,lr5
-
-       add     gr104,gr104,gr120
-       addc    gr105,gr105,gr96
-       addc    gr106,gr106,gr97
-       addc    gr107,gr107,gr98
-       addc    gr108,gr108,gr99
-       addc    gr109,gr109,gr100
-       addc    gr110,gr110,gr101
-       addc    gr111,gr111,gr102
-       addc    gr120,gr103,0
-
-       mtsrim  cr,(8-1)
-       loadm   0,0,gr96,lr2
-
-       sub     gr96,gr96,gr104
-       subc    gr97,gr97,gr105
-       subc    gr98,gr98,gr106
-       subc    gr99,gr99,gr107
-       subc    gr100,gr100,gr108
-       subc    gr101,gr101,gr109
-       subc    gr102,gr102,gr110
-       subc    gr103,gr103,gr111
-
-       add     gr104,gr103,gr111       ; invert carry from previous sub
-       addc    gr120,gr120,0
-
-       mtsrim  cr,(8-1)
-       storem  0,0,gr96,lr2
-       jmpfdec gr117,Loop
-        add    lr2,lr2,32
-
-Ltail: and     lr4,lr4,(8-1)
-       sub     gr118,lr4,1             ; count for CR
-       jmpt    gr118,Lend
-        sub    lr4,lr4,2
-       sub     lr2,lr2,4               ; offset res_ptr by one limb
-
-Loop2: load    0,0,gr116,lr3
-       add     lr3,lr3,4
-       multiplu gr117,gr116,lr5
-       multmu  gr118,gr116,lr5
-       add     lr2,lr2,4
-       load    0,0,gr119,lr2
-       add     gr117,gr117,gr120
-       addc    gr118,gr118,0
-       sub     gr119,gr119,gr117
-       add     gr104,gr119,gr117       ; invert carry from previous sub
-       store   0,0,gr119,lr2
-       jmpfdec lr4,Loop2
-        addc   gr120,gr118,0
-
-Lend:  jmpi    lr0
-        or     gr96,gr120,0            ; copy
diff --git a/mpn/a29k/udiv.s b/mpn/a29k/udiv.s
deleted file mode 100644 (file)
index 82c3925..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-; Copyright 1999, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-       .sect .lit,lit
-       .text
-       .align 4
-       .global ___udiv_qrnnd
-       .word 0x60000
-___udiv_qrnnd:
-       mtsr q,lr3
-       dividu gr96,lr4,lr5
-       mfsr gr116,q
-       jmpi lr0
-       store 0,0,gr116,lr2
diff --git a/mpn/a29k/umul.s b/mpn/a29k/umul.s
deleted file mode 100644 (file)
index 02c34e9..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-; Copyright 1999, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-       .sect .lit,lit
-       .text
-       .align 4
-       .global ___umul_ppmm
-       .word 0x50000
-___umul_ppmm:
-       multiplu gr116,lr3,lr4
-       multmu gr96,lr3,lr4
-       jmpi lr0
-       store 0,0,gr116,lr2
index abefaa64c9c8fb77deee62bb8c935df63c9d9e0b..09c2f040473f4abd1b8e9b7490678dcb5581ce31 100644 (file)
@@ -1,20 +1,30 @@
-Copyright 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
-Foundation, Inc.
+Copyright 1996, 1997, 1999-2005 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 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.
+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 Lesser General Public License
+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 a copy of the GNU Lesser General Public License along
-with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index 819053b8aedfa91bd6b23f00bc7ef1dff0c3c419..bc572a57a90feb3c0b5c8d0ca68cf5e582ba4b8c 100644 (file)
@@ -4,19 +4,30 @@ dnl  store sum in a third limb vector.
 dnl  Copyright 1995, 1999, 2000, 2005, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 22c41a5c743d6512281b530c8c569c56e37d50f1..c4e6834b615713ffb543d28ce3d1fdfdf7807334 100644 (file)
@@ -4,19 +4,30 @@ dnl result to a second limb vector.
 dnl  Copyright 1992, 1994, 1995, 2000, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index b2f9a242a8a68876e47cae06785f018f923f53b1..af34c9294c9671c052b3a91b52d7344356a0349a 100644 (file)
@@ -3,21 +3,32 @@ divert(-1)
 dnl  m4 macros for Alpha assembler.
 
 dnl  Copyright 2003, 2004 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  Usage: ASSERT([reg] [,code])
index 3694f787616e8abb44eb460013e44dc125877311..9525e669db2a39a6bea39188fbd388a9271f8bda 100644 (file)
@@ -1,36 +1,40 @@
 dnl  Alpha mpn_addlsh1_n/mpn_sublsh1_n -- rp[] = up[] +- (vp[] << 1).
 
-dnl  Copyright 2003 Free Software Foundation, Inc.
+dnl  Copyright 2003, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C      cycles/limb
-C EV4:    12.5
+C EV4:     ?
 C EV5:     6.25
-C EV6:     4.375 (i.e., worse than separate mpn_lshift and mpn_add_n at 3.875)
+C EV6:     4.5
 
-C TODO
-C  * Write special version for ev6, as this is a slowdown for 100 < n < 2200
-C    compared to separate mpn_lshift and mpn_add_n.
-C  * Use addq instead of sll for left shift, and similarly cmplt instead of srl
-C    for right shift.
-
-dnl  INPUT PARAMETERS
 define(`rp',`r16')
 define(`up',`r17')
 define(`vp',`r18')
@@ -38,12 +42,8 @@ define(`n', `r19')
 
 define(`u0', `r8')
 define(`u1', `r1')
-define(`u2', `r2')
-define(`u3', `r3')
 define(`v0', `r4')
 define(`v1', `r5')
-define(`v2', `r6')
-define(`v3', `r7')
 
 define(`cy0', `r0')
 define(`cy1', `r20')
@@ -67,168 +67,98 @@ MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_n)
 
 ASM_START()
 PROLOGUE(func)
-       lda     n, -4(n)
-       bis     r31, r31, cy1
-       and     n, 3, r1
-       beq     r1, $Lb00
-       cmpeq   r1, 1, r2
-       bne     r2, $Lb01
-       cmpeq   r1, 2, r2
-       bne     r2, $Lb10
-$Lb11: C n = 3, 7, 11, ...
-       ldq     v0, 0(vp)
-       ldq     u0, 0(up)
-       ldq     v1, 8(vp)
-       ldq     u1, 8(up)
-       ldq     v2, 16(vp)
-       ldq     u2, 16(up)
-       lda     vp, 24(vp)
-       lda     up, 24(up)
-       bge     n, $Loop
-       br      r31, $Lcj3
-$Lb10: C n = 2, 6, 10, ...
-       bis     r31, r31, cy0
-       ldq     v1, 0(vp)
+       and     n, 2, cy0
+       blbs    n, L(bx1)
+L(bx0):        ldq     v1, 0(vp)
        ldq     u1, 0(up)
-       ldq     v2, 8(vp)
-       ldq     u2, 8(up)
+       nop
+       bne     cy0, L(b10)
+
+L(b00):        lda     vp, 48(vp)
+       lda     up, -16(up)
        lda     rp, -8(rp)
-       blt     n, $Lcj2
-       ldq     v3, 16(vp)
-       ldq     u3, 16(up)
-       lda     vp, 48(vp)
-       lda     up, 16(up)
-       br      r31, $LL10
-$Lb01: C n = 1, 5, 9, ...
-       ldq     v2, 0(vp)
-       ldq     u2, 0(up)
-       lda     rp, -16(rp)
-       blt     n, $Lcj1
-       ldq     v3, 8(vp)
-       ldq     u3, 8(up)
-       ldq     v0, 16(vp)
-       ldq     u0, 16(up)
-       lda     vp, 40(vp)
-       lda     up, 8(up)
-       lda     rp, 32(rp)
-       br      r31, $LL01
-$Lb00: C n = 4, 8, 12, ...
-       bis     r31, r31, cy0
-       ldq     v3, 0(vp)
-       ldq     u3, 0(up)
-       ldq     v0, 8(vp)
-       ldq     u0, 8(up)
-       ldq     v1, 16(vp)
-       ldq     u1, 16(up)
-       lda     vp, 32(vp)
+       br      r31, L(lo0)
+
+L(b10):        lda     vp, 32(vp)
        lda     rp, 8(rp)
-       br      r31, $LL00x
+       lda     cy0, 0(r31)
+       br      r31, L(lo2)
+
+L(bx1):        ldq     v0, 0(vp)
+       ldq     u0, 0(up)
+       lda     cy1, 0(r31)
+       beq     cy0, L(b01)
+
+L(b11):        lda     vp, 40(vp)
+       lda     up, -24(up)
+       lda     rp, 16(rp)
+       br      r31, L(lo3)
+
+L(b01):        lda     n, -4(n)
+       ble     n, L(end)
+       lda     vp, 24(vp)
+       lda     up, -8(up)
+
        ALIGN(16)
-C 0
-$Loop: sll     v0, 1, sl       C left shift vlimb
-       ldq     v3, 0(vp)
-C 1
+L(top):        addq    v0, v0, sl      C left shift vlimb
+       ldq     v1, -16(vp)
        ADDSUB  u0, sl, ps      C ulimb + (vlimb << 1)
-       ldq     u3, 0(up)
-C 2
+       cmplt   v0, r31, cy0    C carry out #1
+       ldq     u1, 16(up)
        ADDSUB  ps, cy1, rr     C consume carry from previous operation
-       srl     v0, 63, cy0     C carry out #1
-C 3
        CARRY(  ps, u0, cy)     C carry out #2
        stq     rr, 0(rp)
-C 4
        addq    cy, cy0, cy0    C combine carry out #1 and #2
        CARRY(  rr, ps, cy)     C carry out #3
-C 5
        addq    cy, cy0, cy0    C final carry out
        lda     vp, 32(vp)      C bookkeeping
-C 6
-$LL10: sll     v1, 1, sl
-       ldq     v0, -24(vp)
-C 7
+L(lo0):        addq    v1, v1, sl
+       ldq     v0, -40(vp)
        ADDSUB  u1, sl, ps
-       ldq     u0, 8(up)
-C 8
+       cmplt   v1, r31, cy1
+       ldq     u0, 24(up)
        ADDSUB  ps, cy0, rr
-       srl     v1, 63, cy1
-C 9
        CARRY(  ps, u1, cy)
        stq     rr, 8(rp)
-C 10
        addq    cy, cy1, cy1
        CARRY(  rr, ps, cy)
-C 11
        addq    cy, cy1, cy1
        lda     rp, 32(rp)      C bookkeeping
-C 12
-$LL01: sll     v2, 1, sl
-       ldq     v1, -16(vp)
-C 13
-       ADDSUB  u2, sl, ps
-       ldq     u1, 16(up)
-C 14
+L(lo3):        addq    v0, v0, sl
+       ldq     v1, -32(vp)
+       ADDSUB  u0, sl, ps
+       cmplt   v0, r31, cy0
+       ldq     u1, 32(up)
        ADDSUB  ps, cy1, rr
-       srl     v2, 63, cy0
-C 15
-       CARRY(  ps, u2, cy)
+       CARRY(  ps, u0, cy)
        stq     rr, -16(rp)
-C 16
        addq    cy, cy0, cy0
        CARRY(  rr, ps, cy)
-C 17
        addq    cy, cy0, cy0
-$LL00x:        lda     up, 32(up)      C bookkeeping
-C 18
-       sll     v3, 1, sl
-       ldq     v2, -8(vp)
-C 19
-       ADDSUB  u3, sl, ps
-       ldq     u2, -8(up)
-C 20
+       lda     up, 32(up)      C bookkeeping
+L(lo2):        addq    v1, v1, sl
+       ldq     v0, -24(vp)
+       ADDSUB  u1, sl, ps
+       cmplt   v1, r31, cy1
+       ldq     u0, 8(up)
        ADDSUB  ps, cy0, rr
-       srl     v3, 63, cy1
-C 21
-       CARRY(  ps, u3, cy)
+       CARRY(  ps, u1, cy)
        stq     rr, -8(rp)
-C 22
        addq    cy, cy1, cy1
        CARRY(  rr, ps, cy)
-C 23
        addq    cy, cy1, cy1
        lda     n, -4(n)        C bookkeeping
-C 24
-       bge     n, $Loop
+       bgt     n, L(top)
 
-$Lcj3: sll     v0, 1, sl
+L(end):        addq    v0, v0, sl
        ADDSUB  u0, sl, ps
        ADDSUB  ps, cy1, rr
-       srl     v0, 63, cy0
+       cmplt   v0, r31, cy0
        CARRY(  ps, u0, cy)
        stq     rr, 0(rp)
        addq    cy, cy0, cy0
        CARRY(  rr, ps, cy)
-       addq    cy, cy0, cy0
-
-$Lcj2: sll     v1, 1, sl
-       ADDSUB  u1, sl, ps
-       ADDSUB  ps, cy0, rr
-       srl     v1, 63, cy1
-       CARRY(  ps, u1, cy)
-       stq     rr, 8(rp)
-       addq    cy, cy1, cy1
-       CARRY(  rr, ps, cy)
-       addq    cy, cy1, cy1
-
-$Lcj1: sll     v2, 1, sl
-       ADDSUB  u2, sl, ps
-       ADDSUB  ps, cy1, rr
-       srl     v2, 63, cy0
-       CARRY(  ps, u2, cy)
-       stq     rr, 16(rp)
-       addq    cy, cy0, cy0
-       CARRY(  rr, ps, cy)
-       addq    cy, cy0, cy0
-
+       addq    cy, cy0, r0
        ret     r31,(r26),1
 EPILOGUE()
 ASM_END()
diff --git a/mpn/alpha/aorslsh2_n.asm b/mpn/alpha/aorslsh2_n.asm
new file mode 100644 (file)
index 0000000..bdee1d6
--- /dev/null
@@ -0,0 +1,167 @@
+dnl  Alpha mpn_addlsh2_n/mpn_sublsh2_n -- rp[] = up[] +- (vp[] << 2).
+
+dnl  Copyright 2003, 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 EV4:     ?
+C EV5:     6
+C EV6:     3.75
+
+C TODO
+C  * Tune to reach 3.5 c/l on ev6 and 5.75 c/l on ev5.
+
+define(`rp',`r16')
+define(`up',`r17')
+define(`vp',`r18')
+define(`n', `r19')
+
+define(`u0', `r8')
+define(`u1', `r1')
+define(`v0', `r4')
+define(`v1', `r5')
+
+define(`cy0', `r0')
+define(`cy1', `r20')
+define(`cy', `r22')
+define(`rr', `r24')
+define(`ps', `r25')
+define(`sl', `r28')
+
+ifdef(`OPERATION_addlsh2_n',`
+  define(ADDSUB,       addq)
+  define(CARRY,       `cmpult $1,$2,$3')
+  define(func, mpn_addlsh2_n)
+')
+ifdef(`OPERATION_sublsh2_n',`
+  define(ADDSUB,       subq)
+  define(CARRY,       `cmpult $2,$1,$3')
+  define(func, mpn_sublsh2_n)
+')
+
+MULFUNC_PROLOGUE(mpn_addlsh2_n mpn_sublsh2_n)
+
+ASM_START()
+PROLOGUE(func)
+       and     n, 2, cy0
+       blbs    n, L(bx1)
+L(bx0):        ldq     v1, 0(vp)
+       ldq     u1, 0(up)
+       bis     r31, r31, r2
+       bne     cy0, L(b10)
+
+L(b00):        lda     vp, 48(vp)
+       lda     up, -16(up)
+       lda     rp, -8(rp)
+       s4addq  v1, r31, sl
+       br      r31, L(lo0)
+
+L(b10):        lda     vp, 32(vp)
+       lda     rp, 8(rp)
+       lda     cy0, 0(r31)
+       br      r31, L(lo2)
+
+L(bx1):        ldq     v0, 0(vp)
+       ldq     u0, 0(up)
+       lda     cy1, 0(r31)
+       bis     r31, r31, r3
+       nop
+       beq     cy0, L(b01)
+
+L(b11):        lda     vp, 40(vp)
+       lda     up, -24(up)
+       lda     rp, 16(rp)
+       br      r31, L(lo3)
+
+L(b01):        lda     n, -4(n)
+       ble     n, L(end)
+       lda     vp, 24(vp)
+       lda     up, -8(up)
+
+       ALIGN(16)
+L(top):        s4addq  v0, r3, sl      C combined vlimb
+       ldq     v1, -16(vp)
+       ADDSUB  u0, sl, ps      C ulimb + (vlimb << 1)
+       ldq     u1, 16(up)
+       srl     v0, 62, r2      C high v bits
+       ADDSUB  ps, cy1, rr     C consume carry from previous operation
+       CARRY(  ps, u0, cy0)    C carry out #2
+       stq     rr, 0(rp)
+       CARRY(  rr, ps, cy)     C carry out #3
+       lda     vp, 32(vp)      C bookkeeping
+       addq    cy, cy0, cy0    C final carry out
+       s4addq  v1, r2, sl
+L(lo0):        ldq     v0, -40(vp)
+       ADDSUB  u1, sl, ps
+       ldq     u0, 24(up)
+       srl     v1, 62, r3
+       ADDSUB  ps, cy0, rr
+       CARRY(  ps, u1, cy1)
+       stq     rr, 8(rp)
+       CARRY(  rr, ps, cy)
+       lda     rp, 32(rp)      C bookkeeping
+       addq    cy, cy1, cy1
+L(lo3):        s4addq  v0, r3, sl
+       ldq     v1, -32(vp)
+       ADDSUB  u0, sl, ps
+       ldq     u1, 32(up)
+       srl     v0, 62, r2
+       ADDSUB  ps, cy1, rr
+       CARRY(  ps, u0, cy0)
+       stq     rr, -16(rp)
+       CARRY(  rr, ps, cy)
+       lda     up, 32(up)      C bookkeeping
+       addq    cy, cy0, cy0
+L(lo2):        s4addq  v1, r2, sl
+       ldq     v0, -24(vp)
+       ADDSUB  u1, sl, ps
+       ldq     u0, 8(up)
+       srl     v1, 62, r3
+       ADDSUB  ps, cy0, rr
+       CARRY(  ps, u1, cy1)
+       stq     rr, -8(rp)
+       CARRY(  rr, ps, cy)
+       lda     n, -4(n)        C bookkeeping
+       addq    cy, cy1, cy1
+       bgt     n, L(top)
+
+L(end):        s4addq  v0, r3, sl
+       ADDSUB  u0, sl, ps
+       srl     v0, 62, r2
+       ADDSUB  ps, cy1, rr
+       CARRY(  ps, u0, cy0)
+       stq     rr, 0(rp)
+       CARRY(  rr, ps, cy)
+       addq    cy, cy0, cy0
+       addq    cy0, r2, r0
+
+       ret     r31,(r26),1
+EPILOGUE()
+ASM_END()
index e5f11dbf481ed8141237b5772c0972a7bfc23a8f..472966ca98e4159170edf3dabb915bc4e172a425 100644 (file)
@@ -3,19 +3,30 @@ dnl  Alpha mpn_bdiv_dbm1c.
 dnl  Copyright 2008 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 2bfd923e5e3887c16dde9f1b94e5da8a0d1ed88a..25af19b1316773823e058035ae170b5dc1dc8cef 100644 (file)
@@ -3,19 +3,30 @@ dnl  Alpha auxiliary for longlong.h's count_leading_zeros
 dnl  Copyright 1997, 2000, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 6f6c39af6eadf8549997a3fd4f6f3e9a318f150b..f084ab5e961cdc4ec32ed8201aa6852fdf42628d 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Alpha mpn_com -- mpn one's complement.
 
 dnl  Copyright 2003 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index ba8fa1c6338cf32bd4aae8c29264c5c9324e506a..b41b5366cc5e79c2ca02468e6504c80c316029ae 100644 (file)
@@ -3,19 +3,30 @@ dnl  Alpha mpn_copyd -- copy, decrementing.
 dnl  Copyright 2002, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 425804127ed5cf54248baa204e0bcb6e452906e1..f7e2ad6f6a9d5652879b8d1b7aa00ebdac6fdb18 100644 (file)
@@ -3,19 +3,30 @@ dnl  Alpha mpn_copyi -- copy, incrementing.
 dnl  Copyright 2002, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index e7aae2eeea46afa167eb43875748fc6039970956..8fe7c4e1223180784938c6a29890e0c87d45ad91 100644 (file)
@@ -3,22 +3,33 @@ divert(-1)
 dnl  m4 macros for alpha assembler (everywhere except unicos).
 
 
-dnl  Copyright 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000, 2002-2004, 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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 MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or both in parallel, as here.
+dnl
+dnl  The GNU MP Library is distributed in the hope that it will be useful, but
+dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  Usage: ASM_START()
@@ -53,8 +64,9 @@ ifelse(`$2',noalign,,`        ALIGN(16)')
        .globl  $1
        .ent    $1
 $1:
-ifelse(`$2',gp,`       ldgp    r29,0(r27)')
-       .frame r30,0,r26
+       .frame r30,0,r26,0
+ifelse(`$2',gp,`       ldgp    r29, 0(r27)
+`$'$1..ng:')
        .prologue ifelse(`$2',gp,1,0)')
 
 define(`EPILOGUE_cpu',
@@ -90,12 +102,13 @@ forloop(i,0,31,`defreg(`r'i,$i)')
 forloop(i,0,31,`deflit(`f'i,``$f''i)')
 
 
-dnl  Usage: DATASTART(name)
+dnl  Usage: DATASTART(name,align)  or  DATASTART(name)
 dnl         DATAEND()
 
 define(`DATASTART',
-m4_assert_numargs(1)
-`      DATA
+m4_assert_numargs_range(1,2)
+`      RODATA
+       ALIGN(ifelse($#,1,2,$2))
 $1:')
 define(`DATAEND',
 m4_assert_numargs(0)
@@ -104,7 +117,7 @@ m4_assert_numargs(0)
 dnl  Load a symbolic address into a register
 define(`LEA',
 m4_assert_numargs(2)
-`lda   $1,  $2')
+`lda   $1, $2')
 
 dnl  Usage: ASM_END()
 define(`ASM_END',
index a915c58a9ec93390c95c35aab41724d298212252..88b82db2f73e94532eb16732d2cd87ce1474e4e8 100644 (file)
@@ -4,22 +4,33 @@
    CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
    FUTURE GNU MP RELEASES.
 
-Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2000-2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index b68468bca03f1780fcee47f4ca9780d411b4fe4d..046b246a95edb75317bc380f0873a11781dabcad 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Alpha mpn_divrem_2 -- Divide an mpn number by a normalized 2-limb number.
 
-dnl  Copyright 2007, 2008 Free Software Foundation, Inc.
+dnl  Copyright 2007, 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -41,8 +52,7 @@ define(`un_param',    `r19')
 define(`dp',           `r20')
 
 ASM_START()
-PROLOGUE(mpn_divrem_2)
-       ldgp    r29, 0(r27)
+PROLOGUE(mpn_divrem_2,gp)
        lda     r30, -80(r30)
        stq     r26, 0(r30)
        stq     r9, 8(r30)
@@ -80,7 +90,7 @@ L(L8):        stq     r3, 72(r30)
        blt     r19, L(L10)
        bis     r31, r12, r16
        jsr     r26, mpn_invert_limb
-       ldgp    r29, 0(r26)
+       LDGP(   r29, 0(r26))
        mulq    r0, r12, r4             C t0 = LO(di * d1)
        umulh   r0, r10, r2             C s1 = HI(di * d0)
        addq    r4, r10, r4             C t0 += d0
index 334e1cec545b9aa070d4e433c35b901f0cbf691a..3758188e0200545270919fb582ac4ea440a55712 100644 (file)
@@ -3,19 +3,30 @@ dnl  Alpha mpn_divexact_by3c -- mpn division by 3, expecting no remainder.
 dnl  Copyright 2004, 2005, 2009 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -39,7 +50,7 @@ define(`cy',  `r19')
 
 ASM_START()
 
-DATASTART(L(LC))
+DATASTART(L(LC),8)
        .quad   0xAAAAAAAAAAAAAAAB
        .quad   0x5555555555555555
        .quad   0xAAAAAAAAAAAAAAAA
index e4396e5db9092742ba08dd1de2f2a3bd8f984c27..b560c20afec34ef54cd22c5bdfadf4775b94c422 100644 (file)
 /* Alpha EV5 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 2005, 2008, 2009,
-2010 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2002, 2004, 2005, 2008-2010, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
-
+#define GMP_LIMB_BYTES 8
 
 /* 600 MHz 21164A */
+/* FFT tuning limit = 5000000 */
+/* Generated by tuneup.c, 2014-03-12, gcc 4.5 */
 
 #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          6
-#define MOD_1U_TO_MOD_1_1_THRESHOLD          2
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD        78
+#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        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 USE_PREINV_DIVREM_1                  1  /* preinv always */
-#define DIV_QR_2_PI2_THRESHOLD              25
+#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           80
+#define BMOD_1_TO_MOD_1_THRESHOLD           76
 
 #define MUL_TOOM22_THRESHOLD                14
-#define MUL_TOOM33_THRESHOLD                66
+#define MUL_TOOM33_THRESHOLD                50
 #define MUL_TOOM44_THRESHOLD               118
 #define MUL_TOOM6H_THRESHOLD               157
 #define MUL_TOOM8H_THRESHOLD               236
 
 #define MUL_TOOM32_TO_TOOM43_THRESHOLD      73
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD      84
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD      77
 #define MUL_TOOM42_TO_TOOM53_THRESHOLD      81
 #define MUL_TOOM42_TO_TOOM63_THRESHOLD      56
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD      66
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD      70
 
-#define SQR_BASECASE_THRESHOLD               5
-#define SQR_TOOM2_THRESHOLD                 26
-#define SQR_TOOM3_THRESHOLD                 77
-#define SQR_TOOM4_THRESHOLD                130
-#define SQR_TOOM6_THRESHOLD                173
+#define SQR_BASECASE_THRESHOLD               0  /* always */
+#define SQR_TOOM2_THRESHOLD                 22
+#define SQR_TOOM3_THRESHOLD                 73
+#define SQR_TOOM4_THRESHOLD                178
+#define SQR_TOOM6_THRESHOLD                  0  /* always */
 #define SQR_TOOM8_THRESHOLD                260
 
-#define MULMID_TOOM42_THRESHOLD             20
+#define MULMID_TOOM42_THRESHOLD             18
 
-#define MULMOD_BNM1_THRESHOLD               11
-#define SQRMOD_BNM1_THRESHOLD               13
+#define MULMOD_BNM1_THRESHOLD                9
+#define SQRMOD_BNM1_THRESHOLD               12
 
-#define MUL_FFT_MODF_THRESHOLD             244  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             284  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    244, 5}, {     11, 6}, {      6, 5}, {     13, 6}, \
+  { {    284, 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}, {     20, 8}, {     11, 7}, {     23, 8}, \
-    {     13, 7}, {     27, 9}, {      7, 8}, {     21, 9}, \
-    {     11, 8}, {     25,10}, {      7, 9}, {     15, 8}, \
-    {     33, 9}, {     23,10}, {     15, 9}, {     39,10}, \
+    {     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}, \
+    {     23, 8}, {     47,10}, {     15, 9}, {     39,10}, \
     {     23, 9}, {     47,11}, {     15,10}, {     31, 9}, \
     {     67,10}, {     39, 9}, {     79,10}, {     47, 9}, \
-    {     95,10}, {     55,11}, {     31,10}, {     63, 9}, \
-    {    127,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, 8}, {    639,10}, {    175,11}, {     95,10}, \
-    {    191, 9}, {    383,10}, {    207, 9}, {    415,11}, \
-    {    111,12}, {     63,11}, {    127,10}, {    255,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,13}, \
-    {    127,12}, {    255,11}, {    511,12}, {    287,11}, \
-    {    575,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}, {    575,13}, {    319,12}, {    703,13}, \
-    {    383,12}, {    831,13}, {    447,12}, {    895,14}, \
-    {    255,13}, {    511,12}, {   1023,13}, {    575,12}, \
-    {   1151,13}, {    703,12}, {   1407,14}, {  16384,15}, \
+    {     95,10}, {     55,11}, {     31,10}, {     63, 8}, \
+    {    255, 7}, {    511,10}, {     71, 9}, {    143, 8}, \
+    {    287, 7}, {    575, 9}, {    159, 8}, {    319,11}, \
+    {     47,12}, {     31,11}, {     63, 9}, {    255, 8}, \
+    {    511,10}, {    143, 9}, {    287,11}, {     79,10}, \
+    {    159, 9}, {    319,10}, {    175, 9}, {    351, 8}, \
+    {    703,10}, {    191, 9}, {    383,10}, {    207, 9}, \
+    {    415,12}, {     63,10}, {    255,11}, {    143,10}, \
+    {    287, 9}, {    575,11}, {    159,10}, {    319, 9}, \
+    {    639,11}, {    175,12}, {     95,11}, {    191,10}, \
+    {    383,11}, {    207,10}, {    415,11}, {    223,13}, \
+    {     63,11}, {    287,10}, {    575,12}, {    159,11}, \
+    {    319,10}, {    639,11}, {    351,12}, {    191,11}, \
+    {    415,12}, {    223,11}, {    447,10}, {    895,11}, \
+    {    479,12}, {    287,11}, {    575,12}, {    351,13}, \
+    {    191,12}, {    479,13}, {    255,12}, {    575,13}, \
+    {    319,12}, {    703,13}, {    383,12}, {    831,13}, \
+    {    447,14}, {    255,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 141
-#define MUL_FFT_THRESHOLD                 3008
+#define MUL_FFT_TABLE3_SIZE 121
+#define MUL_FFT_THRESHOLD                 4224
 
-#define SQR_FFT_MODF_THRESHOLD             212  /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD             240  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    220, 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}, {     30, 8}, \
-    {     19, 4}, {    319, 9}, {     11, 8}, {     25,10}, \
-    {      7, 9}, {     15, 8}, {     31, 7}, {     64, 9}, \
-    {     19, 8}, {     39, 7}, {     79, 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}, {     63, 9}, {    127,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,11}, {    111,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,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,12}, {    287,11}, \
-    {    575,12}, {    319,11}, {    639,12}, {    351,13}, \
-    {    191,12}, {    383,11}, {    767,12}, {    415,11}, \
-    {    831,12}, {    447,14}, {    127,13}, {    255,12}, \
-    {    575,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}, {  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 135
-#define SQR_FFT_THRESHOLD                 1984
-
-#define MULLO_BASECASE_THRESHOLD             2
-#define MULLO_DC_THRESHOLD                  50
-#define MULLO_MUL_N_THRESHOLD             5397
-
-#define DC_DIV_QR_THRESHOLD                 52
-#define DC_DIVAPPR_Q_THRESHOLD             172
-#define DC_BDIV_QR_THRESHOLD                51
-#define DC_BDIV_Q_THRESHOLD                112
-
-#define INV_MULMOD_BNM1_THRESHOLD           38
-#define INV_NEWTON_THRESHOLD               179
-#define INV_APPR_THRESHOLD                 180
-
-#define BINV_NEWTON_THRESHOLD              197
+  { {    240, 5}, {     13, 6}, {      7, 5}, {     15, 6}, \
+    {     14, 5}, {     29, 7}, {      9, 6}, {     19, 7}, \
+    {     13, 6}, {     27, 8}, {      7, 7}, {     21, 8}, \
+    {     11, 7}, {     29, 8}, {     19, 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}, {     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,10}, {     79,11}, {     47,12}, {     31,11}, \
+    {     63,10}, {    127, 9}, {    255,10}, {    143, 9}, \
+    {    287,11}, {     79,10}, {    159, 9}, {    319,10}, \
+    {    175,11}, {     95,10}, {    191, 9}, {    383,10}, \
+    {    207, 9}, {    415,11}, {    111,10}, {    223,12}, \
+    {     63,11}, {    175,12}, {     95,11}, {    207,13}, \
+    {     63,12}, {    127,11}, {    287,12}, {    159,11}, \
+    {    351,12}, {    191,11}, {    415,12}, {    223,11}, \
+    {    447,13}, {    127,12}, {    351,13}, {    191,12}, \
+    {    383,11}, {    767,12}, {    415,11}, {    831,12}, \
+    {    447,14}, {    127,13}, {    255,12}, {    511,11}, \
+    {   1087,12}, {    575,13}, {    319,12}, {    703,13}, \
+    {    383,12}, {    831,13}, {    447,14}, {    255,13}, \
+    {    511,12}, {   1023,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 105
+#define SQR_FFT_THRESHOLD                 3968
+
+#define MULLO_BASECASE_THRESHOLD             0  /* always */
+#define MULLO_DC_THRESHOLD                  45
+#define MULLO_MUL_N_THRESHOLD             8397
+
+#define DC_DIV_QR_THRESHOLD                 47
+#define DC_DIVAPPR_Q_THRESHOLD             168
+#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 BINV_NEWTON_THRESHOLD              196
 #define REDC_1_TO_REDC_N_THRESHOLD          51
 
-#define MU_DIV_QR_THRESHOLD                998
-#define MU_DIVAPPR_Q_THRESHOLD             998
+#define MU_DIV_QR_THRESHOLD               1558
+#define MU_DIVAPPR_Q_THRESHOLD            1558
 #define MUPI_DIV_QR_THRESHOLD               90
-#define MU_BDIV_QR_THRESHOLD               807
+#define MU_BDIV_QR_THRESHOLD               855
 #define MU_BDIV_Q_THRESHOLD               1078
 
-#define POWM_SEC_TABLE  2,17,188,393
+#define POWM_SEC_TABLE  1,16,90,452,1221
 
 #define MATRIX22_STRASSEN_THRESHOLD         11
-#define HGCD_THRESHOLD                     105
-#define HGCD_APPR_THRESHOLD                105
-#define HGCD_REDUCE_THRESHOLD             1494
-#define GCD_DC_THRESHOLD                   285
-#define GCDEXT_DC_THRESHOLD                206
+#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 GET_STR_DC_THRESHOLD                14
-#define GET_STR_PRECOMPUTE_THRESHOLD        29
+#define GET_STR_DC_THRESHOLD                13
+#define GET_STR_PRECOMPUTE_THRESHOLD        28
 #define SET_STR_DC_THRESHOLD               426
-#define SET_STR_PRECOMPUTE_THRESHOLD      1535
+#define SET_STR_PRECOMPUTE_THRESHOLD      1505
 
-#define FAC_DSC_THRESHOLD                 1502
+#define FAC_DSC_THRESHOLD                 1404
 #define FAC_ODD_THRESHOLD                    0  /* always */
index 114af73aa0441cd86e3cb027db7c90542453e436..9261f31b8a13c0c20a669c5c63114979f4ee63d6 100644 (file)
@@ -4,19 +4,30 @@ dnl  store sum in a third limb vector.
 dnl  Copyright 2000, 2003, 2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/alpha/ev6/aorslsh1_n.asm b/mpn/alpha/ev6/aorslsh1_n.asm
new file mode 100644 (file)
index 0000000..cb966ce
--- /dev/null
@@ -0,0 +1,172 @@
+dnl  Alpha mpn_addlsh1_n/mpn_sublsh1_n -- rp[] = up[] +- (vp[] << 1).
+
+dnl  Copyright 2003, 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 EV4:     ?
+C EV5:     7
+C EV6:     4
+
+C TODO
+C  * Tune to reach 3.75 c/l on ev6.
+
+define(`rp',`r16')
+define(`up',`r17')
+define(`vp',`r18')
+define(`n', `r19')
+
+define(`u0', `r8')
+define(`u1', `r1')
+define(`v0', `r4')
+define(`v1', `r5')
+
+define(`cy0', `r0')
+define(`cy1', `r20')
+define(`cy', `r22')
+define(`rr', `r24')
+define(`ps', `r25')
+define(`sl', `r28')
+
+ifdef(`OPERATION_addlsh1_n',`
+  define(ADDSUB,       addq)
+  define(CARRY,       `cmpult $1,$2,$3')
+  define(func, mpn_addlsh1_n)
+')
+ifdef(`OPERATION_sublsh1_n',`
+  define(ADDSUB,       subq)
+  define(CARRY,       `cmpult $2,$1,$3')
+  define(func, mpn_sublsh1_n)
+')
+
+MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_n)
+
+ASM_START()
+PROLOGUE(func)
+       and     n, 2, cy0
+       blbs    n, L(bx1)
+L(bx0):        ldq     v1, 0(vp)
+       ldq     u1, 0(up)
+       lda     r2, 0(r31)
+       bne     cy0, L(b10)
+
+L(b00):        lda     vp, 48(vp)
+       lda     up, -16(up)
+       lda     rp, -8(rp)
+       lda     cy0, 0(r31)
+       br      r31, L(lo0)
+
+L(b10):        lda     vp, 32(vp)
+       lda     rp, 8(rp)
+       lda     cy0, 0(r31)
+       br      r31, L(lo2)
+
+L(bx1):        ldq     v0, 0(vp)
+       ldq     u0, 0(up)
+       lda     r3, 0(r31)
+       beq     cy0, L(b01)
+
+L(b11):        lda     vp, 40(vp)
+       lda     up, -24(up)
+       lda     rp, 16(rp)
+       lda     cy1, 0(r31)
+       br      r31, L(lo3)
+
+L(b01):        lda     n, -4(n)
+       lda     cy1, 0(r31)
+       ble     n, L(end)
+       lda     vp, 24(vp)
+       lda     up, -8(up)
+
+       ALIGN(16)
+L(top):        addq    v0, v0, r6
+       ldq     v1, -16(vp)
+       addq    r6, r3, sl      C combined vlimb
+       ldq     u1, 16(up)
+       ADDSUB  u0, sl, ps      C ulimb + (vlimb << 1)
+       cmplt   v0, r31, r2     C high v bits
+       ADDSUB  ps, cy1, rr     C consume carry from previous operation
+       CARRY(  ps, u0, cy0)    C carry out #2
+       stq     rr, 0(rp)
+       CARRY(  rr, ps, cy)     C carry out #3
+       lda     vp, 32(vp)      C bookkeeping
+       addq    cy, cy0, cy0    C final carry out
+L(lo0):        addq    v1, v1, r7
+       ldq     v0, -40(vp)
+       addq    r7, r2, sl
+       ldq     u0, 24(up)
+       ADDSUB  u1, sl, ps
+       cmplt   v1, r31, r3
+       ADDSUB  ps, cy0, rr
+       CARRY(  ps, u1, cy1)
+       stq     rr, 8(rp)
+       CARRY(  rr, ps, cy)
+       lda     rp, 32(rp)      C bookkeeping
+       addq    cy, cy1, cy1
+L(lo3):        addq    v0, v0, r6
+       ldq     v1, -32(vp)
+       addq    r6, r3, sl
+       ldq     u1, 32(up)
+       ADDSUB  u0, sl, ps
+       cmplt   v0, r31, r2
+       ADDSUB  ps, cy1, rr
+       CARRY(  ps, u0, cy0)
+       stq     rr, -16(rp)
+       CARRY(  rr, ps, cy)
+       lda     up, 32(up)      C bookkeeping
+       addq    cy, cy0, cy0
+L(lo2):        addq    v1, v1, r7
+       ldq     v0, -24(vp)
+       addq    r7, r2, sl
+       ldq     u0, 8(up)
+       ADDSUB  u1, sl, ps
+       cmplt   v1, r31, r3
+       ADDSUB  ps, cy0, rr
+       CARRY(  ps, u1, cy1)
+       stq     rr, -8(rp)
+       CARRY(  rr, ps, cy)
+       lda     n, -4(n)        C bookkeeping
+       addq    cy, cy1, cy1
+       bgt     n, L(top)
+
+L(end):        addq    v0, v0, r6
+       addq    r6, r3, sl
+       ADDSUB  u0, sl, ps
+       cmplt   v0, r31, r2
+       ADDSUB  ps, cy1, rr
+       CARRY(  ps, u0, cy0)
+       stq     rr, 0(rp)
+       CARRY(  rr, ps, cy)
+       addq    cy, cy0, cy0
+       addq    cy0, r2, r0
+
+       ret     r31,(r26),1
+EPILOGUE()
+ASM_END()
index eda092b2d5c6e4d84827bf9498cba55d14024e6a..0e68e6e7adb4ca296449836fe5cc94b9bc59d0f8 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Alpha ev6 mpn_addmul_1 and mpn_submul_1.
 
-dnl  Copyright 2000, 2003, 2004, 2005, 2008 Free Software Foundation, Inc.
+dnl  Copyright 2000, 2003-2005, 2008 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 9932ec1fbd2232422be0238cfcc7b1aa44d8d065..e51d6b0d15947ef4209856cf3005557cc93bddd9 100644 (file)
 /* gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 2005, 2008, 2009,
-2010 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2002, 2004, 2005, 2008-2010, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 #define DIVEXACT_BY3_METHOD 0  /* override ../diveby3.asm */
 
 /* 500 MHz 21164 (agnesi.math.su.se) */
-
-/* Generated by tuneup.c, 2009-11-29, gcc 3.3 */
+/* FFT tuning limit = 20000000 */
+/* Generated by tuneup.c, 2014-03-14, gcc 3.3 */
 
 #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_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        10
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD        17
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD        21
 #define PREINV_MOD_1_TO_MOD_1_THRESHOLD      7
 #define USE_PREINV_DIVREM_1                  1  /* preinv always */
+#define DIV_QR_1N_PI1_METHOD                 2
+#define DIV_QR_1_NORM_THRESHOLD              5
+#define DIV_QR_1_UNNORM_THRESHOLD            1
 #define DIV_QR_2_PI2_THRESHOLD               8
 #define DIVEXACT_1_THRESHOLD                 0  /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD           19
+#define BMOD_1_TO_MOD_1_THRESHOLD           20
 
 #define MUL_TOOM22_THRESHOLD                32
-#define MUL_TOOM33_THRESHOLD               105
-#define MUL_TOOM44_THRESHOLD               166
-#define MUL_TOOM6H_THRESHOLD               232
+#define MUL_TOOM33_THRESHOLD               117
+#define MUL_TOOM44_THRESHOLD               124
+#define MUL_TOOM6H_THRESHOLD               230
 #define MUL_TOOM8H_THRESHOLD               357
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD      96
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     110
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD      93
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD     113
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD     133
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD      97
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD     107
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD      88
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD     105
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     136
 
-#define SQR_BASECASE_THRESHOLD               4
-#define SQR_TOOM2_THRESHOLD                 60
-#define SQR_TOOM3_THRESHOLD                102
-#define SQR_TOOM4_THRESHOLD                155
-#define SQR_TOOM6_THRESHOLD                306
-#define SQR_TOOM8_THRESHOLD                333
+#define SQR_BASECASE_THRESHOLD               0  /* always */
+#define SQR_TOOM2_THRESHOLD                 59
+#define SQR_TOOM3_THRESHOLD                123
+#define SQR_TOOM4_THRESHOLD                163
+#define SQR_TOOM6_THRESHOLD                333
+#define SQR_TOOM8_THRESHOLD                  0  /* always */
 
 #define MULMID_TOOM42_THRESHOLD             52
 
-#define MULMOD_BNM1_THRESHOLD               15
-#define SQRMOD_BNM1_THRESHOLD               23
+#define MULMOD_BNM1_THRESHOLD               19
+#define SQRMOD_BNM1_THRESHOLD                5
 
-#define MUL_FFT_MODF_THRESHOLD             412  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             468  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    480, 5}, {     18, 6}, {     10, 5}, {     21, 6}, \
-    {     11, 5}, {     23, 6}, {     12, 5}, {     25, 6}, \
-    {     19, 7}, {     10, 6}, {     25, 7}, {     13, 6}, \
-    {     27, 7}, {     14, 6}, {     29, 7}, {     25, 8}, \
-    {     13, 7}, {     29, 8}, {     15, 7}, {     32, 8}, \
-    {     17, 7}, {     35, 8}, {     19, 7}, {     39, 8}, \
-    {     29, 9}, {     15, 8}, {     37, 9}, {     19, 8}, \
-    {     41, 9}, {     23, 8}, {     51, 9}, {     27, 8}, \
-    {     55, 9}, {     31, 8}, {     63, 9}, {     35, 8}, \
+  { {    468, 5}, {     19, 6}, {     10, 5}, {     21, 6}, \
+    {     11, 5}, {     23, 6}, {     19, 7}, {     10, 6}, \
+    {     24, 7}, {     13, 6}, {     27, 7}, {     14, 6}, \
+    {     29, 7}, {     17, 6}, {     35, 7}, {     29, 8}, \
+    {     15, 7}, {     32, 8}, {     17, 7}, {     35, 8}, \
+    {     19, 7}, {     39, 8}, {     29, 9}, {     15, 8}, \
+    {     35, 9}, {     19, 8}, {     41, 9}, {     23, 8}, \
+    {     51, 9}, {     27, 8}, {     55, 9}, {     35, 8}, \
     {     71, 9}, {     39,10}, {     23, 9}, {     55,10}, \
-    {     31, 9}, {     67,10}, {     39, 9}, {     83,10}, \
-    {     47, 9}, {     99,10}, {     55,11}, {     31,10}, \
+    {     31, 9}, {     67,10}, {     39, 9}, {     79,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,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,12}, {    159,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,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}, {    543,11}, {   1087,12}, {    575,11}, \
-    {   1151,12}, {    607,13}, {    319,12}, {    671,11}, \
-    {   1343,12}, {    703,13}, {    383,12}, {    831,13}, \
-    {    447,12}, {    927,14}, {    255,13}, {    511,12}, \
-    {   1087,13}, {    575,12}, {   1151,13}, {    639,12}, \
-    {   1279,13}, {    703,12}, {   1407,14}, {    383,13}, \
-    {    767,15}, {    255,14}, {    511,13}, {   1215,14}, \
-    {    639,13}, {   1407,14}, {    767,13}, {   1663,14}, \
-    {    895,13}, {   1791,15}, {  32768,16}, {  65536,17}, \
+    {     95,10}, {    199,11}, {    111,12}, {     63,11}, \
+    {    143,10}, {    287, 9}, {    575,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,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}, {    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}, {    575,11}, {   1151,12}, {    607,13}, \
+    {    319,12}, {    735,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}, {   1343,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}, {   1407,14}, \
+    {    767,13}, {   1663,14}, {    895,13}, {   1855,15}, \
+    {    511,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 151
@@ -111,83 +125,85 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 #define SQR_FFT_MODF_THRESHOLD             412  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    476, 5}, {     19, 6}, {     10, 5}, {     23, 6}, \
-    {     12, 5}, {     25, 6}, {     27, 7}, {     14, 6}, \
-    {     29, 7}, {     28, 8}, {     15, 7}, {     31, 8}, \
-    {     29, 9}, {     15, 8}, {     35, 9}, {     19, 8}, \
-    {     41, 9}, {     23, 8}, {     49, 9}, {     27,10}, \
-    {     15, 9}, {     35, 8}, {     71, 9}, {     39,10}, \
+  { {    412, 5}, {     19, 6}, {     10, 5}, {     21, 6}, \
+    {     11, 5}, {     23, 6}, {     12, 5}, {     25, 6}, \
+    {     27, 7}, {     14, 6}, {     29, 7}, {     28, 8}, \
+    {     15, 7}, {     31, 8}, {     17, 7}, {     36, 8}, \
+    {     19, 7}, {     39, 8}, {     29, 9}, {     15, 8}, \
+    {     35, 9}, {     19, 8}, {     41, 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}, {    103,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}, \
+    {     47,10}, {     95,12}, {     31,11}, {     63,10}, \
+    {    127, 9}, {    255,11}, {     79,10}, {    159, 9}, \
+    {    319,10}, {    167,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, 9}, {    767,13}, {     63,12}, \
+    {    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,11}, {    367,10}, \
-    {    735,12}, {    191,11}, {    383,10}, {    767,11}, \
-    {    415,10}, {    831,11}, {    447,10}, {    895,13}, \
-    {    127,12}, {    255,11}, {    543,12}, {    287,11}, \
-    {    575,10}, {   1151,11}, {    607,12}, {    319,11}, \
-    {    671,12}, {    351,11}, {    735,13}, {    191,12}, \
+    {    671,11}, {    351,10}, {    703,11}, {    367,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}, {    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}, {    575,11}, {   1151,12}, {    607,13}, \
-    {    319,12}, {    735,13}, {    383,12}, {    831,13}, \
-    {    447,12}, {    959,14}, {    255,13}, {    511,12}, \
-    {   1023,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,15}, {    255,14}, {    511,13}, \
-    {   1215,14}, {    639,13}, {   1407,14}, {    767,13}, \
-    {   1663,14}, {    895,13}, {   1791,15}, {  32768,16}, \
-    {  65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
-    {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 152
-#define SQR_FFT_THRESHOLD                 4224
+    {    319,12}, {    703,11}, {   1407,12}, {    735,13}, \
+    {    383,12}, {    831,13}, {    447,12}, {    959,14}, \
+    {    255,13}, {    511,12}, {   1087,13}, {    575,12}, \
+    {   1151,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}, {   1407,14}, \
+    {    767,13}, {   1663,14}, {    895,13}, {   1791,15}, \
+    {    511,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 159
+#define SQR_FFT_THRESHOLD                 5056
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
-#define MULLO_DC_THRESHOLD                 113
-#define MULLO_MUL_N_THRESHOLD            11278
+#define MULLO_DC_THRESHOLD                 100
+#define MULLO_MUL_N_THRESHOLD            11355
 
-#define DC_DIV_QR_THRESHOLD                112
-#define DC_DIVAPPR_Q_THRESHOLD             390
-#define DC_BDIV_QR_THRESHOLD               110
-#define DC_BDIV_Q_THRESHOLD                286
+#define DC_DIV_QR_THRESHOLD                124
+#define DC_DIVAPPR_Q_THRESHOLD             438
+#define DC_BDIV_QR_THRESHOLD               153
+#define DC_BDIV_Q_THRESHOLD                318
 
 #define INV_MULMOD_BNM1_THRESHOLD           62
-#define INV_NEWTON_THRESHOLD               393
-#define INV_APPR_THRESHOLD                 375
+#define INV_NEWTON_THRESHOLD               384
+#define INV_APPR_THRESHOLD                 402
 
-#define BINV_NEWTON_THRESHOLD              390
-#define REDC_1_TO_REDC_N_THRESHOLD         124
+#define BINV_NEWTON_THRESHOLD              381
+#define REDC_1_TO_REDC_N_THRESHOLD         110
 
-#define MU_DIV_QR_THRESHOLD               1652
-#define MU_DIVAPPR_Q_THRESHOLD            1685
-#define MUPI_DIV_QR_THRESHOLD              171
-#define MU_BDIV_QR_THRESHOLD              1470
-#define MU_BDIV_Q_THRESHOLD               1652
+#define MU_DIV_QR_THRESHOLD               1752
+#define MU_DIVAPPR_Q_THRESHOLD            1895
+#define MUPI_DIV_QR_THRESHOLD              174
+#define MU_BDIV_QR_THRESHOLD              1387
+#define MU_BDIV_Q_THRESHOLD               1787
 
-#define POWM_SEC_TABLE  2,23,88,387,961,2578
+#define POWM_SEC_TABLE  1,13,66,82,579
 
 #define MATRIX22_STRASSEN_THRESHOLD         15
-#define HGCD_THRESHOLD                     278
-#define HGCD_APPR_THRESHOLD                357
-#define HGCD_REDUCE_THRESHOLD             2899
-#define GCD_DC_THRESHOLD                  1258
-#define GCDEXT_DC_THRESHOLD                777
+#define HGCD_THRESHOLD                     318
+#define HGCD_APPR_THRESHOLD                363
+#define HGCD_REDUCE_THRESHOLD             2384
+#define GCD_DC_THRESHOLD                  2504
+#define GCDEXT_DC_THRESHOLD                671
 #define JACOBI_BASE_METHOD                   3
 
-#define GET_STR_DC_THRESHOLD                15
-#define GET_STR_PRECOMPUTE_THRESHOLD        24
-#define SET_STR_DC_THRESHOLD              3866
-#define SET_STR_PRECOMPUTE_THRESHOLD      7708
+#define GET_STR_DC_THRESHOLD                14
+#define GET_STR_PRECOMPUTE_THRESHOLD        25
+#define SET_STR_DC_THRESHOLD              3754
+#define SET_STR_PRECOMPUTE_THRESHOLD      8097
 
-#define FAC_DSC_THRESHOLD                 1025
+#define FAC_DSC_THRESHOLD                  951
 #define FAC_ODD_THRESHOLD                   24
index d833af5cb61655f67a7f49d5eea3f26af3fc897f..836de07c0fc4245d82231e08c51c164e13c98fd9 100644 (file)
@@ -5,19 +5,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund.
 dnl  Copyright 2009, 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d3f138d696123ee090030893dbd0dbd0604e5273..8ee19cd429d00a12ebf2e37e17f707dd7339d59e 100644 (file)
@@ -4,19 +4,30 @@ dnl  result in a second limb vector.
 dnl  Copyright 2000, 2001, 2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 8b3b357a7798e92842ea05eed20f017ddbbfcc52..b214ac50adbe417289245672f52a3f60cb64e4a6 100644 (file)
@@ -2,18 +2,29 @@ Copyright 2002, 2005 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 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.
+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 Lesser General Public License
+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 a copy of the GNU Lesser General Public License along
-with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index 060e78d10e0e6eeafa26932f9d8ddf2044e5d827..711d4e66e5a7457ae82386c9e95fbc1f9fff3d65 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Alpha ev6 nails mpn_addmul_1.
 
 dnl  Copyright 2002, 2005, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 9edaed8b3a5c447346e206d086cbeb0c28008372..6ff6b3ad6b091ce5b4bcaabbf22981f107c19f57 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Alpha ev6 nails mpn_addmul_2.
 
 dnl  Copyright 2002, 2005, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 1d89769e1300a39844d628eb9ce67d3b0e482567..a1ffb680eca64bc3fb5a77f86a79843ee1cff604 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Alpha ev6 nails mpn_addmul_3.
 
 dnl  Copyright 2002, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index f19b0232dfda325d6b0baef2e6290fd371c44877..77e02a4316f4990aee883ea4e3cfcb365135a2db 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Alpha ev6 nails mpn_addmul_4.
 
 dnl  Copyright 2002, 2005, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 4958e81ed97baefbf91f561b25a53e6ae05026d9..f6586773f573596412003b3d767071604f747e3b 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Alpha ev6 nails mpn_add_n and mpn_sub_n.
 
 dnl  Copyright 2002, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  Runs at 2.5 cycles/limb.  It would be possible to reach 2.0 cycles/limb
index 9911ea214cac197e4cf56a4f48e710f9b489fcbc..7949fe8df89474acd1c6674dbf2920ee65a10559 100644 (file)
@@ -1,25 +1,35 @@
 /* gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 /* Generated by tuneup.c, 2004-02-07, gcc 3.3 */
 
index 8e2330a8c9e9800fb72105064ca00e4897c1b7b3..da2ee3d09978d209aa4c460c98b1039ec86e2eef 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Alpha ev6 nails mpn_mul_1.
 
 dnl  Copyright 2002, 2005, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 7dd7b23b84c9bc98168680ebd3b53a4b3a4953ae..f473a59ba824bdb67715e87f2061345047e76659 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Alpha ev6 nails mpn_submul_1.
 
 dnl  Copyright 2002, 2005, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 563627d0125773c41115289d0cfae119c7ca6002..a4c8a36882d85ab5553f202d55ed315722fd1534 100755 (executable)
@@ -1,21 +1,32 @@
 #!/usr/bin/perl -w
 
-# Copyright 2000, 2001, 2003, 2004, 2005, 2011 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2003-2005, 2011 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 # Usage: slot.pl [filename.o]...
diff --git a/mpn/alpha/ev6/sqr_diagonal.asm b/mpn/alpha/ev6/sqr_diagonal.asm
deleted file mode 100644 (file)
index 58d086e..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-dnl  Alpha mpn_sqr_diagonal.
-
-dnl  Copyright 2001, 2002, 2006 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 EV4:      ?
-C EV5:      ?
-C EV6:      2.3
-
-C  INPUT PARAMETERS
-C  rp  r16
-C  up  r17
-C  n   r18
-
-
-ASM_START()
-PROLOGUE(mpn_sqr_diagonal)
-       lda     r18, -2(r18)    C n -= 2
-       ldq     r0,   0(r17)
-       mulq    r0, r0, r4
-       umulh   r0, r0, r20
-       blt     r18, L(ex1)
-       ldq     r1,   8(r17)
-       mulq    r1, r1, r5
-       umulh   r1, r1, r21
-       beq     r18, L(ex2)
-       lda     r18, -2(r18)    C n -= 2
-       ldq     r0,  16(r17)
-       blt     r18, L(ex3)
-       ldq     r1,  24(r17)
-       beq     r18, L(ex4)
-
-       ALIGN(16)
-L(top):        lda     r18, -2(r18)    C n -= 2
-       stq     r4,   0(r16)
-       mulq    r0, r0, r4
-       stq     r20,  8(r16)
-       umulh   r0, r0, r20
-       ldq     r0,  32(r17)
-       blt     r18, L(x)
-       stq     r5,  16(r16)
-       mulq    r1, r1, r5
-       stq     r21, 24(r16)
-       umulh   r1, r1, r21
-       ldq     r1,  40(r17)
-       lda     r16, 32(r16)    C rp += 4
-       lda     r17, 16(r17)    C up += 2
-       bne     r18, L(top)
-
-       ALIGN(16)
-L(ex4):        stq     r4,   0(r16)
-       mulq    r0, r0, r4
-       stq     r20,  8(r16)
-       umulh   r0, r0, r20
-       stq     r5,  16(r16)
-       mulq    r1, r1, r5
-       stq     r21, 24(r16)
-       umulh   r1, r1, r21
-       stq     r4,  32(r16)
-       stq     r20, 40(r16)
-       stq     r5,  48(r16)
-       stq     r21, 56(r16)
-       ret     r31, (r26), 1
-       ALIGN(16)
-L(x):  stq     r5,  16(r16)
-       mulq    r1, r1, r5
-       stq     r21, 24(r16)
-       umulh   r1, r1, r21
-       stq     r4,  32(r16)
-       mulq    r0, r0, r4
-       stq     r20, 40(r16)
-       umulh   r0, r0, r20
-       stq     r5,  48(r16)
-       stq     r21, 56(r16)
-       stq     r4,  64(r16)
-       stq     r20, 72(r16)
-       ret     r31, (r26), 1
-L(ex1):        stq     r4,   0(r16)
-       stq     r20,  8(r16)
-       ret     r31, (r26), 1
-       ALIGN(16)
-L(ex2):        stq     r4,   0(r16)
-       stq     r20,  8(r16)
-       stq     r5,  16(r16)
-       stq     r21, 24(r16)
-       ret     r31, (r26), 1
-       ALIGN(16)
-L(ex3):        stq     r4,   0(r16)
-       mulq    r0, r0, r4
-       stq     r20,  8(r16)
-       umulh   r0, r0, r20
-       stq     r5,  16(r16)
-       stq     r21, 24(r16)
-       stq     r4,  32(r16)
-       stq     r20, 40(r16)
-       ret     r31, (r26), 1
-EPILOGUE()
-ASM_END()
index f23ad44a15a7619e691526b503199a9eb2bdd306..a35ba40d347c8953f1a2ce8f2223f936ebe13d21 100644 (file)
@@ -4,19 +4,30 @@ dnl  and store difference in a third limb vector.
 dnl  Copyright 2000, 2003, 2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 2e6f0a5e225d9daedbd71c625845543987d556b9..55fa7d3673112671a6bdc81faf19da25237affc3 100644 (file)
@@ -4,18 +4,29 @@ dnl  Copyright 2003, 2004 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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 MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or
+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')
 
index a72d95e90bef0149eede6354f99e716e5100460c..4b13e9f14f94c047f949f367be3f3cf062edcc94 100644 (file)
@@ -4,18 +4,29 @@ dnl  Copyright 2003, 2005 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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 MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or
+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')
 
index 6ed79cf1586bd9dc198729f3fb5304ded0d8d9c4..049c1cd2393896a55d2c30990e72461f8a8efc27 100644 (file)
@@ -4,18 +4,29 @@ dnl  Copyright 2003, 2005 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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 MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or
+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')
 
index ddd9f9161071e74ec14f6e6911e4d4ddf75d8342..b850bd24b5f6ed2eeb1d16243eb09dff84ebfe3a 100644 (file)
@@ -1,25 +1,36 @@
 /* Alpha EV4 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 2005, 2009
-Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2002, 2004, 2005, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 
 /* 175MHz 21064 */
index 3f188ca7e9cf2f5cfb4334964bd3c1c08d396ea8..afc010f58c57a0edbb781697a1ac2a961955c274 100644 (file)
@@ -1,22 +1,32 @@
 dnl  Alpha mpn_invert_limb -- Invert a normalized limb.
 
-dnl  Copyright 1996, 2000, 2001, 2002, 2003, 2007, 2011 Free Software
-dnl  Foundation, Inc.
-dnl
+dnl  Copyright 1996, 2000-2003, 2007, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
@@ -37,11 +47,10 @@ PROLOGUE(mpn_invert_limb,gp)
        bic     r1, 1, r7
        lda     r4, 1(r4)
        srl     r16, 1, r3
-ifdef(`BWX',`
        addq    r7, r2, r1
+ifelse(bwx_available_p,1,`
        ldwu    r0, -512(r1)
 ',`
-       addq    r1, r2, r1
        ldq_u   r0, -512(r1)
        extwl   r0, r7, r0
 ')
@@ -76,38 +85,11 @@ ifdef(`BWX',`
        subq    r0, r3, r0
        ret     r31, (r26), 1
 EPILOGUE()
-DATASTART(approx_tab)
-        .word   0x7fd,0x7f5,0x7ed,0x7e5,0x7dd,0x7d5,0x7ce,0x7c6
-        .word   0x7bf,0x7b7,0x7b0,0x7a8,0x7a1,0x79a,0x792,0x78b
-        .word   0x784,0x77d,0x776,0x76f,0x768,0x761,0x75b,0x754
-        .word   0x74d,0x747,0x740,0x739,0x733,0x72c,0x726,0x720
-        .word   0x719,0x713,0x70d,0x707,0x700,0x6fa,0x6f4,0x6ee
-        .word   0x6e8,0x6e2,0x6dc,0x6d6,0x6d1,0x6cb,0x6c5,0x6bf
-        .word   0x6ba,0x6b4,0x6ae,0x6a9,0x6a3,0x69e,0x698,0x693
-        .word   0x68d,0x688,0x683,0x67d,0x678,0x673,0x66e,0x669
-        .word   0x664,0x65e,0x659,0x654,0x64f,0x64a,0x645,0x640
-        .word   0x63c,0x637,0x632,0x62d,0x628,0x624,0x61f,0x61a
-        .word   0x616,0x611,0x60c,0x608,0x603,0x5ff,0x5fa,0x5f6
-        .word   0x5f1,0x5ed,0x5e9,0x5e4,0x5e0,0x5dc,0x5d7,0x5d3
-        .word   0x5cf,0x5cb,0x5c6,0x5c2,0x5be,0x5ba,0x5b6,0x5b2
-        .word   0x5ae,0x5aa,0x5a6,0x5a2,0x59e,0x59a,0x596,0x592
-        .word   0x58e,0x58a,0x586,0x583,0x57f,0x57b,0x577,0x574
-        .word   0x570,0x56c,0x568,0x565,0x561,0x55e,0x55a,0x556
-        .word   0x553,0x54f,0x54c,0x548,0x545,0x541,0x53e,0x53a
-        .word   0x537,0x534,0x530,0x52d,0x52a,0x526,0x523,0x520
-        .word   0x51c,0x519,0x516,0x513,0x50f,0x50c,0x509,0x506
-        .word   0x503,0x500,0x4fc,0x4f9,0x4f6,0x4f3,0x4f0,0x4ed
-        .word   0x4ea,0x4e7,0x4e4,0x4e1,0x4de,0x4db,0x4d8,0x4d5
-        .word   0x4d2,0x4cf,0x4cc,0x4ca,0x4c7,0x4c4,0x4c1,0x4be
-        .word   0x4bb,0x4b9,0x4b6,0x4b3,0x4b0,0x4ad,0x4ab,0x4a8
-        .word   0x4a5,0x4a3,0x4a0,0x49d,0x49b,0x498,0x495,0x493
-        .word   0x490,0x48d,0x48b,0x488,0x486,0x483,0x481,0x47e
-        .word   0x47c,0x479,0x477,0x474,0x472,0x46f,0x46d,0x46a
-        .word   0x468,0x465,0x463,0x461,0x45e,0x45c,0x459,0x457
-        .word   0x455,0x452,0x450,0x44e,0x44b,0x449,0x447,0x444
-        .word   0x442,0x440,0x43e,0x43b,0x439,0x437,0x435,0x432
-        .word   0x430,0x42e,0x42c,0x42a,0x428,0x425,0x423,0x421
-        .word   0x41f,0x41d,0x41b,0x419,0x417,0x414,0x412,0x410
-        .word   0x40e,0x40c,0x40a,0x408,0x406,0x404,0x402,0x400
+DATASTART(approx_tab,8)
+forloop(i,256,512-1,dnl
+`      .word   eval(0x7fd00/i)
+')dnl
+       SIZE(approx_tab, 512)
+       TYPE(approx_tab, object)
 DATAEND()
 ASM_END()
index bc0e03dc4cc4e6485a7251deb86ac8fe06fef2a9..c62a856aea3335bd8d67de9fc3f27dbc2a4cd994 100644 (file)
@@ -3,19 +3,30 @@ dnl  Alpha mpn_lshift -- Shift a number left.
 dnl  Copyright 1994, 1995, 2000, 2003, 2009 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index e5c1d221f9fcd696a3cc91553a4ddc5f181a5280..1b03b637d8d5b035a96203cd9e50d8c3ca24f878 100644 (file)
@@ -3,19 +3,30 @@ dnl Alpha mpn_mod_34lsub1.
 dnl  Copyright 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 0611cd8acb89f73f35197a52d8abdedfd995549c..96dccc73ee0587e870b0eaf214834dc4b39da77a 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Alpha mpn_modexact_1c_odd -- mpn exact remainder
 
 dnl  Copyright 2003, 2004 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 30b17021ba0cf14839ca2ea4a39b0fcdcf9dd65c..a7cdbcf8ebc1a8404b13976ea68a5d0c9577176f 100644 (file)
@@ -4,19 +4,30 @@ dnl  the result in a second limb vector.
 dnl  Copyright 1992, 1994, 1995, 2000, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index ae0b4b5ebfc2915b1751fd3cf212f349fff2ed72..6e1e21455894351ae2722ec9b59da68dc7f08f4b 100644 (file)
@@ -3,19 +3,30 @@ dnl  Alpha mpn_rshift -- Shift a number right.
 dnl  Copyright 1994, 1995, 2000, 2009 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/alpha/sec_tabselect.asm b/mpn/alpha/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..679b169
--- /dev/null
@@ -0,0 +1,137 @@
+dnl  Alpha mpn_sec_tabselect.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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')
+
+C      cycles/limb
+C EV4:      ?
+C EV5:      2.25
+C EV6:      1.64
+
+define(`rp',     `r16')
+define(`tp',     `r17')
+define(`n',      `r18')
+define(`nents',  `r19')
+define(`which',  `r20')
+
+define(`i',      `r21')
+define(`j',      `r22')
+define(`stride', `r23')
+define(`mask',   `r24')
+define(`k',      `r25')
+
+
+ASM_START()
+PROLOGUE(mpn_sec_tabselect)
+       subq    n, 4, j                 C outer loop induction variable
+
+       blt     j, L(outer_end)
+L(outer_top):
+       mov     tp, r8
+       lda     r0, 0(r31)
+       lda     r1, 0(r31)
+       lda     r2, 0(r31)
+       lda     r3, 0(r31)
+       subq    j, 4, j                 C outer loop induction variable
+       subq    nents, which, k
+       mov     nents, i
+
+       ALIGN(16)
+L(top):        ldq     r4, 0(tp)
+       ldq     r5, 8(tp)
+       cmpeq   k, i, mask
+       subq    i, 1, i
+       subq    r31, mask, mask
+       ldq     r6, 16(tp)
+       ldq     r7, 24(tp)
+       and     r4, mask, r4
+       and     r5, mask, r5
+       or      r0, r4, r0
+       or      r1, r5, r1
+       and     r6, mask, r6
+       and     r7, mask, r7
+       or      r2, r6, r2
+       or      r3, r7, r3
+       s8addq  n, tp, tp
+       bne     i, L(top)
+
+       stq     r0, 0(rp)
+       stq     r1, 8(rp)
+       stq     r2, 16(rp)
+       stq     r3, 24(rp)
+       addq    r8, 32, tp
+       addq    rp, 32, rp
+       bge     j, L(outer_top)
+L(outer_end):
+
+       and     n, 2, r0
+       beq     r0, L(b0x)
+L(b1x):        mov     tp, r8
+       lda     r0, 0(r31)
+       lda     r1, 0(r31)
+       subq    nents, which, k
+       mov     nents, i
+       ALIGN(16)
+L(tp2):        ldq     r4, 0(tp)
+       ldq     r5, 8(tp)
+       cmpeq   k, i, mask
+       subq    i, 1, i
+       subq    r31, mask, mask
+       and     r4, mask, r4
+       and     r5, mask, r5
+       or      r0, r4, r0
+       or      r1, r5, r1
+       s8addq  n, tp, tp
+       bne     i, L(tp2)
+       stq     r0, 0(rp)
+       stq     r1, 8(rp)
+       addq    r8, 16, tp
+       addq    rp, 16, rp
+
+L(b0x):        and     n, 1, r0
+       beq     r0, L(b00)
+L(b01):        lda     r0, 0(r31)
+       subq    nents, which, k
+       mov     nents, i
+       ALIGN(16)
+L(tp1):        ldq     r4, 0(tp)
+       cmpeq   k, i, mask
+       subq    i, 1, i
+       subq    r31, mask, mask
+       and     r4, mask, r4
+       or      r0, r4, r0
+       s8addq  n, tp, tp
+       bne     i, L(tp1)
+       stq     r0, 0(rp)
+
+L(b00):        ret     r31, (r26), 1
+EPILOGUE()
diff --git a/mpn/alpha/sqr_diag_addlsh1.asm b/mpn/alpha/sqr_diag_addlsh1.asm
new file mode 100644 (file)
index 0000000..ee219ef
--- /dev/null
@@ -0,0 +1,93 @@
+dnl  Alpha mpn_sqr_diag_addlsh1.
+
+dnl  Copyright 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 EV4:      ?
+C EV5:     10.2
+C EV6:      4.5
+
+C Ideally, one-way code could run at 9 c/l (limited by mulq+umulh) on ev5 and
+C about 3.75 c/l on ev6.  Two-way code could run at about 3.25 c/l on ev6.
+
+C Algorithm: We allow ourselves to propagate carry to a product high word
+C without worrying for carry out, since (B-1)^2 = B^2-2B+1 has a high word of
+C B-2, i.e, will not spill.  We propagate carry similarly to a product low word
+C since the problem value B-1 is a quadratic non-residue mod B, but our
+C products are squares.
+
+define(`rp',   `r16')
+define(`tp',   `r17')
+define(`up',   `r18')
+define(`n',    `r19')
+
+ASM_START()
+PROLOGUE(mpn_sqr_diag_addlsh1)
+       ldq     r0, 0(up)
+       bis     r31, r31, r21
+       bis     r31, r31, r3
+       mulq    r0, r0, r7
+       stq     r7, 0(rp)
+       umulh   r0, r0, r6
+       lda     n, -1(n)
+
+       ALIGN(16)
+L(top):        ldq     r0, 8(up)
+       lda     up, 8(up)
+       ldq     r8, 0(tp)
+       ldq     r20, 8(tp)
+       mulq    r0, r0, r7
+       lda     tp, 16(tp)
+       sll     r8, 1, r23
+       srl     r8, 63, r22
+       or      r21, r23, r23
+       sll     r20, 1, r24
+       addq    r3, r6, r6              C cannot carry per comment above
+       or      r22, r24, r24
+       addq    r23, r6, r21
+       umulh   r0, r0, r6
+       cmpult  r21, r23, r1
+       addq    r1, r7, r7              C cannot carry per comment above
+       stq     r21, 8(rp)
+       addq    r24, r7, r22
+       stq     r22, 16(rp)
+       lda     n, -1(n)
+       cmpult  r22, r7, r3
+       srl     r20, 63, r21
+       lda     rp, 16(rp)
+       bne     n, L(top)
+
+       addq    r3, r6, r6              C cannot carry per comment above
+       addq    r21, r6, r21
+       stq     r21, 8(rp)
+       ret     r31, (r26), 1
+EPILOGUE()
+ASM_END()
diff --git a/mpn/alpha/sqr_diagonal.asm b/mpn/alpha/sqr_diagonal.asm
deleted file mode 100644 (file)
index 2aa7f2e..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-dnl  Alpha mpn_sqr_diagonal.
-
-dnl  Copyright 2001, 2002 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 EV4:     42
-C EV5:     18
-C EV6:      3.45
-
-C  INPUT PARAMETERS
-C  rp  r16
-C  up  r17
-C  n   r18
-
-
-ASM_START()
-PROLOGUE(mpn_sqr_diagonal)
-       ldq     r2,0(r17)       C r2 = s1_limb
-       lda     r18,-2(r18)     C size -= 2
-       mulq    r2,r2,r3        C r3 = prod_low
-       umulh   r2,r2,r4        C r4 = prod_high
-       blt     r18,$Lend1      C jump if size was == 1
-       ldq     r2,8(r17)       C r2 = s1_limb
-       beq     r18,$Lend2      C jump if size was == 2
-
-       ALIGN(8)
-$Loop: stq     r3,0(r16)
-       mulq    r2,r2,r3        C r3 = prod_low
-       lda     r18,-1(r18)     C size--
-       stq     r4,8(r16)
-       umulh   r2,r2,r4        C r4 = cy_limb
-       ldq     r2,16(r17)      C r2 = s1_limb
-       lda     r17,8(r17)      C s1_ptr++
-       lda     r16,16(r16)     C res_ptr++
-       bne     r18,$Loop
-
-$Lend2:        stq     r3,0(r16)
-       mulq    r2,r2,r3        C r3 = prod_low
-       stq     r4,8(r16)
-       umulh   r2,r2,r4        C r4 = cy_limb
-       stq     r3,16(r16)
-       stq     r4,24(r16)
-       ret     r31,(r26),1
-$Lend1:        stq     r3,0(r16)
-       stq     r4,8(r16)
-       ret     r31,(r26),1
-EPILOGUE(mpn_sqr_diagonal)
-ASM_END()
index 690e07cf2c58fe3c7dbbdaa23fef03d812dec6f0..1bb72263f855c04310ba1dbac70aa4c9270dfd7c 100644 (file)
@@ -4,19 +4,30 @@ dnl  and store difference in a third limb vector.
 dnl  Copyright 1995, 1999, 2000, 2005, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 554ccf51b66b4d709b1e25a8c9c915a96a670446..2b63b52fa40dedb27d499f8b90c55f7b67496bc2 100644 (file)
@@ -4,19 +4,30 @@ dnl  the result from a second limb vector.
 dnl  Copyright 1992, 1994, 1995, 2000, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 7fa3f008f16f54385023882c483a5abd658543a1..039081ed482d55e0db2229bcc8d92f31a4f1a732 100644 (file)
@@ -3,19 +3,30 @@ dnl  mpn_umul_ppmm -- 1x1->2 limb multiplication
 dnl  Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index f1f41c18e4cbea2d665d825188ef53cce3ba2735..e05cf5cca6669e2dc7cdce3c1762c4032a35fbdc 100644 (file)
@@ -3,22 +3,33 @@ divert(-1)
 dnl  m4 macros for alpha assembler on unicos.
 
 
-dnl  Copyright 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000, 2002-2004, 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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 MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or both in parallel, as here.
+dnl
+dnl  The GNU MP Library is distributed in the hope that it will be useful, but
+dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  Note that none of the standard GMP_ASM_ autoconf tests are done for
@@ -75,8 +86,9 @@ m4_assert_numargs(1)
 `      .extern $1')
 
 define(`DATASTART',
-m4_assert_numargs(1)
+m4_assert_numargs_range(1,2)
 `      .psect  $1@crud,data
+       ALIGN(ifelse($#,1,2,$2))
 $1:')
 
 define(`DATAEND',
index ad9545c0d6f4f7975c378c4a2e345d0fb35f04ab..598baa3f2e36ec5ae7569e82769fe4fa45aa376f 100644 (file)
@@ -2,18 +2,29 @@ Copyright 2002, 2012 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 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.
+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 Lesser General Public License
+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 a copy of the GNU Lesser General Public License along
-with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index 46e85411c926ee552e7ddc58159359da1f6c835c..fdad9f7ba68b556d5d68d75e633b49c42f9e3cd9 100644 (file)
@@ -5,25 +5,37 @@ dnl  Contributed to the GNU project by Robert Harley.
 dnl  Copyright 1997, 2000, 2001, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM     ?
 C XScale        ?
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9     2.5    slightly fluctuating
 C Cortex-A15    2.25
diff --git a/mpn/arm/aorscnd_n.asm b/mpn/arm/aorscnd_n.asm
deleted file mode 100644 (file)
index cfc2502..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-dnl  ARM mpn_addcnd_n, mpn_subcnd_n
-
-dnl  Copyright 2012 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 StrongARM     ?
-C XScale        ?
-C Cortex-A8     ?
-C Cortex-A9     2.5    slightly fluctuating
-C Cortex-A15    ?
-
-define(`rp',   `r0')
-define(`up',   `r1')
-define(`vp',   `r2')
-define(`n',    `r3')
-
-define(`cnd',  `r12')
-
-ifdef(`OPERATION_addcnd_n', `
-       define(`ADDSUB',      adds)
-       define(`ADDSUBC',      adcs)
-       define(`INITCY',      `cmn      r0, #0')
-       define(`RETVAL',      `adc      r0, n, #0')
-       define(func,          mpn_addcnd_n)')
-ifdef(`OPERATION_subcnd_n', `
-       define(`ADDSUB',      subs)
-       define(`ADDSUBC',      sbcs)
-       define(`INITCY',      `cmp      r0, #0')
-       define(`RETVAL',      `adc      r0, n, #0
-                             rsb       r0, r0, #1')
-       define(func,          mpn_subcnd_n)')
-
-MULFUNC_PROLOGUE(mpn_addcnd_n mpn_subcnd_n)
-
-ASM_START()
-PROLOGUE(func)
-       push    {r4-r11}
-       ldr     cnd, [sp, #32]
-
-       INITCY                          C really only needed for n = 0 (mod 4)
-
-       teq     cnd, #0                 C could use this for clearing/setting cy
-       mvnne   cnd, #0                 C conditionally set to 0xffffffff
-
-       ands    r4, n, #3
-       beq     L(top)
-       cmp     r4, #2
-       bcc     L(b1)
-       beq     L(b2)
-
-L(b3): ldm     vp!, {r4,r5,r6}
-       ldm     up!, {r8,r9,r10}
-       and     r4, r4, cnd
-       and     r5, r5, cnd
-       and     r6, r6, cnd
-       ADDSUB  r8, r8, r4
-       ADDSUBC r9, r9, r5
-       ADDSUBC r10, r10, r6
-       stm     rp!, {r8,r9,r10}
-       sub     n, n, #3
-       teq     n, #0
-       bne     L(top)
-       b       L(end)
-
-L(b2): ldm     vp!, {r4,r5}
-       ldm     up!, {r8,r9}
-       and     r4, r4, cnd
-       and     r5, r5, cnd
-       ADDSUB  r8, r8, r4
-       ADDSUBC r9, r9, r5
-       stm     rp!, {r8,r9}
-       sub     n, n, #2
-       teq     n, #0
-       bne     L(top)
-       b       L(end)
-
-L(b1): ldr     r4, [vp], #4
-       ldr     r8, [up], #4
-       and     r4, r4, cnd
-       ADDSUB  r8, r8, r4
-       str     r8, [rp], #4
-       sub     n, n, #1
-       teq     n, #0
-       beq     L(end)
-
-L(top):        ldm     vp!, {r4,r5,r6,r7}
-       ldm     up!, {r8,r9,r10,r11}
-       and     r4, r4, cnd
-       and     r5, r5, cnd
-       and     r6, r6, cnd
-       and     r7, r7, cnd
-       ADDSUBC r8, r8, r4
-       ADDSUBC r9, r9, r5
-       ADDSUBC r10, r10, r6
-       ADDSUBC r11, r11, r7
-       sub     n, n, #4
-       stm     rp!, {r8,r9,r10,r11}
-       teq     n, #0
-       bne     L(top)
-
-L(end):        RETVAL
-       pop     {r4-r11}
-       bx      r14
-EPILOGUE()
index 5aaabb35bd189eaf9625beae9f9b8c6969854516..1cbd4ba1af4667f8fdf03f78c85776c3961f1622 100644 (file)
@@ -1,23 +1,34 @@
 dnl  ARM mpn_addlsh1_n and mpn_sublsh1_n
 
-dnl  Contributed to the GNU project by Torbjorn Granlund.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -25,6 +36,7 @@ C           addlsh1_n       sublsh1_n
 C           cycles/limb     cycles/limb
 C StrongARM     ?               ?
 C XScale        ?               ?
+C Cortex-A7     ?               ?
 C Cortex-A8     ?               ?
 C Cortex-A9     3.12            3.7
 C Cortex-A15    ?               ?
index 4668585c97137768cbada7c55c0af57f8452f6ce..b02fbb3b2a0b938e5a335c251ec5d41581dc636b 100644 (file)
@@ -3,25 +3,37 @@ dnl  ARM mpn_addmul_1 and mpn_submul_1.
 dnl  Copyright 1998, 2000, 2001, 2003, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM:     ?
 C XScale        ?
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9     5.25
 C Cortex-A15    4
index 95370d54a6213d75ffcc7fac9aa7dd7b95c6285b..6ca964a2459a7c459bed0a2347616285df77ea92 100644 (file)
@@ -3,21 +3,32 @@ divert(-1)
 dnl  m4 macros for ARM assembler.
 
 dnl  Copyright 2001, 2012, 2013 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  Standard commenting is with @, the default m4 # is for constants and we
index 6ce9802d9de65f00432effa83f87fea3bd09e45f..ec3de50e8e2170d61cade58f2071af66f37d5e05 100644 (file)
@@ -3,25 +3,37 @@ dnl  ARM mpn_bdiv_dbm1c.
 dnl  Copyright 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM     ?
 C XScale        ?
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9     4.25
 C Cortex-A15    2.5
diff --git a/mpn/arm/cnd_aors_n.asm b/mpn/arm/cnd_aors_n.asm
new file mode 100644 (file)
index 0000000..e8eb609
--- /dev/null
@@ -0,0 +1,134 @@
+dnl  ARM mpn_cnd_add_n, mpn_cnd_sub_n
+
+dnl  Copyright 2012, 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 StrongARM     ?
+C XScale        ?
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9     3
+C Cortex-A15    2.5
+
+define(`cnd',  `r0')
+define(`rp',   `r1')
+define(`up',   `r2')
+define(`vp',   `r3')
+
+define(`n',    `r12')
+
+
+ifdef(`OPERATION_cnd_add_n', `
+       define(`ADDSUB',      adds)
+       define(`ADDSUBC',      adcs)
+       define(`INITCY',      `cmn      r0, #0')
+       define(`RETVAL',      `adc      r0, n, #0')
+       define(func,          mpn_cnd_add_n)')
+ifdef(`OPERATION_cnd_sub_n', `
+       define(`ADDSUB',      subs)
+       define(`ADDSUBC',      sbcs)
+       define(`INITCY',      `cmp      r0, #0')
+       define(`RETVAL',      `adc      r0, n, #0
+                             rsb       r0, r0, #1')
+       define(func,          mpn_cnd_sub_n)')
+
+MULFUNC_PROLOGUE(mpn_cnd_add_n mpn_cnd_sub_n)
+
+ASM_START()
+PROLOGUE(func)
+       push    {r4-r11}
+       ldr     n, [sp, #32]
+
+       cmp     cnd, #1
+       sbc     cnd, cnd, cnd           C conditionally set to 0xffffffff
+
+       INITCY                          C really only needed for n = 0 (mod 4)
+
+       ands    r4, n, #3
+       beq     L(top)
+       cmp     r4, #2
+       bcc     L(b1)
+       beq     L(b2)
+
+L(b3): ldm     vp!, {r4,r5,r6}
+       ldm     up!, {r8,r9,r10}
+       bic     r4, r4, cnd
+       bic     r5, r5, cnd
+       bic     r6, r6, cnd
+       ADDSUB  r8, r8, r4
+       ADDSUBC r9, r9, r5
+       ADDSUBC r10, r10, r6
+       stm     rp!, {r8,r9,r10}
+       sub     n, n, #3
+       teq     n, #0
+       bne     L(top)
+       b       L(end)
+
+L(b2): ldm     vp!, {r4,r5}
+       ldm     up!, {r8,r9}
+       bic     r4, r4, cnd
+       bic     r5, r5, cnd
+       ADDSUB  r8, r8, r4
+       ADDSUBC r9, r9, r5
+       stm     rp!, {r8,r9}
+       sub     n, n, #2
+       teq     n, #0
+       bne     L(top)
+       b       L(end)
+
+L(b1): ldr     r4, [vp], #4
+       ldr     r8, [up], #4
+       bic     r4, r4, cnd
+       ADDSUB  r8, r8, r4
+       str     r8, [rp], #4
+       sub     n, n, #1
+       teq     n, #0
+       beq     L(end)
+
+L(top):        ldm     vp!, {r4,r5,r6,r7}
+       ldm     up!, {r8,r9,r10,r11}
+       bic     r4, r4, cnd
+       bic     r5, r5, cnd
+       bic     r6, r6, cnd
+       bic     r7, r7, cnd
+       ADDSUBC r8, r8, r4
+       ADDSUBC r9, r9, r5
+       ADDSUBC r10, r10, r6
+       ADDSUBC r11, r11, r7
+       sub     n, n, #4
+       stm     rp!, {r8,r9,r10,r11}
+       teq     n, #0
+       bne     L(top)
+
+L(end):        RETVAL
+       pop     {r4-r11}
+       bx      r14
+EPILOGUE()
index 437b9f47de27aed179e8e5bc23e63532fcb59be1..42f8e3cbbe3d780c3b637e1b5e4f6a3f3e3335bd 100644 (file)
@@ -3,28 +3,40 @@ dnl  ARM mpn_com.
 dnl  Copyright 2003, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM     ?
 C XScale        ?
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9     2.0
-C Cortex-A15    ?
+C Cortex-A15    1.75
 
 define(`rp', `r0')
 define(`up', `r1')
index 50e8c4e1bb7b8641027a8d25ac78701396e448b9..3ea2035099d43ecf5ab8c56e30efb8fa379d25b2 100644 (file)
@@ -1,30 +1,48 @@
 dnl  ARM mpn_copyd.
 
-dnl  Copyright 2003, 2012 Free Software Foundation, Inc.
+dnl  Contributed to the GNU project by Robert Harley and Torbjörn Granlund.
 
-dnl  This file is part of the GNU MP Library.
+dnl  Copyright 2003, 2012, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM     ?
 C XScale        ?
+C Cortex-A7     ?
 C Cortex-A8     ?
-C Cortex-A9     1.5
-C Cortex-A15    ?
+C Cortex-A9     1.25-1.5
+C Cortex-A15    1.25
+
+C TODO
+C  * Consider wider unrolling.  Analogous 8-way code runs 10% faster on both A9
+C    and A15.  But it probably slows things down for 8 <= n < a few dozen.
 
 define(`rp', `r0')
 define(`up', `r1')
@@ -34,8 +52,8 @@ ASM_START()
 PROLOGUE(mpn_copyd)
        mov     r12, n, lsl #2
        sub     r12, r12, #4
-       add     rp, rp, r12                     C make rp point at last limb
-       add     up, up, r12                     C make up point at last limb
+       add     rp, rp, r12
+       add     up, up, r12
 
        tst     n, #1
        beq     L(skip1)
@@ -44,18 +62,23 @@ PROLOGUE(mpn_copyd)
 L(skip1):
        tst     n, #2
        beq     L(skip2)
-       ldmda   up!, { r3, r12 }                C load 2 limbs
-       stmda   rp!, { r3, r12 }                C store 2 limbs
+       ldmda   up!, { r3,r12 }
+       stmda   rp!, { r3,r12 }
 L(skip2):
        bics    n, n, #3
        beq     L(rtn)
-       stmfd   sp!, { r7, r8, r9 }             C save regs on stack
 
-L(top):        ldmda   up!, { r3, r8, r9, r12 }        C load 4 limbs
+       push    { r4-r5 }
        subs    n, n, #4
-       stmda   rp!, { r3, r8, r9, r12 }        C store 4 limbs
+       ldmda   up!, { r3,r4,r5,r12 }
+       beq     L(end)
+
+L(top):        subs    n, n, #4
+       stmda   rp!, { r3,r4,r5,r12 }
+       ldmda   up!, { r3,r4,r5,r12 }
        bne     L(top)
 
-       ldmfd   sp!, { r7, r8, r9 }             C restore regs from stack
+L(end):        stmda   rp, { r3,r4,r5,r12 }
+       pop     { r4-r5 }
 L(rtn):        bx      lr
 EPILOGUE()
index ba9824192ba20ba994bf8c8fd1d02f79c829e4e1..fa454702c14e9144513fac79c6c83a2637c0be0c 100644 (file)
@@ -1,30 +1,48 @@
 dnl  ARM mpn_copyi.
 
-dnl  Copyright 2003, 2012 Free Software Foundation, Inc.
+dnl  Contributed to the GNU project by Robert Harley and Torbjörn Granlund.
 
-dnl  This file is part of the GNU MP Library.
+dnl  Copyright 2003, 2012, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM     ?
 C XScale        ?
+C Cortex-A7     ?
 C Cortex-A8     ?
-C Cortex-A9     1.5
-C Cortex-A15    ?
+C Cortex-A9     1.25-1.5
+C Cortex-A15    1.25
+
+C TODO
+C  * Consider wider unrolling.  Analogous 8-way code runs 10% faster on both A9
+C    and A15.  But it probably slows things down for 8 <= n < a few dozen.
 
 define(`rp', `r0')
 define(`up', `r1')
@@ -39,18 +57,23 @@ PROLOGUE(mpn_copyi)
 L(skip1):
        tst     n, #2
        beq     L(skip2)
-       ldmia   up!, { r3, r12 }                C load 2 limbs
-       stmia   rp!, { r3, r12 }                C store 2 limbs
+       ldmia   up!, { r3,r12 }
+       stmia   rp!, { r3,r12 }
 L(skip2):
        bics    n, n, #3
        beq     L(rtn)
-       stmfd   sp!, { r7, r8, r9 }             C save regs on stack
 
-L(top):        ldmia   up!, { r3, r8, r9, r12 }        C load 4 limbs
+       push    { r4-r5 }
        subs    n, n, #4
-       stmia   rp!, { r3, r8, r9, r12 }        C store 4 limbs
+       ldmia   up!, { r3,r4,r5,r12 }
+       beq     L(end)
+
+L(top):        subs    n, n, #4
+       stmia   rp!, { r3,r4,r5,r12 }
+       ldmia   up!, { r3,r4,r5,r12 }
        bne     L(top)
 
-       ldmfd   sp!, { r7, r8, r9 }             C restore regs from stack
+L(end):        stm     rp, { r3,r4,r5,r12 }
+       pop     { r4-r5 }
 L(rtn):        bx      lr
 EPILOGUE()
diff --git a/mpn/arm/dive_1.asm b/mpn/arm/dive_1.asm
new file mode 100644 (file)
index 0000000..a695e47
--- /dev/null
@@ -0,0 +1,151 @@
+dnl  ARM v4 mpn_modexact_1c_odd
+
+dnl  Contributed to the GNU project by Torbjorn Granlund.
+
+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')
+
+C               cycles/limb       cycles/limb
+C               norm    unorm    modexact_1c_odd
+C StrongARM     ?
+C XScale        ?
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9    10      12
+C Cortex-A15    9       9
+
+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(`cy', `r7')
+define(`cnt', `r6')
+define(`tnc', `r8')
+
+ASM_START()
+PROLOGUE(mpn_divexact_1)
+       tst     d, #1
+       push    {r4-r9}
+       mov     cnt, #0
+       bne     L(inv)
+
+C count trailing zeros
+       movs    r4, d, lsl #16
+       moveq   d, d, lsr #16
+       moveq   cnt, #16
+       tst     d, #0xff
+       moveq   d, d, lsr #8
+       addeq   cnt, cnt, #8
+       LEA(    r4, ctz_tab)
+       and     r5, d, #0xff
+       ldrb    r4, [r4, r5]
+       mov     d, d, lsr r4
+       add     cnt, cnt, r4
+
+C binvert limb
+L(inv):        LEA(    r4, binvert_limb_table)
+       and     r12, d, #254
+       ldrb    r4, [r4, r12, lsr #1]
+       mul     r12, r4, r4
+       mul     r12, d, r12
+       rsb     r12, r12, r4, lsl #1
+       mul     r4, r12, r12
+       mul     r4, d, r4
+       rsb     r4, r4, r12, lsl #1     C r4 = inverse
+
+       tst     cnt, cnt
+       ldr     r5, [up], #4            C up[0]
+       mov     cy, #0
+       bne     L(unnorm)
+
+L(norm):
+       subs    n, n, #1                C set carry as side-effect
+       beq     L(end)
+
+       ALIGN(16)
+L(top):        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)
+
+L(end):        sbc     cy, r5, cy
+       mul     r9, r4, cy
+       str     r9, [rp]
+       pop     {r4-r9}
+       bx      r14
+
+L(unnorm):
+       rsb     tnc, cnt, #32
+       mov     r5, r5, 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, r5, r12, lsl tnc
+       mov     r5, r12, lsr cnt
+       sbcs    cy, r9, cy              C critical path ->cy->cy->
+       sub     n, n, #1
+       mul     r9, r4, 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, r5, cy
+       mul     r9, r4, cy
+       str     r9, [rp]
+       pop     {r4-r9}
+       bx      r14
+EPILOGUE()
+
+       .section .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
index e6321dde8aa49994e42085c8640a2560e2e78a41..87eec3a149423e53e43274bdaf26e63968298f50 100644 (file)
@@ -1,25 +1,36 @@
 /* gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2009, 2010 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2003, 2009, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 /* 1193MHz ARM (gcc55.fsffrance.org) */
 
index d717404f9a56e38d1538ed59763ba869dfa2eb25..d4c3afe2da34082c2b045d2182cfbdfe7fc2e28f 100644 (file)
@@ -3,19 +3,30 @@ dnl  ARM mpn_invert_limb -- Invert a normalized limb.
 dnl  Copyright 2001, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 6326ca98c31c0c6f76de56a8d20bc0638f583fc5..5a61683fc2e9f9253696080292feeb933c651dd2 100644 (file)
@@ -1,23 +1,34 @@
 dnl  ARM mpn_and_n, mpn_andn_n. mpn_nand_n, etc.
 
-dnl  Contributed to the GNU project by Torbjorn Granlund.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
 dnl  Copyright 1997, 2000, 2001, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -25,9 +36,10 @@ C            cycles/limb             cycles/limb
 C          and andn ior xor         nand iorn nior xnor
 C StrongARM     ?                       ?
 C XScale        ?                       ?
+C Cortex-A7     ?                       ?
 C Cortex-A8     ?                       ?
 C Cortex-A9    2.5-2.72                2.75-3
-C Cortex-A15    ?                       ?
+C Cortex-A15   2.25                    2.75
 
 C TODO
 C  * It seems that 2.25 c/l and 2.75 c/l is possible for A9.
index e072d9d504c84d826b10db1b2c0e115f2c76eeda..9f777eb4dd8f85706faa66e3f7eb41c39a3e34d0 100644 (file)
@@ -1,29 +1,41 @@
 dnl  ARM mpn_lshift.
 
-dnl  Contributed to the GNU project by Torbjorn Granlund.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM     ?
 C XScale        ?
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9     3.5
 C Cortex-A15    ?
@@ -42,7 +54,7 @@ PROLOGUE(mpn_lshift)
        add     rp, rp, n, lsl #2
        rsb     tnc, cnt, #32
 
-       lsl     r7, r4, cnt
+       mov     r7, r4, lsl cnt
        tst     n, #1
        beq     L(evn)                  C n even
 
@@ -58,19 +70,19 @@ L(evn):     ldr     r6, [up, #-4]!
 L(top):        ldr     r8, [up, #-4]!
        orr     r7, r7, r6, lsr tnc
        str     r7, [rp, #-4]!
-       lsl     r7, r6, cnt
+       mov     r7, r6, lsl cnt
 L(mid):        ldr     r6, [up, #-4]!
        orr     r7, r7, r8, lsr tnc
        str     r7, [rp, #-4]!
-       lsl     r7, r8, cnt
+       mov     r7, r8, lsl cnt
        subs    n, n, #2
        bgt     L(top)
 
 L(end):        orr     r7, r7, r6, lsr tnc
        str     r7, [rp, #-4]!
-       lsl     r7, r6, cnt
+       mov     r7, r6, lsl cnt
 L(1):  str     r7, [rp, #-4]
-       lsr     r0, r4, tnc
+       mov     r0, r4, lsr tnc
        pop     {r4, r6, r7, r8}
        bx      r14
 EPILOGUE()
index f82de0cc208366e48e461c1a4755e220d36352b6..5f3d6e3f5b7598f813a040d6cea282fdad293e13 100644 (file)
@@ -1,29 +1,41 @@
 dnl  ARM mpn_lshiftc.
 
-dnl  Contributed to the GNU project by Torbjorn Granlund.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM     ?
 C XScale        ?
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9     4.0
 C Cortex-A15    ?
@@ -43,7 +55,7 @@ PROLOGUE(mpn_lshiftc)
        rsb     tnc, cnt, #32
        mvn     r6, r4
 
-       lsl     r7, r6, cnt
+       mov     r7, r6, lsl cnt
        tst     n, #1
        beq     L(evn)                  C n even
 
@@ -62,22 +74,22 @@ L(top):     ldr     r8, [up, #-4]!
        orr     r7, r7, r6, lsr tnc
        str     r7, [rp, #-4]!
        mvn     r8, r8
-       lsl     r7, r6, cnt
+       mov     r7, r6, lsl cnt
 L(mid):        ldr     r6, [up, #-4]!
        orr     r7, r7, r8, lsr tnc
        str     r7, [rp, #-4]!
        mvn     r6, r6
-       lsl     r7, r8, cnt
+       mov     r7, r8, lsl cnt
        subs    n, n, #2
        bgt     L(top)
 
 L(end):        orr     r7, r7, r6, lsr tnc
        str     r7, [rp, #-4]!
-       lsl     r7, r6, cnt
+       mov     r7, r6, lsl cnt
 L(1):  mvn     r6, #0
        orr     r7, r7, r6, lsr tnc
        str     r7, [rp, #-4]
-       lsr     r0, r4, tnc
+       mov     r0, r4, lsr tnc
        pop     {r4, r6, r7, r8}
        bx      r14
 EPILOGUE()
index 4643699f470d63d799ba5605d954de47ddf4fec5..ba3c06d8db1089963628d74e11d1dcb193c3de88 100644 (file)
@@ -1,30 +1,42 @@
 dnl  ARM mpn_mod_34lsub1 -- remainder modulo 2^24-1.
 
-dnl  Copyright 2012 Free Software Foundation, Inc.
+dnl  Copyright 2012, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM     ?
 C XScale        ?
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9     1.33
-C Cortex-A15    ?
+C Cortex-A15    1.33
 
 define(`ap',   r0)
 define(`n',    r1)
@@ -48,7 +60,7 @@ PROLOGUE(mpn_mod_34lsub1)
        ldmia   ap!, { r2, r3, r12 }
        subs    n, n, #3
        blt     L(sum)                  C n <= 5
-       adds    r0, r0, #0              C clear carry
+       cmn     r0, #0                  C clear carry
        sub     n, n, #3
        b       L(mid)
 
@@ -83,12 +95,12 @@ L(sum2):
        add     r0, r0, r2, lsr #24
        add     r0, r0, r7
 
-       lsl     r7, r3, #8
+       mov     r7, r3, lsl #8
        bic     r1, r7, #0xff000000
        add     r0, r0, r1
        add     r0, r0, r3, lsr #16
 
-       lsl     r7, r12, #16
+       mov     r7, r12, lsl #16
        bic     r1, r7, #0xff000000
        add     r0, r0, r1
        add     r0, r0, r12, lsr #8
index e85f7f2be236ff18c46f76b3bb1ab5790590d970..5e0f78fc8f58a2332e47d23af93ef208e931cfc4 100644 (file)
@@ -1,32 +1,52 @@
 dnl  ARM mpn_modexact_1c_odd
 
-dnl  Contributed to the GNU project by Torbjorn Granlund.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM     ?
 C XScale        ?
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9    10
-C Cortex-A15    ?
+C Cortex-A15    9
+
+C Architecture requirements:
+C v5   -
+C v5t  -
+C v5te -
+C v6   -
+C v6t2 -
+C v7a  -
 
 define(`up', `r0')
 define(`n',  `r1')
index f4b6bf984df224a91fb84b7752519749fe8a493a..f7bc1bc386caf5724d8826821349ddb92feff778 100644 (file)
@@ -5,25 +5,37 @@ dnl  Contributed by Robert Harley.
 dnl  Copyright 1998, 2000, 2001, 2003, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM    6-8
 C XScale        ?
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9     4.75
 C Cortex-A15    ?
diff --git a/mpn/arm/neon/README b/mpn/arm/neon/README
new file mode 100644 (file)
index 0000000..79e3b48
--- /dev/null
@@ -0,0 +1,2 @@
+This directory contains Neon code which runs and is efficient on all
+ARM CPUs which support Neon.
diff --git a/mpn/arm/neon/hamdist.asm b/mpn/arm/neon/hamdist.asm
new file mode 100644 (file)
index 0000000..2320896
--- /dev/null
@@ -0,0 +1,194 @@
+dnl  ARM Neon mpn_hamdist -- mpn bit hamming distance.
+
+dnl  Copyright 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 StrongARM:    -
+C XScale        -
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9     1.89
+C Cortex-A15    0.95
+
+C TODO
+C  * Explore using vldr and vldm.  Does it help on A9?  (These loads do
+C    64-bits-at-a-time, which will mess up in big-endian mode.  Except not for
+C    popcount. Except perhaps also for popcount for the edge loads.)
+C  * Arrange to align the pointer, if that helps performance.  Use the same
+C    read-and-mask trick we use on PCs, for simplicity and performance.  (Sorry
+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.
+
+C INPUT PARAMETERS
+define(`ap', r0)
+define(`bp', r1)
+define(`n',  r2)
+
+C We sum into 16 16-bit counters in q8,q9, but at the end we sum them and end
+C up with 8 16-bit counters.  Therefore, we can sum to 8(2^16-1) bits, or
+C (8*2^16-1)/32 = 0x3fff limbs.  We use a chunksize close to that, but which
+C can be represented as a 8-bit ARM constant.
+C
+define(`chunksize',0x3f80)
+
+ASM_START()
+PROLOGUE(mpn_hamdist)
+
+       cmp     n, #chunksize
+       bhi     L(gt16k)
+
+L(lt16k):
+       vmov.i64   q8, #0               C clear summation register
+       vmov.i64   q9, #0               C clear summation register
+
+       tst        n, #1
+       beq        L(xxx0)
+       vmov.i64   d0, #0
+       vmov.i64   d20, #0
+       sub        n, n, #1
+       vld1.32   {d0[0]}, [ap]!        C load 1 limb
+       vld1.32   {d20[0]}, [bp]!       C load 1 limb
+       veor       d0, d0, d20
+       vcnt.8     d24, d0
+       vpadal.u8  d16, d24             C d16/q8 = 0; could just splat
+
+L(xxx0):tst       n, #2
+       beq        L(xx00)
+       sub        n, n, #2
+       vld1.32    {d0}, [ap]!          C load 2 limbs
+       vld1.32    {d20}, [bp]!         C load 2 limbs
+       veor       d0, d0, d20
+       vcnt.8     d24, d0
+       vpadal.u8  d16, d24
+
+L(xx00):tst       n, #4
+       beq        L(x000)
+       sub        n, n, #4
+       vld1.32    {q0}, [ap]!          C load 4 limbs
+       vld1.32    {q10}, [bp]!         C load 4 limbs
+       veor       q0, q0, q10
+       vcnt.8     q12, q0
+       vpadal.u8  q8, q12
+
+L(x000):tst       n, #8
+       beq        L(0000)
+
+       subs       n, n, #8
+       vld1.32    {q0,q1}, [ap]!       C load 8 limbs
+       vld1.32    {q10,q11}, [bp]!     C load 8 limbs
+       bls        L(sum)
+
+L(gt8):        vld1.32    {q2,q3}, [ap]!       C load 8 limbs
+       vld1.32    {q14,q15}, [bp]!     C load 8 limbs
+       veor       q0, q0, q10
+       veor       q1, q1, q11
+       sub        n, n, #8
+       vcnt.8     q12, q0
+       vcnt.8     q13, q1
+       b          L(mid)
+
+L(0000):subs      n, n, #16
+       blo        L(e0)
+
+       vld1.32    {q2,q3}, [ap]!       C load 8 limbs
+       vld1.32    {q0,q1}, [ap]!       C load 8 limbs
+       vld1.32    {q14,q15}, [bp]!     C load 8 limbs
+       vld1.32    {q10,q11}, [bp]!     C load 8 limbs
+       veor       q2, q2, q14
+       veor       q3, q3, q15
+       vcnt.8     q12, q2
+       vcnt.8     q13, q3
+       subs       n, n, #16
+       blo        L(end)
+
+L(top):        vld1.32    {q2,q3}, [ap]!       C load 8 limbs
+       vld1.32    {q14,q15}, [bp]!     C load 8 limbs
+       veor       q0, q0, q10
+       veor       q1, q1, q11
+       vpadal.u8  q8, q12
+       vcnt.8     q12, q0
+       vpadal.u8  q9, q13
+       vcnt.8     q13, q1
+L(mid):        vld1.32    {q0,q1}, [ap]!       C load 8 limbs
+       vld1.32    {q10,q11}, [bp]!     C load 8 limbs
+       veor       q2, q2, q14
+       veor       q3, q3, q15
+       subs       n, n, #16
+       vpadal.u8  q8, q12
+       vcnt.8     q12, q2
+       vpadal.u8  q9, q13
+       vcnt.8     q13, q3
+       bhs        L(top)
+
+L(end):        vpadal.u8  q8, q12
+       vpadal.u8  q9, q13
+L(sum):        veor       q0, q0, q10
+       veor       q1, q1, q11
+       vcnt.8     q12, q0
+       vcnt.8     q13, q1
+       vpadal.u8  q8, q12
+       vpadal.u8  q9, q13
+       vadd.i16   q8, q8, q9
+                                       C we have 8 16-bit counts
+L(e0): vpaddl.u16 q8, q8               C we have 4 32-bit counts
+       vpaddl.u32 q8, q8               C we have 2 64-bit counts
+       vmov.32    r0, d16[0]
+       vmov.32    r1, d17[0]
+       add        r0, r0, r1
+       bx      lr
+
+C Code for large count.  Splits operand and calls above code.
+define(`ap2', r5)
+define(`bp2', r6)
+L(gt16k):
+       push    {r4,r5,r6,r14}
+       mov     ap2, ap
+       mov     bp2, bp
+       mov     r3, n                   C full count
+       mov     r4, #0                  C total sum
+
+1:     mov     n, #chunksize           C count for this invocation
+       bl      L(lt16k)                C could jump deep inside code
+       add     ap2, ap2, #chunksize*4  C point at next chunk
+       add     bp2, bp2, #chunksize*4  C point at next chunk
+       add     r4, r4, r0
+       mov     ap, ap2                 C put chunk pointer in place for call
+       mov     bp, bp2                 C put chunk pointer in place for call
+       sub     r3, r3, #chunksize
+       cmp     r3, #chunksize
+       bhi     1b
+
+       mov     n, r3                   C count for final invocation
+       bl      L(lt16k)
+       add     r0, r4, r0
+       pop     {r4,r5,r6,pc}
+EPILOGUE()
diff --git a/mpn/arm/neon/lorrshift.asm b/mpn/arm/neon/lorrshift.asm
new file mode 100644 (file)
index 0000000..3d6253f
--- /dev/null
@@ -0,0 +1,279 @@
+dnl  ARM Neon mpn_lshift and mpn_rshift.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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     cycles/limb     cycles/limb      good
+C              aligned       unaligned       best seen      for cpu?
+C StrongARM     -               -
+C XScale        -               -
+C Cortex-A7     ?               ?
+C Cortex-A8     ?               ?
+C Cortex-A9     3               3                              Y
+C Cortex-A15    1.5             1.5                            Y
+
+
+C We read 64 bits at a time at 32-bit aligned addresses, and except for the
+C first and last store, we write using 64-bit aligned addresses.  All shifting
+C is done on 64-bit words in 'extension' registers.
+C
+C It should be possible to read also using 64-bit alignment, by manipulating
+C the shift count for unaligned operands.  Not done, since it does not seem to
+C matter for A9 or A15.
+C
+C This will not work in big-endian mode.
+
+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  * 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.
+
+C INPUT PARAMETERS
+define(`rp',  `r0')
+define(`ap',  `r1')
+define(`n',   `r2')
+define(`cnt', `r3')
+
+ifdef(`OPERATION_lshift',`
+       define(`IFLSH', `$1')
+       define(`IFRSH', `')
+       define(`X',`0')
+       define(`Y',`1')
+       define(`func',`mpn_lshift')
+')
+ifdef(`OPERATION_rshift',`
+       define(`IFLSH', `')
+       define(`IFRSH', `$1')
+       define(`X',`1')
+       define(`Y',`0')
+       define(`func',`mpn_rshift')
+')
+
+MULFUNC_PROLOGUE(mpn_lshift mpn_rshift)
+
+ASM_START()
+       TEXT
+       ALIGN(64)
+PROLOGUE(func)
+IFLSH(`        mov     r12, n, lsl #2  ')
+IFLSH(`        add     rp, rp, r12     ')
+IFLSH(`        add     ap, ap, r12     ')
+
+       cmp     n, #4                   C SIMD code n limit
+       ble     L(base)
+
+ifdef(`OPERATION_lshift',`
+       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
+
+IFLSH(`        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
+IFLSH(`        add     ap, ap, #4      ')      C move back ap pointer
+IFRSH(`        sub     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
+       vld1.32  {d19}, [ap], r12       C load ap[1] and ap[2]
+
+L(rp_aligned):
+IFLSH(`        sub     rp, rp, #8      ')
+       subs    n, n, #6
+       blt     L(two_or_three_more)
+       tst     n, #2
+       beq     L(2)
+
+L(1):  vld1.32  {d17}, [ap], r12
+       vshl.u64 d5, d19, d6
+       vld1.32  {d16}, [ap], r12
+       vshl.u64 d0, d17, d7
+       vshl.u64 d4, d17, d6
+       sub     n, n, #2
+       b        L(mid)
+
+L(2):  vld1.32  {d16}, [ap], r12
+       vshl.u64 d4, d19, d6
+       vld1.32  {d17}, [ap], r12
+       vshl.u64 d1, d16, d7
+       vshl.u64 d5, d16, d6
+       subs    n, n, #4
+       blt     L(end)
+
+L(top):        vld1.32  {d16}, [ap], r12
+       vorr     d2, d4, d1
+       vshl.u64 d0, d17, d7
+       vshl.u64 d4, d17, d6
+       vst1.32  {d2}, [rp:64], r12
+L(mid):        vld1.32  {d17}, [ap], r12
+       vorr     d3, d5, d0
+       vshl.u64 d1, d16, d7
+       vshl.u64 d5, d16, d6
+       vst1.32  {d3}, [rp:64], r12
+       subs    n, n, #4
+       bge     L(top)
+
+L(end):        tst      n, #1
+       beq      L(evn)
+
+       vorr     d2, d4, d1
+       vst1.32  {d2}, [rp:64], r12
+       b        L(cj1)
+
+L(evn):        vorr     d2, d4, d1
+       vshl.u64 d0, d17, d7
+       vshl.u64 d16, d17, d6
+       vst1.32  {d2}, [rp:64], r12
+       vorr     d2, d5, d0
+       b        L(cj2)
+
+C Load last 2 - 3 limbs, store last 4 - 5 limbs
+L(two_or_three_more):
+       tst     n, #1
+       beq     L(l2)
+
+L(l3): vshl.u64 d5, d19, d6
+       vld1.32  {d17}, [ap], r12
+L(cj1):        veor     d16, d16, d16
+IFLSH(`        add      ap, ap, #4     ')
+       vld1.32  {d16[Y]}, [ap], r12
+       vshl.u64 d0, d17, d7
+       vshl.u64 d4, d17, d6
+       vorr     d3, d5, d0
+       vshl.u64 d1, d16, d7
+       vshl.u64 d5, d16, d6
+       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]
+       bx      lr
+
+L(l2): vld1.32  {d16}, [ap], r12
+       vshl.u64 d4, d19, d6
+       vshl.u64 d1, d16, d7
+       vshl.u64 d16, d16, d6
+       vorr     d2, d4, d1
+L(cj2):        vst1.32  {d2}, [rp:64], r12
+       vst1.32  {d16}, [rp]
+       vmov.32  r0, d18[X]
+       bx      lr
+
+
+define(`tnc', `r12')
+L(base):
+       push    {r4, r6, r7, r8}
+ifdef(`OPERATION_lshift',`
+       ldr     r4, [ap, #-4]!
+       rsb     tnc, cnt, #32
+
+       mov     r7, r4, lsl cnt
+       tst     n, #1
+       beq     L(ev)                   C n even
+
+L(od): subs    n, n, #2
+       bcc     L(ed1)                  C n = 1
+       ldr     r8, [ap, #-4]!
+       b       L(md)                   C n = 3
+
+L(ev): ldr     r6, [ap, #-4]!
+       subs    n, n, #2
+       beq     L(ed)                   C n = 3
+                                       C n = 4
+L(tp): ldr     r8, [ap, #-4]!
+       orr     r7, r7, r6, lsr tnc
+       str     r7, [rp, #-4]!
+       mov     r7, r6, lsl cnt
+L(md): ldr     r6, [ap, #-4]!
+       orr     r7, r7, r8, lsr tnc
+       str     r7, [rp, #-4]!
+       mov     r7, r8, lsl cnt
+
+L(ed): orr     r7, r7, r6, lsr tnc
+       str     r7, [rp, #-4]!
+       mov     r7, r6, lsl cnt
+L(ed1):        str     r7, [rp, #-4]
+       mov     r0, r4, lsr tnc
+')
+ifdef(`OPERATION_rshift',`
+       ldr     r4, [ap]
+       rsb     tnc, cnt, #32
+
+       mov     r7, r4, lsr cnt
+       tst     n, #1
+       beq     L(ev)                   C n even
+
+L(od): subs    n, n, #2
+       bcc     L(ed1)                  C n = 1
+       ldr     r8, [ap, #4]!
+       b       L(md)                   C n = 3
+
+L(ev): ldr     r6, [ap, #4]!
+       subs    n, n, #2
+       beq     L(ed)                   C n = 2
+                                       C n = 4
+
+L(tp): ldr     r8, [ap, #4]!
+       orr     r7, r7, r6, lsl tnc
+       str     r7, [rp], #4
+       mov     r7, r6, lsr cnt
+L(md): ldr     r6, [ap, #4]!
+       orr     r7, r7, r8, lsl tnc
+       str     r7, [rp], #4
+       mov     r7, r8, lsr cnt
+
+L(ed): orr     r7, r7, r6, lsl tnc
+       str     r7, [rp], #4
+       mov     r7, r6, lsr cnt
+L(ed1):        str     r7, [rp], #4
+       mov     r0, r4, lsl tnc
+')
+       pop     {r4, r6, r7, r8}
+       bx      r14
+EPILOGUE()
diff --git a/mpn/arm/neon/lshiftc.asm b/mpn/arm/neon/lshiftc.asm
new file mode 100644 (file)
index 0000000..9e40962
--- /dev/null
@@ -0,0 +1,257 @@
+dnl  ARM Neon mpn_lshiftc.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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     cycles/limb     cycles/limb      good
+C              aligned       unaligned       best seen      for cpu?
+C StrongARM     -               -
+C XScale        -               -
+C Cortex-A7     ?               ?
+C Cortex-A8     ?               ?
+C Cortex-A9     3.5             3.5                            Y
+C Cortex-A15    1.75            1.75                           Y
+
+
+C We read 64 bits at a time at 32-bit aligned addresses, and except for the
+C first and last store, we write using 64-bit aligned addresses.  All shifting
+C is done on 64-bit words in 'extension' registers.
+C
+C It should be possible to read also using 64-bit alignment, by manipulating
+C the shift count for unaligned operands.  Not done, since it does not seem to
+C matter for A9 or A15.
+C
+C This will not work in big-endian mode.
+
+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
+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.
+
+C INPUT PARAMETERS
+define(`rp',  `r0')
+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()
+       TEXT
+       ALIGN(64)
+PROLOGUE(mpn_lshiftc)
+IFLSH(`        mov     r12, n, lsl #2  ')
+IFLSH(`        add     rp, rp, r12     ')
+IFLSH(`        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
+
+IFLSH(`        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
+       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
+       vld1.32  {d19}, [ap], r12       C load ap[1] and ap[2]
+
+L(rp_aligned):
+IFLSH(`        sub     rp, rp, #8      ')
+       subs    n, n, #6
+       vmvn     d19, d19
+       blt     L(two_or_three_more)
+       tst     n, #2
+       beq     L(2)
+
+L(1):  vld1.32  {d17}, [ap], r12
+       vshl.u64 d5, d19, d6
+       vmvn     d17, d17
+       vld1.32  {d16}, [ap], r12
+       vshl.u64 d0, d17, d7
+       vshl.u64 d4, d17, d6
+       sub     n, n, #2
+       b        L(mid)
+
+L(2):  vld1.32  {d16}, [ap], r12
+       vshl.u64 d4, d19, d6
+       vmvn     d16, d16
+       vld1.32  {d17}, [ap], r12
+       vshl.u64 d1, d16, d7
+       vshl.u64 d5, d16, d6
+       subs    n, n, #4
+       blt     L(end)
+
+L(top):        vmvn     d17, d17
+       vld1.32  {d16}, [ap], r12
+       vorr     d2, d4, d1
+       vshl.u64 d0, d17, d7
+       vshl.u64 d4, d17, d6
+       vst1.32  {d2}, [rp:64], r12
+L(mid):        vmvn     d16, d16
+       vld1.32  {d17}, [ap], r12
+       vorr     d3, d5, d0
+       vshl.u64 d1, d16, d7
+       vshl.u64 d5, d16, d6
+       vst1.32  {d3}, [rp:64], r12
+       subs    n, n, #4
+       bge     L(top)
+
+L(end):        tst      n, #1
+       beq      L(evn)
+
+       vorr     d2, d4, d1
+       vst1.32  {d2}, [rp:64], r12
+       b        L(cj1)
+
+L(evn):        vmvn     d17, d17
+       vorr     d2, d4, d1
+       vshl.u64 d0, d17, d7
+       vshl.u64 d4, d17, d6
+       vst1.32  {d2}, [rp:64], r12
+       vmvn.u8  d17, #0
+       vorr     d2, d5, d0
+       vshl.u64 d0, d17, d7
+       vorr     d3, d4, d0
+       b        L(cj2)
+
+C Load last 2 - 3 limbs, store last 4 - 5 limbs
+L(two_or_three_more):
+       tst     n, #1
+       beq     L(l2)
+
+L(l3): vshl.u64 d5, d19, d6
+       vld1.32  {d17}, [ap], r12
+L(cj1):        vmov.u8  d16, #0
+IFLSH(`        add      ap, ap, #4     ')
+       vmvn     d17, d17
+       vld1.32  {d16[Y]}, [ap], r12
+       vshl.u64 d0, d17, d7
+       vshl.u64 d4, d17, d6
+       vmvn     d16, d16
+       vorr     d3, d5, d0
+       vshl.u64 d1, d16, d7
+       vshl.u64 d5, d16, d6
+       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]
+       bx      lr
+
+L(l2): vld1.32  {d16}, [ap], r12
+       vshl.u64 d4, d19, d6
+       vmvn     d16, d16
+       vshl.u64 d1, d16, d7
+       vshl.u64 d5, d16, d6
+       vmvn.u8  d17, #0
+       vorr     d2, d4, d1
+       vshl.u64 d0, d17, d7
+       vorr     d3, d5, d0
+L(cj2):        vst1.32  {d2}, [rp:64], r12
+       vst1.32  {d3}, [rp]
+       vmov.32  r0, d18[X]
+       bx      lr
+
+
+define(`tnc', `r12')
+L(base):
+       push    {r4, r6, r7, r8}
+       ldr     r4, [ap, #-4]!
+       rsb     tnc, cnt, #32
+       mvn     r6, r4
+
+       mov     r7, r6, lsl cnt
+       tst     n, #1
+       beq     L(ev)                   C n even
+
+L(od): subs    n, n, #2
+       bcc     L(ed1)                  C n = 1
+       ldr     r8, [ap, #-4]!
+       mvn     r8, r8
+       b       L(md)                   C n = 3
+
+L(ev): ldr     r6, [ap, #-4]!
+       mvn     r6, r6
+       subs    n, n, #2
+       beq     L(ed)                   C n = 3
+                                       C n = 4
+L(tp): ldr     r8, [ap, #-4]!
+       orr     r7, r7, r6, lsr tnc
+       str     r7, [rp, #-4]!
+       mvn     r8, r8
+       mov     r7, r6, lsl cnt
+L(md): ldr     r6, [ap, #-4]!
+       orr     r7, r7, r8, lsr tnc
+       str     r7, [rp, #-4]!
+       mvn     r6, r6
+       mov     r7, r8, lsl cnt
+
+L(ed): orr     r7, r7, r6, lsr tnc
+       str     r7, [rp, #-4]!
+       mov     r7, r6, lsl cnt
+L(ed1):        mvn     r6, #0
+       orr     r7, r7, r6, lsr tnc
+       str     r7, [rp, #-4]
+       mov     r0, r4, lsr tnc
+       pop     {r4, r6, r7, r8}
+       bx      r14
+EPILOGUE()
diff --git a/mpn/arm/neon/popcount.asm b/mpn/arm/neon/popcount.asm
new file mode 100644 (file)
index 0000000..2f8f9af
--- /dev/null
@@ -0,0 +1,166 @@
+dnl  ARM Neon mpn_popcount -- mpn bit population count.
+
+dnl  Copyright 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 StrongARM:    -
+C XScale        -
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9     1.125
+C Cortex-A15    0.56
+
+C TODO
+C  * Explore using vldr and vldm.  Does it help on A9?  (These loads do
+C    64-bits-at-a-time, which will mess up in big-endian mode.  Except not for
+C    popcount. Except perhaps also for popcount for the edge loads.)
+C  * Arrange to align the pointer, if that helps performance.  Use the same
+C    read-and-mask trick we use on PCs, for simplicity and performance.  (Sorry
+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.
+
+C INPUT PARAMETERS
+define(`ap', r0)
+define(`n',  r1)
+
+C We sum into 16 16-bit counters in q8,q9, but at the end we sum them and end
+C up with 8 16-bit counters.  Therefore, we can sum to 8(2^16-1) bits, or
+C (8*2^16-1)/32 = 0x3fff limbs.  We use a chunksize close to that, but which
+C can be represented as a 8-bit ARM constant.
+C
+define(`chunksize',0x3f80)
+
+ASM_START()
+PROLOGUE(mpn_popcount)
+
+       cmp     n, #chunksize
+       bhi     L(gt16k)
+
+L(lt16k):
+       vmov.i64   q8, #0               C clear summation register
+       vmov.i64   q9, #0               C clear summation register
+
+       tst        n, #1
+       beq        L(xxx0)
+       vmov.i64   d0, #0
+       sub        n, n, #1
+       vld1.32   {d0[0]}, [ap]!        C load 1 limb
+       vcnt.8     d24, d0
+       vpadal.u8  d16, d24             C d16/q8 = 0; could just splat
+
+L(xxx0):tst       n, #2
+       beq        L(xx00)
+       sub        n, n, #2
+       vld1.32    {d0}, [ap]!          C load 2 limbs
+       vcnt.8     d24, d0
+       vpadal.u8  d16, d24
+
+L(xx00):tst       n, #4
+       beq        L(x000)
+       sub        n, n, #4
+       vld1.32    {q0}, [ap]!          C load 4 limbs
+       vcnt.8     q12, q0
+       vpadal.u8  q8, q12
+
+L(x000):tst       n, #8
+       beq        L(0000)
+
+       subs       n, n, #8
+       vld1.32    {q0,q1}, [ap]!       C load 8 limbs
+       bls        L(sum)
+
+L(gt8):        vld1.32    {q2,q3}, [ap]!       C load 8 limbs
+       sub        n, n, #8
+       vcnt.8     q12, q0
+       vcnt.8     q13, q1
+       b          L(mid)
+
+L(0000):subs      n, n, #16
+       blo        L(e0)
+
+       vld1.32    {q2,q3}, [ap]!       C load 8 limbs
+       vld1.32    {q0,q1}, [ap]!       C load 8 limbs
+       vcnt.8     q12, q2
+       vcnt.8     q13, q3
+       subs       n, n, #16
+       blo        L(end)
+
+L(top):        vld1.32    {q2,q3}, [ap]!       C load 8 limbs
+       vpadal.u8  q8, q12
+       vcnt.8     q12, q0
+       vpadal.u8  q9, q13
+       vcnt.8     q13, q1
+L(mid):        vld1.32    {q0,q1}, [ap]!       C load 8 limbs
+       subs       n, n, #16
+       vpadal.u8  q8, q12
+       vcnt.8     q12, q2
+       vpadal.u8  q9, q13
+       vcnt.8     q13, q3
+       bhs        L(top)
+
+L(end):        vpadal.u8  q8, q12
+       vpadal.u8  q9, q13
+L(sum):        vcnt.8     q12, q0
+       vcnt.8     q13, q1
+       vpadal.u8  q8, q12
+       vpadal.u8  q9, q13
+       vadd.i16   q8, q8, q9
+                                       C we have 8 16-bit counts
+L(e0): vpaddl.u16 q8, q8               C we have 4 32-bit counts
+       vpaddl.u32 q8, q8               C we have 2 64-bit counts
+       vmov.32    r0, d16[0]
+       vmov.32    r1, d17[0]
+       add        r0, r0, r1
+       bx      lr
+
+C Code for large count.  Splits operand and calls above code.
+define(`ap2', r2)                      C caller-saves reg not used above
+L(gt16k):
+       push    {r4,r14}
+       mov     ap2, ap
+       mov     r3, n                   C full count
+       mov     r4, #0                  C total sum
+
+1:     mov     n, #chunksize           C count for this invocation
+       bl      L(lt16k)                C could jump deep inside code
+       add     ap2, ap2, #chunksize*4  C point at next chunk
+       add     r4, r4, r0
+       mov     ap, ap2                 C put chunk pointer in place for call
+       sub     r3, r3, #chunksize
+       cmp     r3, #chunksize
+       bhi     1b
+
+       mov     n, r3                   C count for final invocation
+       bl      L(lt16k)
+       add     r0, r4, r0
+       pop     {r4,pc}
+EPILOGUE()
diff --git a/mpn/arm/neon/sec_tabselect.asm b/mpn/arm/neon/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..69fceb0
--- /dev/null
@@ -0,0 +1,140 @@
+dnl  ARM Neon mpn_sec_tabselect.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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')
+
+
+C           cycles/limb
+C StrongARM     -
+C XScale        -
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9     1.15
+C Cortex-A15    0.65
+
+define(`rp',     `r0')
+define(`tp',     `r1')
+define(`n',      `r2')
+define(`nents',  `r3')
+C define(`which',  on stack)
+
+define(`i',      `r4')
+define(`j',      `r5')
+
+define(`maskq',  `q10')
+define(`maskd',  `d20')
+
+ASM_START()
+PROLOGUE(mpn_sec_tabselect)
+       push    {r4-r5}
+
+       add       r4, sp, #8
+       vld1.32   {d30[], d31[]}, [r4]  C 4 `which' copies
+       vmov.i32  q14, #1               C 4 copies of 1
+
+       subs    j, n, #8
+       bmi     L(outer_end)
+
+L(outer_top):
+       mov       i, nents
+       mov       r12, tp               C preserve tp
+       veor      q13, q13, q13         C 4 counter copies
+       veor      q2, q2, q2
+       veor      q3, q3, q3
+       ALIGN(16)
+L(top):        vceq.i32  maskq, q13, q15       C compare idx copies to `which' copies
+       vld1.32   {q0,q1}, [tp]
+       vadd.i32  q13, q13, q14
+       vbit      q2, q0, maskq
+       vbit      q3, q1, maskq
+       add       tp, tp, n, lsl #2
+       subs      i, i, #1
+       bne       L(top)
+       vst1.32   {q2,q3}, [rp]!
+       add       tp, r12, #32          C restore tp, point to next slice
+       subs      j, j, #8
+       bpl       L(outer_top)
+L(outer_end):
+
+       tst       n, #4
+       beq       L(b0xx)
+L(b1xx):mov      i, nents
+       mov       r12, tp
+       veor      q13, q13, q13
+       veor      q2, q2, q2
+       ALIGN(16)
+L(tp4):        vceq.i32  maskq, q13, q15
+       vld1.32   {q0}, [tp]
+       vadd.i32  q13, q13, q14
+       vbit      q2, q0, maskq
+       add       tp, tp, n, lsl #2
+       subs      i, i, #1
+       bne       L(tp4)
+       vst1.32   {q2}, [rp]!
+       add       tp, r12, #16
+
+L(b0xx):tst      n, #2
+       beq       L(b00x)
+L(b01x):mov      i, nents
+       mov       r12, tp
+       veor      d26, d26, d26
+       veor      d4, d4, d4
+       ALIGN(16)
+L(tp2):        vceq.i32  maskd, d26, d30
+       vld1.32   {d0}, [tp]
+       vadd.i32  d26, d26, d28
+       vbit      d4, d0, maskd
+       add       tp, tp, n, lsl #2
+       subs      i, i, #1
+       bne       L(tp2)
+       vst1.32   {d4}, [rp]!
+       add       tp, r12, #8
+
+L(b00x):tst      n, #1
+       beq       L(b000)
+L(b001):mov      i, nents
+       mov       r12, tp
+       veor      d26, d26, d26
+       veor      d4, d4, d4
+       ALIGN(16)
+L(tp1):        vceq.i32  maskd, d26, d30
+       vld1.32   {d0[0]}, [tp]
+       vadd.i32  d26, d26, d28
+       vbit      d4, d0, maskd
+       add       tp, tp, n, lsl #2
+       subs      i, i, #1
+       bne       L(tp1)
+       vst1.32   {d4[0]}, [rp]
+
+L(b000):pop    {r4-r5}
+       bx      r14
+EPILOGUE()
index af952a93d5020b9ac24ee4fbacbb3ca7fde76b06..95c1f79ad9f999c126f331a394dff8b1ef534153 100644 (file)
@@ -1,32 +1,44 @@
 dnl  ARM mpn_rsh1add_n and mpn_rsh1sub_n.
 
-dnl  Contributed to the GNU project by Torbjorn Granlund.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM     ?
 C XScale        ?
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9    3.64-3.7
-C Cortex-A15    ?
+C Cortex-A15    2.5
 
 C TODO
 C  * Not optimised.
@@ -59,7 +71,7 @@ PROLOGUE(func)
        ldr     r4, [up], #4
        ldr     r8, [vp], #4
        ADDSUB  r4, r4, r8
-       rrxs    r12, r7
+       movs    r12, r7, rrx
        and     r11, r4, #1     C return value
        subs    n, n, #4
        blo     L(end)
@@ -70,10 +82,10 @@ L(top):     ldmia   up!, {r5,r6,r7}
        ADDSUBC r5, r5, r8
        ADDSUBC r6, r6, r9
        ADDSUBC r7, r7, r10
-       rrxs    r12, r7
-       rrxs    r6, r6
-       rrxs    r5, r5
-       rrxs    r4, r4
+       movs    r12, r7, rrx
+       movs    r6, r6, rrx
+       movs    r5, r5, rrx
+       movs    r4, r4, rrx
        subs    n, n, #3
        stmia   rp!, {r4,r5,r6}
        mov     r4, r7
@@ -86,9 +98,9 @@ L(end):       cmn     n, #2
        cmn     r12, r12
        ADDSUBC r5, r5, r8
        ADDSUBC r6, r6, r9
-       rrxs    r12, r6
-       rrxs    r5, r5
-       rrxs    r4, r4
+       movs    r12, r6, rrx
+       movs    r5, r5, rrx
+       movs    r4, r4, rrx
        stmia   rp!, {r4,r5}
        mov     r4, r6
        b       L(e1)
@@ -98,13 +110,13 @@ L(e2):     bne     L(e1)
        ldr     r8, [vp, #0]
        cmn     r12, r12
        ADDSUBC r5, r5, r8
-       rrxs    r12, r5
-       rrxs    r4, r4
+       movs    r12, r5, rrx
+       movs    r4, r4, rrx
        str     r4, [rp], #4
        mov     r4, r5
 
 L(e1): RSTCY(  r12, r1)
-       rrxs    r4, r4
+       mov     r4, r4, rrx
        str     r4, [rp, #0]
        mov     r0, r11
        pop     {r4-r11}
index 2fe127c1a5f705fa1c3e04dc20526a38a20fbd5d..84728d038a774ae2818629a15a38100ad68b4add 100644 (file)
@@ -1,29 +1,41 @@
 dnl  ARM mpn_rshift.
 
-dnl  Contributed to the GNU project by Torbjorn Granlund.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
 dnl  Copyright 1997, 2000, 2001, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM     ?
 C XScale        ?
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9     3.5
 C Cortex-A15    ?
@@ -40,7 +52,7 @@ PROLOGUE(mpn_rshift)
        ldr     r4, [up]
        rsb     tnc, cnt, #32
 
-       lsr     r7, r4, cnt
+       mov     r7, r4, lsr cnt
        tst     n, #1
        beq     L(evn)                  C n even
 
@@ -56,19 +68,19 @@ L(evn):     ldr     r6, [up, #4]!
 L(top):        ldr     r8, [up, #4]!
        orr     r7, r7, r6, lsl tnc
        str     r7, [rp], #4
-       lsr     r7, r6, cnt
+       mov     r7, r6, lsr cnt
 L(mid):        ldr     r6, [up, #4]!
        orr     r7, r7, r8, lsl tnc
        str     r7, [rp], #4
-       lsr     r7, r8, cnt
+       mov     r7, r8, lsr cnt
        subs    n, n, #2
        bgt     L(top)
 
 L(end):        orr     r7, r7, r6, lsl tnc
        str     r7, [rp], #4
-       lsr     r7, r6, cnt
-L(1):  str     r7, [rp], #4
-       lsl     r0, r4, tnc
+       mov     r7, r6, lsr cnt
+L(1):  str     r7, [rp]
+       mov     r0, r4, lsl tnc
        pop     {r4, r6, r7, r8}
        bx      r14
 EPILOGUE()
diff --git a/mpn/arm/sec_tabselect.asm b/mpn/arm/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..8cf937a
--- /dev/null
@@ -0,0 +1,131 @@
+dnl  ARM mpn_sec_tabselect
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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 StrongARM     ?
+C XScale        ?
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9     2.33
+C Cortex-A15    2.2
+
+C TODO
+C  * Consider using special code for small nents, either swapping the inner and
+C    outer loops, or providing a few completely unrolling the inner loops.
+
+define(`rp',    `r0')
+define(`tp',    `r1')
+define(`n',     `r2')
+define(`nents', `r3')
+C      which  on stack
+
+define(`i',     `r11')
+define(`j',     `r12')
+define(`c',     `r14')
+define(`mask',  `r7')
+
+ASM_START()
+PROLOGUE(mpn_sec_tabselect)
+       push    {r4-r11, r14}
+
+       subs    j, n, #3
+       bmi     L(outer_end)
+L(outer_top):
+       ldr     c, [sp, #36]
+       mov     i, nents
+       push    {tp}
+
+       mov     r8, #0
+       mov     r9, #0
+       mov     r10, #0
+
+L(top):        subs    c, c, #1
+       ldm     tp, {r4,r5,r6}
+       sbc     mask, mask, mask
+       subs    i, i, #1
+       add     tp, tp, n, lsl #2
+       and     r4, r4, mask
+       and     r5, r5, mask
+       and     r6, r6, mask
+       orr     r8, r8, r4
+       orr     r9, r9, r5
+       orr     r10, r10, r6
+       bge     L(top)
+
+       stmia   rp!, {r8,r9,r10}
+       pop     {tp}
+       add     tp, tp, #12
+       subs    j, j, #3
+       bpl     L(outer_top)
+L(outer_end):
+
+       cmp     j, #-1
+       bne     L(n2)
+
+       ldr     c, [sp, #36]
+       mov     i, nents
+       mov     r8, #0
+       mov     r9, #0
+L(tp2):        subs    c, c, #1
+       sbc     mask, mask, mask
+       ldm     tp, {r4,r5}
+       subs    i, i, #1
+       add     tp, tp, n, lsl #2
+       and     r4, r4, mask
+       and     r5, r5, mask
+       orr     r8, r8, r4
+       orr     r9, r9, r5
+       bge     L(tp2)
+       stmia   rp, {r8,r9}
+       pop     {r4-r11, r14}
+       bx      lr
+
+L(n2): cmp     j, #-2
+       bne     L(n1)
+
+       ldr     c, [sp, #36]
+       mov     i, nents
+       mov     r8, #0
+L(tp1):        subs    c, c, #1
+       sbc     mask, mask, mask
+       ldr     r4, [tp]
+       subs    i, i, #1
+       add     tp, tp, n, lsl #2
+       and     r4, r4, mask
+       orr     r8, r8, r4
+       bge     L(tp1)
+       str     r8, [rp]
+L(n1): pop     {r4-r11, r14}
+       bx      lr
+EPILOGUE()
index 5cdf9281565bcfca832d0954cde60903294aea74..8d441c74edd37cf1bcb065aebb7ad3d0e214cddb 100644 (file)
@@ -4,19 +4,30 @@ dnl  Return quotient and store remainder through a supplied pointer.
 dnl  Copyright 2001, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d0aa966d5a63d0446e496f72c12b1134fb0b846c..169d154bf0b1518459637d6d663722cbdbe85efa 100644 (file)
@@ -1,31 +1,42 @@
 dnl  ARM v5 mpn_gcd_1.
 
-dnl  Based on the K7 gcd_1.asm, by Kevin Ryde.  Rehacked for ARM by Torbjorn
+dnl  Based on the K7 gcd_1.asm, by Kevin Ryde.  Rehacked for ARM by Torbjörn
 dnl  Granlund.
 
-dnl  Copyright 2000, 2001, 2002, 2005, 2009, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/bit (approx)
-C StrongARM     ?
+C StrongARM     -
 C XScale        ?
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9     5.9
 C Cortex-A15    ?
@@ -63,7 +74,7 @@ PROLOGUE(mpn_gcd_1)
        and     r12, r12, v0
        clz     r12, r12
        rsb     r12, r12, #31
-       lsr     v0, v0, r12
+       mov     v0, v0, lsr r12
 
        mov     r7, v0
 
@@ -96,7 +107,7 @@ L(red1):rsbs r12, r3, #0
 L(top):        rsb     r12, r12, #31
        movcc   r3, r1          C if x-y < 0
        movcc   r7, r0          C use x,y-x
-L(mid):        lsr     r3, r3, r12     C
+L(mid):        mov     r3, r3, lsr r12 C
        mov     r0, r3          C
        sub     r1, r7, r3      C
        rsbs    r3, r7, r3      C
@@ -104,6 +115,6 @@ L(mid):     lsr     r3, r3, r12     C
        clz     r12, r12        C
        bne     L(top)          C
 
-L(end):        lsl     r0, r7, r4
+L(end):        mov     r0, r7, lsl r4
        pop     {r4, r7, pc}
 EPILOGUE()
index 824f13f2e06d6a140dd450cb14989f2e9a47e48c..3cf0cd77636745a2912bd40494cc6f4b1e281d58 100644 (file)
@@ -1,29 +1,41 @@
 dnl  ARM mpn_mod_1_1p
 
-dnl  Contributed to the GNU project by Torbjorn Granlund.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
-C StrongARM     ?
+C StrongARM     -
 C XScale        ?
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9     7
 C Cortex-A15    6
index a41bf3527859930fefb3207a15ed0e7a36ddb5b7..aa26ecb21c1c8f7023be29b34acf9efd9345ccab 100644 (file)
@@ -1,29 +1,41 @@
 dnl  ARM mpn_mod_1s_2p
 
-dnl  Contributed to the GNU project by Torbjorn Granlund.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
-C StrongARM     ?
+C StrongARM     -
 C XScale        ?
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9     4.25
 C Cortex-A15    3
index 56bfb34b3dd8e32231f7dd307f028ef7fbc4213b..57019e4b2b649c2cc17de7b883838677f6dd639c 100644 (file)
@@ -3,25 +3,37 @@ dnl  ARM mpn_addmul_1.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM:    -
 C XScale        -
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9     3.25
 C Cortex-A15    4
index dec07988e641addf5f174d6c25da0a6b441cadc9..69817ce340d743ad01216f7ff00df052a1d1175d 100644 (file)
@@ -1,36 +1,52 @@
 dnl  ARM mpn_addmul_2.
 
-dnl  Contributed to the GNU project by Torbjorn Granlund.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
-dnl  Copyright 2012 Free Software Foundation, Inc.
+dnl  Copyright 2012, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM:    -
 C XScale        -
+C Cortex-A7     ?
 C Cortex-A8     ?
-C Cortex-A9     2.38
+C Cortex-A9     2.25
 C Cortex-A15    2.5
 
-C TODO
-C  * Consider using more registers for the r[] loads, allowing better load-use
-C    scheduling for a 6% speedup (on A9).  Free: r10, r11, r14
+C This is believed to be optimal for A15 for any unrolling, and optimal for A9
+C for 4-way unrolling.  Using separate pointer update instructions is necessary
+C for optimal A9 speed.
+
+C TODO:
+C  * Start the first multiply or multiplies directly at function entry.
+
 
 define(`rp',`r0')
 define(`up',`r1')
@@ -56,62 +72,65 @@ PROLOGUE(mpn_addmul_2)
 
        tst     n, #1
        beq     L(evn)
+
 L(odd):        ldr     r5, [rp, #0]
        ldr     u0, [up, #0]
        ldr     r4, [rp, #4]
        tst     n, #2
        beq     L(fi1)
 L(fi3):        sub     up, up, #12
-       sub     rp, rp, #16
+       sub     rp, rp, #12
        b       L(lo3)
 L(fi1):        sub     n, n, #1
        sub     up, up, #4
-       sub     rp, rp, #8
+       sub     rp, rp, #4
        b       L(lo1)
+
 L(evn):        ldr     r4, [rp, #0]
        ldr     u1, [up, #0]
        ldr     r5, [rp, #4]
        tst     n, #2
        bne     L(fi2)
 L(fi0):        sub     up, up, #8
-       sub     rp, rp, #12
+       sub     rp, rp, #8
        b       L(lo0)
 L(fi2):        subs    n, n, #2
-       sub     rp, rp, #4
        bls     L(end)
 
        ALIGN(16)
 L(top):        ldr     u0, [up, #4]
        umaal   r4, cya, u1, v0
-       str     r4, [rp, #4]
-       ldr     r4, [rp, #12]
+       str     r4, [rp, #0]
+       ldr     r4, [rp, #8]
        umaal   r5, cyb, u1, v1
 L(lo1):        ldr     u1, [up, #8]
        umaal   r5, cya, u0, v0
-       str     r5, [rp, #8]
-       ldr     r5, [rp, #16]
+       str     r5, [rp, #4]
+       ldr     r5, [rp, #12]
        umaal   r4, cyb, u0, v1
 L(lo0):        ldr     u0, [up, #12]
        umaal   r4, cya, u1, v0
-       str     r4, [rp, #12]
-       ldr     r4, [rp, #20]
+       str     r4, [rp, #8]
+       ldr     r4, [rp, #16]
        umaal   r5, cyb, u1, v1
-L(lo3):        ldr     u1, [up, #16]!
+L(lo3):        ldr     u1, [up, #16]
        umaal   r5, cya, u0, v0
-       str     r5, [rp, #16]!
-       ldr     r5, [rp, #8]
+       str     r5, [rp, #12]
+       ldr     r5, [rp, #20]
+       add     rp, rp, #16
        umaal   r4, cyb, u0, v1
+       add     up, up, #16
        subs    n, n, #4
        bhi     L(top)
 
 L(end):        umaal   r4, cya, u1, v0
        ldr     u0, [up, #4]
        umaal   r5, cyb, u1, v1
-       str     r4, [rp, #4]
+       str     r4, [rp, #0]
        umaal   r5, cya, u0, v0
        umaal   cya, cyb, u0, v1
-       str     r5, [rp, #8]
-       str     cya, [rp, #12]
+       str     r5, [rp, #4]
+       str     cya, [rp, #8]
        mov     r0, cyb
 
        pop     { r4, r5, r6, r7, r8, r9 }
diff --git a/mpn/arm/v6/addmul_3.asm b/mpn/arm/v6/addmul_3.asm
new file mode 100644 (file)
index 0000000..0465430
--- /dev/null
@@ -0,0 +1,187 @@
+dnl  ARM mpn_addmul_3.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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 StrongARM:    -
+C XScale        -
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9     2.125
+C Cortex-A15    2
+
+C TODO
+C  * Use a fast path for n <= KARATSUBA_MUL_THRESHOLD using a jump table,
+C    avoiding the current multiply.
+C  * Start the first multiply or multiplies early.
+
+define(`rp',`r0')
+define(`up',`r1')
+define(`n', `r2')
+define(`vp',`r3')
+
+define(`v0',`r4')  define(`v1',`r5')  define(`v2',`r6')
+define(`u0',`r3')  define(`u1',`r14')
+define(`w0',`r7')  define(`w1',`r8')  define(`w2',`r9')
+define(`cy0',`r10')  define(`cy1',`r11') define(`cy2',`r12')
+
+
+ASM_START()
+PROLOGUE(mpn_addmul_3)
+       push    { r4-r11, r14 }
+
+       ldr     w0, =0xaaaaaaab         C 3^{-1} mod 2^32
+       ldm     vp, { v0,v1,v2 }
+       mov     cy0, #0
+       mov     cy1, #0
+       mov     cy2, #0
+
+C Tricky n mod 6
+       mul     w0, w0, n               C n * 3^{-1} mod 2^32
+       and     w0, w0, #0xc0000001     C pseudo-CRT mod 3,2
+       sub     n, n, #3
+ifdef(`PIC',`
+       add     pc, pc, w0, ror $28
+       nop
+       b       L(b0)
+       b       L(b2)
+       b       L(b4)
+       .word   0xe7f000f0      C udf
+       b       L(b3)
+       b       L(b5)
+       b       L(b1)
+',`
+       ldr     pc, [pc, w0, ror $28]
+       nop
+       .word   L(b0), L(b2), L(b4), 0, L(b3), L(b5), L(b1)
+')
+
+L(b5): add     up, up, #-8
+       ldr     w1, [rp, #0]
+       ldr     w2, [rp, #4]
+       ldr     u1, [up, #8]
+       b       L(lo5)
+
+L(b4): add     rp, rp, #-4
+       add     up, up, #-12
+       ldr     w2, [rp, #4]
+       ldr     w0, [rp, #8]
+       ldr     u0, [up, #12]
+       b       L(lo4)
+
+L(b3): add     rp, rp, #-8
+       add     up, up, #-16
+       ldr     w0, [rp, #8]
+       ldr     w1, [rp, #12]
+       ldr     u1, [up, #16]
+       b       L(lo3)
+
+L(b1): add     rp, rp, #8
+       ldr     w2, [rp, #-8]
+       ldr     w0, [rp, #-4]
+       ldr     u1, [up, #0]
+       b       L(lo1)
+
+L(b0): add     rp, rp, #4
+       add     up, up, #-4
+       ldr     w0, [rp, #-4]
+       ldr     w1, [rp, #0]
+       ldr     u0, [up, #4]
+       b       L(lo0)
+
+L(b2): add     rp, rp, #12
+       add     up, up, #4
+       ldr     w1, [rp, #-12]
+       ldr     w2, [rp, #-8]
+       ldr     u0, [up, #-4]
+
+       ALIGN(16)
+L(top):        ldr     w0, [rp, #-4]
+       umaal   w1, cy0, u0, v0
+       ldr     u1, [up, #0]
+       umaal   w2, cy1, u0, v1
+       str     w1, [rp, #-12]
+       umaal   w0, cy2, u0, v2
+L(lo1):        ldr     w1, [rp, #0]
+       umaal   w2, cy0, u1, v0
+       ldr     u0, [up, #4]
+       umaal   w0, cy1, u1, v1
+       str     w2, [rp, #-8]
+       umaal   w1, cy2, u1, v2
+L(lo0):        ldr     w2, [rp, #4]
+       umaal   w0, cy0, u0, v0
+       ldr     u1, [up, #8]
+       umaal   w1, cy1, u0, v1
+       str     w0, [rp, #-4]
+       umaal   w2, cy2, u0, v2
+L(lo5):        ldr     w0, [rp, #8]
+       umaal   w1, cy0, u1, v0
+       ldr     u0, [up, #12]
+       umaal   w2, cy1, u1, v1
+       str     w1, [rp, #0]
+       umaal   w0, cy2, u1, v2
+L(lo4):        ldr     w1, [rp, #12]
+       umaal   w2, cy0, u0, v0
+       ldr     u1, [up, #16]
+       umaal   w0, cy1, u0, v1
+       str     w2, [rp, #4]
+       umaal   w1, cy2, u0, v2
+L(lo3):        ldr     w2, [rp, #16]
+       umaal   w0, cy0, u1, v0
+       ldr     u0, [up, #20]
+       umaal   w1, cy1, u1, v1
+       str     w0, [rp, #8]
+       umaal   w2, cy2, u1, v2
+L(lo2):        subs    n, n, #6
+       add     up, up, #24
+       add     rp, rp, #24
+       bge     L(top)
+
+L(end):        umaal   w1, cy0, u0, v0
+       ldr     u1, [up, #0]
+       umaal   w2, cy1, u0, v1
+       str     w1, [rp, #-12]
+       mov     w0, #0
+       umaal   w0, cy2, u0, v2
+       umaal   w2, cy0, u1, v0
+       umaal   w0, cy1, u1, v1
+       str     w2, [rp, #-8]
+       umaal   cy1, cy2, u1, v2
+       adds    w0, w0, cy0
+       str     w0, [rp, #-4]
+       adcs    w1, cy1, #0
+       str     w1, [rp, #0]
+       adc     r0, cy2, #0
+
+       pop     { r4-r11, pc }
+EPILOGUE()
diff --git a/mpn/arm/v6/dive_1.asm b/mpn/arm/v6/dive_1.asm
new file mode 100644 (file)
index 0000000..92de814
--- /dev/null
@@ -0,0 +1,149 @@
+dnl  ARM v6 mpn_divexact_1
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2012, 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       cycles/limb
+C               norm    unorm    modexact_1c_odd
+C StrongARM     -       -
+C XScale        -       -
+C Cortex-A7     ?       ?
+C Cortex-A8     ?       ?
+C Cortex-A9     9      10               9
+C Cortex-A15    7       7               7
+
+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(`cy',  `r7')
+define(`cnt', `r6')
+define(`tnc', `r10')
+
+ASM_START()
+PROLOGUE(mpn_divexact_1)
+       push    {r4,r5,r6,r7,r8,r9}
+
+       tst     d, #1
+
+       rsb     r4, d, #0
+       and     r4, r4, d
+       clz     r4, r4
+       rsb     cnt, r4, #31            C count_trailing_zeros
+       mov     d, d, lsr cnt
+
+C binvert limb
+       LEA(    r4, binvert_limb_table)
+       and     r12, d, #254
+       ldrb    r4, [r4, r12, lsr #1]
+       mul     r12, r4, r4
+       mul     r12, d, r12
+       rsb     r12, r12, r4, lsl #1
+       mul     r4, r12, r12
+       mul     r4, d, r4
+       rsb     r4, r4, r12, lsl #1     C r4 = inverse
+
+       ldr     r5, [up], #4            C up[0]
+       mov     cy, #0
+       rsb     r8, r4, #0              C r8 = -inverse
+       beq     L(unnorm)
+
+L(norm):
+       subs    n, n, #1
+       mul     r5, r5, r4
+       beq     L(end)
+
+       ALIGN(16)
+L(top):        ldr     r9, [up], #4
+       mov     r12, #0
+       str     r5, [rp], #4
+       umaal   r12, cy, r5, d
+       mul     r5, r9, r4
+       mla     r5, cy, r8, r5
+       subs    n, n, #1
+       bne     L(top)
+
+L(end):        str     r5, [rp]
+       pop     {r4,r5,r6,r7,r8,r9}
+       bx      r14
+
+L(unnorm):
+       push    {r10,r11}
+       rsb     tnc, cnt, #32
+       mov     r11, r5, lsr cnt
+       subs    n, n, #1
+       beq     L(edx)
+
+       ldr     r12, [up], #4
+       orr     r9, r11, r12, lsl tnc
+       mov     r11, r12, lsr cnt
+       mul     r5, r9, r4
+       subs    n, n, #1
+       beq     L(edu)
+
+       ALIGN(16)
+L(tpu):        ldr     r12, [up], #4
+       orr     r9, r11, r12, lsl tnc
+       mov     r11, r12, lsr cnt
+       mov     r12, #0
+       str     r5, [rp], #4
+       umaal   r12, cy, r5, d
+       mul     r5, r9, r4
+       mla     r5, cy, r8, r5
+       subs    n, n, #1
+       bne     L(tpu)
+
+L(edu):        str     r5, [rp], #4
+       mov     r12, #0
+       umaal   r12, cy, r5, d
+       mul     r5, r11, r4
+       mla     r5, cy, r8, r5
+       str     r5, [rp]
+       pop     {r10,r11}
+       pop     {r4,r5,r6,r7,r8,r9}
+       bx      r14
+
+L(edx):        mul     r5, r11, r4
+       str     r5, [rp]
+       pop     {r10,r11}
+       pop     {r4,r5,r6,r7,r8,r9}
+       bx      r14
+EPILOGUE()
index ae292061c569f688820cd938950df5a0b0f30e0e..c9c68517690345c16fe12e0a26dcf987f05c99be 100644 (file)
@@ -1,25 +1,36 @@
 /* gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2009, 2010, 2012 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2003, 2009, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 /* 700MHz ARM11 (raspberry pi) */
 
diff --git a/mpn/arm/v6/mode1o.asm b/mpn/arm/v6/mode1o.asm
new file mode 100644 (file)
index 0000000..a2f77a6
--- /dev/null
@@ -0,0 +1,95 @@
+dnl  ARM v6 mpn_modexact_1c_odd
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+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')
+
+C           cycles/limb
+C StrongARM     -
+C XScale        -
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9     9
+C Cortex-A15    7
+
+C Architecture requirements:
+C v5   -
+C v5t  -
+C v5te smulbb
+C v6   umaal
+C v6t2 -
+C v7a  -
+
+define(`up', `r0')
+define(`n',  `r1')
+define(`d',  `r2')
+define(`cy', `r3')
+
+       .protected      binvert_limb_table
+ASM_START()
+PROLOGUE(mpn_modexact_1c_odd)
+       stmfd   sp!, {r4, r5, r6, r7}
+
+       LEA(    r4, binvert_limb_table)
+
+       ldr     r6, [up], #4            C up[0]
+
+       and     r12, d, #254
+       ldrb    r4, [r4, r12, lsr #1]
+       smulbb  r12, r4, r4
+       mul     r12, d, r12
+       rsb     r12, r12, r4, asl #1
+       mul     r4, r12, r12
+       mul     r4, d, r4
+       rsb     r4, r4, r12, asl #1     C r4 = inverse
+
+       subs    n, n, #1
+       sub     r6, r6, cy
+       mul     r6, r6, r4
+       beq     L(end)
+
+       rsb     r5, r4, #0              C r5 = -inverse
+
+L(top):        ldr     r7, [up], #4
+       mov     r12, #0
+       umaal   r12, cy, r6, d
+       mul     r6, r7, r4
+       mla     r6, cy, r5, r6
+       subs    n, n, #1
+       bne     L(top)
+
+L(end):        mov     r12, #0
+       umaal   r12, cy, r6, d
+       mov     r0, cy
+
+       ldmfd   sp!, {r4, r5, r6, r7}
+       bx      r14
+EPILOGUE()
index 8d0c696b79cf193495b961f85bc5aae9b9b4a2bb..0fcc0e46d9b28732aaf24ef9ed093b1c412994ce 100644 (file)
@@ -3,28 +3,40 @@ dnl  ARM mpn_mul_1.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM:    -
 C XScale        -
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9     3.25
-C Cortex-A15    ?
+C Cortex-A15    4
 
 C TODO
 C  * Micro-optimise feed-in code.
index 3fdb9c6e5b701b4d30ed8878ea261d53046d4515..1679542a3c8b48a7c6d199040e726d8b2b399654 100644 (file)
@@ -1,32 +1,44 @@
 dnl  ARM mpn_mul_2.
 
-dnl  Contributed to the GNU project by Torbjorn Granlund.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C StrongARM:    -
 C XScale        -
+C Cortex-A7     ?
 C Cortex-A8     ?
 C Cortex-A9     2.25
-C Cortex-A15    ?
+C Cortex-A15    2.5
 
 C TODO
 C  * This is a trivial edit of the addmul_2 code.  Check for simplifications,
diff --git a/mpn/arm/v6/popham.asm b/mpn/arm/v6/popham.asm
new file mode 100644 (file)
index 0000000..44c8f23
--- /dev/null
@@ -0,0 +1,138 @@
+dnl  ARM mpn_popcount and mpn_hamdist.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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                   popcount         hamdist
+C                  cycles/limb     cycles/limb
+C StrongARM             -
+C XScale                -
+C Cortex-A7             ?
+C Cortex-A8             ?
+C Cortex-A9             8.94            9.47
+C Cortex-A15            5.67            6.44
+
+C Architecture requirements:
+C v5   -
+C v5t  -
+C v5te ldrd strd
+C v6   usada8
+C v6t2 -
+C v7a  -
+
+ifdef(`OPERATION_popcount',`
+  define(`func',`mpn_popcount')
+  define(`ap',         `r0')
+  define(`n',          `r1')
+  define(`a0',         `r2')
+  define(`a1',         `r3')
+  define(`s',          `r5')
+  define(`b_01010101', `r6')
+  define(`b_00110011', `r7')
+  define(`b_00001111', `r8')
+  define(`zero',       `r9')
+  define(`POPC',       `$1')
+  define(`HAMD',       `dnl')
+')
+ifdef(`OPERATION_hamdist',`
+  define(`func',`mpn_hamdist')
+  define(`ap',         `r0')
+  define(`bp',         `r1')
+  define(`n',          `r2')
+  define(`a0',         `r6')
+  define(`a1',         `r7')
+  define(`b0',         `r4')
+  define(`b1',         `r5')
+  define(`s',          `r11')
+  define(`b_01010101', `r8')
+  define(`b_00110011', `r9')
+  define(`b_00001111', `r10')
+  define(`zero',       `r3')
+  define(`POPC',       `dnl')
+  define(`HAMD',       `$1')
+')
+
+
+ASM_START()
+PROLOGUE(func)
+POPC(` push    { r4-r9 }       ')
+HAMD(` push    { r4-r11 }      ')
+
+       ldr     b_01010101, =0x55555555
+       mov     r12, #0
+       ldr     b_00110011, =0x33333333
+       mov     zero, #0
+       ldr     b_00001111, =0x0f0f0f0f
+
+       tst     n, #1
+       beq     L(evn)
+
+L(odd):        ldr     a1, [ap], #4            C 1 x 32 1-bit accumulators, 0-1
+HAMD(` ldr     b1, [bp], #4    ')      C 1 x 32 1-bit accumulators, 0-1
+HAMD(` eor     a1, a1, b1      ')
+       and     r4, b_01010101, a1, lsr #1
+       sub     a1, a1, r4
+       and     r4, a1, b_00110011
+       bic     r5, a1, b_00110011
+       add     r5, r4, r5, lsr #2      C 8 4-bit accumulators, 0-4
+       subs    n, n, #1
+       b       L(mid)
+
+L(evn):        mov     s, #0
+
+L(top):        ldrd    a0, a1, [ap], #8        C 2 x 32 1-bit accumulators, 0-1
+HAMD(` ldrd    b0, b1, [bp], #8')
+HAMD(` eor     a0, a0, b0      ')
+HAMD(` eor     a1, a1, b1      ')
+       subs    n, n, #2
+       usada8  r12, s, zero, r12
+       and     r4, b_01010101, a0, lsr #1
+       sub     a0, a0, r4
+       and     r4, b_01010101, a1, lsr #1
+       sub     a1, a1, r4
+       and     r4, a0, b_00110011
+       bic     r5, a0, b_00110011
+       add     a0, r4, r5, lsr #2      C 8 4-bit accumulators, 0-4
+       and     r4, a1, b_00110011
+       bic     r5, a1, b_00110011
+       add     a1, r4, r5, lsr #2      C 8 4-bit accumulators, 0-4
+       add     r5, a0, a1              C 8 4-bit accumulators, 0-8
+L(mid):        and     r4, r5, b_00001111
+       bic     r5, r5, b_00001111
+       add     s, r4, r5, lsr #4       C 4 8-bit accumulators
+       bne     L(top)
+
+       usada8  r0, s, zero, r12
+POPC(` pop     { r4-r9 }       ')
+HAMD(` pop     { r4-r11 }      ')
+       bx      r14
+EPILOGUE()
index e1dc478aa1cf38c554b5eca541c64db1f7c8815e..d52970aaa7db8d4348d0fe0abcc32f3e0543696c 100644 (file)
@@ -1,23 +1,34 @@
 dnl  ARM v6 mpn_sqr_basecase.
 
-dnl  Contributed to the GNU project by Torbjorn Granlund.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
-dnl  Copyright 2012 Free Software Foundation, Inc.
+dnl  Copyright 2012, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -52,7 +63,7 @@ C  * Optimise sqr_diag_addlsh1 loop.  (This could save O(n) cycles.)
 C  * Implement larger final corners (xit/tix).  Also stop loops earlier
 C    suppressing writes of upper-most rp[] values.  (This could save 10-20
 C    cycles for n > 4.)
-C  * Is the branch really faster than discrete branches?
+C  * Is the branch table really faster than discrete branches?
 
 define(`rp',      r0)
 define(`up',      r1)
@@ -396,6 +407,7 @@ L(sqr_diag_addlsh1):
        ldr     r3, [up], #4
        umull   w1, r5, r3, r3
        mov     w2, #0
+       mov     r10, #0
 C      cmn     r0, #0                  C clear cy (already clear by luck)
        b       L(lm)
 
@@ -409,8 +421,7 @@ L(lm):      ldr     w0, [rp, #4]
        adcs    w0, w0, w0
        ldr     r3, [up], #4
        adcs    w1, w1, w1
-       mov     w2, #0
-       adc     w2, w2, w2
+       adc     w2, r10, r10
        umull   r4, r5, r3, r3
        subs    n, n, #1
        bne     L(tsd)
diff --git a/mpn/arm/v6/submul_1.asm b/mpn/arm/v6/submul_1.asm
new file mode 100644 (file)
index 0000000..8a21733
--- /dev/null
@@ -0,0 +1,125 @@
+dnl  ARM mpn_submul_1.
+
+dnl  Copyright 2012, 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 StrongARM:    -
+C XScale        -
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9     3.75
+C Cortex-A15    4.0
+
+C This loop complements U on the fly,
+C   U' = B^n - 1 - U
+C and then uses that
+C   R - U*v = R + U'*v + v - B^n v
+
+C TODO
+C  * Micro-optimise feed-in code.
+C  * Optimise for n=1,2 by delaying register saving.
+C  * Try using ldm/stm.
+
+define(`rp',`r0')
+define(`up',`r1')
+define(`n', `r2')
+define(`v0',`r3')
+
+ASM_START()
+PROLOGUE(mpn_submul_1)
+       stmfd   sp!, { r4, r5, r6, r7 }
+
+       ands    r6, n, #3
+       mov     r12, v0
+       beq     L(fi0)
+       cmp     r6, #2
+       bcc     L(fi1)
+       beq     L(fi2)
+
+L(fi3):        ldr     r4, [up], #12
+       mvn     r4, r4
+       ldr     r6, [rp, #0]
+       ldr     r5, [up, #-8]
+       b       L(lo3)
+
+L(fi0):        ldr     r5, [up], #16
+       mvn     r5, r5
+       ldr     r7, [rp], #4
+       ldr     r4, [up, #-12]
+       b       L(lo0)
+
+L(fi1):        ldr     r4, [up], #4
+       mvn     r4, r4
+       ldr     r6, [rp], #8
+       subs    n, n, #1
+       beq     L(1)
+       ldr     r5, [up]
+       b       L(lo1)
+
+L(fi2):        ldr     r5, [up], #8
+       mvn     r5, r5
+       ldr     r7, [rp], #12
+       ldr     r4, [up, #-4]
+       b       L(lo2)
+
+       ALIGN(16)
+L(top):        ldr     r6, [rp, #-8]
+       ldr     r5, [up]
+       str     r7, [rp, #-12]
+L(lo1):        umaal   r6, r12, r4, v0
+       add     up, up, #16
+       mvn     r5, r5
+       ldr     r7, [rp, #-4]
+       ldr     r4, [up, #-12]
+       str     r6, [rp, #-8]
+L(lo0):        umaal   r7, r12, r5, v0
+       mvn     r4, r4
+       ldr     r6, [rp, #0]
+       ldr     r5, [up, #-8]
+       str     r7, [rp, #-4]
+L(lo3):        umaal   r6, r12, r4, v0
+       mvn     r5, r5
+       ldr     r7, [rp, #4]
+       ldr     r4, [up, #-4]
+       str     r6, [rp], #16
+L(lo2):        umaal   r7, r12, r5, v0
+       mvn     r4, r4
+       subs    n, n, #4
+       bhi     L(top)
+
+       ldr     r6, [rp, #-8]
+       str     r7, [rp, #-12]
+L(1):  umaal   r6, r12, r4, v0
+       str     r6, [rp, #-8]
+       sub     r0, v0, r12
+       ldmfd   sp!, { r4, r5, r6, r7 }
+       bx      lr
+EPILOGUE()
index 5dca9040233eaa870857944ef277f40e4b7498ef..be24615acbbebefa2e08c195f1bc1f1b296a529d 100644 (file)
@@ -1,32 +1,44 @@
 dnl  ARM v6t2 mpn_divrem_1 and mpn_preinv_divrem_1.
 
-dnl  Contributed to the GNU project by Torbjorn Granlund.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C              norm    unorm   frac
-C StrongARM     ?
-C XScale        ?
-C Cortex-A8     ?
-C Cortex-A9     13      14      13
-C Cortex-A15    ?
+C StrongARM     -       -       -
+C XScale        -       -       -
+C Cortex-A7     ?       ?       ?
+C Cortex-A8     ?       ?       ?
+C Cortex-A9    13      14      13
+C Cortex-A15   11.4    11.8    11.1
 
 C TODO
 C  * Optimise inner-loops better, they could likely run a cycle or two faster.
index 0c1e385aaab9361191502e9a39b9efcdd5ecc8c4..20636479630d6f09ab2e45fd7a7b739edad9c9d8 100644 (file)
@@ -1,38 +1,50 @@
 dnl  ARM v6t2 mpn_gcd_1.
 
-dnl  Based on the K7 gcd_1.asm, by Kevin Ryde.  Rehacked for ARM by Torbjorn
+dnl  Based on the K7 gcd_1.asm, by Kevin Ryde.  Rehacked for ARM by Torbjörn
 dnl  Granlund.
 
-dnl  Copyright 2000, 2001, 2002, 2005, 2009, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/bit (approx)
-C StrongARM     ?
-C XScale        ?
+C StrongARM     -
+C XScale        -
+C Cortex-A7     ?
 C Cortex-A8     ?
-C Cortex-A9     5.30
-C Cortex-A15    ?
+C Cortex-A9     5.3
+C Cortex-A15    3.5
 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).
@@ -59,7 +71,7 @@ PROLOGUE(mpn_gcd_1)
 
        rbit    r12, v0
        clz     r12, r12
-       lsr     v0, v0, r12
+       mov     v0, v0, lsr r12
 
        mov     r7, v0
 
@@ -90,7 +102,7 @@ L(red1):cmp  r3, #0
        ALIGN(8)
 L(top):        movcs   r3, r1          C if x-y < 0
        movcs   r7, r0          C use x,y-x
-L(mid):        lsr     r3, r3, r12     C
+L(mid):        mov     r3, r3, lsr r12 C
        mov     r0, r3          C
        subs    r1, r7, r3      C
        rsb     r3, r7, r3      C
@@ -98,6 +110,6 @@ L(mid):      lsr     r3, r3, r12     C
        clz     r12, r12        C
        bne     L(top)          C
 
-L(end):        lsl     r0, r7, r4
+L(end):        mov     r0, r7, lsl r4
        pop     {r4, r7, pc}
 EPILOGUE()
diff --git a/mpn/arm/v6t2/mode1o.asm b/mpn/arm/v6t2/mode1o.asm
deleted file mode 100644 (file)
index 81b9520..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-dnl  ARM mpn_modexact_1c_odd
-
-dnl  Contributed to the GNU project by Torbjorn Granlund.
-
-dnl  Copyright 2012 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 StrongARM     ?
-C XScale        ?
-C Cortex-A8     ?
-C Cortex-A9     9
-C Cortex-A15    ?
-
-define(`up', `r0')
-define(`n',  `r1')
-define(`d',  `r2')
-define(`cy', `r3')
-
-       .protected      binvert_limb_table
-ASM_START()
-PROLOGUE(mpn_modexact_1c_odd)
-       stmfd   sp!, {r4, r5, r6, r7}
-
-       LEA(    r4, binvert_limb_table)
-
-       ldr     r6, [up], #4            C up[0]
-
-       ubfx    r12, d, #1, #7
-       ldrb    r4, [r4, r12]
-       smulbb  r12, r4, r4
-       mul     r12, d, r12
-       rsb     r12, r12, r4, asl #1
-       mul     r4, r12, r12
-       mul     r4, d, r4
-       rsb     r4, r4, r12, asl #1     C r4 = inverse
-
-       subs    n, n, #1
-       sub     r6, r6, cy
-       mul     r6, r6, r4
-       beq     L(end)
-
-       rsb     r5, r4, #0              C r5 = -inverse
-
-L(top):        ldr     r7, [up], #4
-       mov     r12, #0
-       umaal   r12, cy, r6, d
-       mul     r6, r7, r4
-       mla     r6, cy, r5, r6
-       subs    n, n, #1
-       bne     L(top)
-
-L(end):        mov     r12, #0
-       umaal   r12, cy, r6, d
-       mov     r0, cy
-
-       ldmfd   sp!, {r4, r5, r6, r7}
-       bx      r14
-EPILOGUE()
diff --git a/mpn/arm/v7a/cora15/addmul_1.asm b/mpn/arm/v7a/cora15/addmul_1.asm
new file mode 100644 (file)
index 0000000..c2277b3
--- /dev/null
@@ -0,0 +1,145 @@
+dnl  ARM mpn_addmul_1 optimised for A15.
+
+dnl  Copyright 2012, 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                best
+C StrongARM:     -
+C XScale        ?
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9     6                      3.25
+C Cortex-A15    2                      this
+
+C This code uses umlal for adding in the rp[] data, keeping the recurrency path
+C separate from any multiply instructions.  It performs well on A15, at umlal's
+C bandwidth.
+C
+C An A9 variant should perhaps stick to 3-way unrolling, and use ldm and stm
+C for all loads and stores.  Alternatively, it could do 2-way or 4-way, but
+C then alignment aware code will be necessary (adding O(1) bookkeeping
+C overhead).
+C
+C We don't use r12 due to ldrd and strd limitations.
+
+C Architecture requirements:
+C v5   -
+C v5t  -
+C v5te ldrd strd
+C v6   -
+C v6t2 -
+C v7a  -
+
+define(`rp', `r0')
+define(`up', `r1')
+define(`n',  `r2')
+define(`v0', `r3')
+
+define(`w0', `r10') define(`w1', `r11')
+define(`u0', `r8')  define(`u1', `r9')
+
+ASM_START()
+PROLOGUE(mpn_addmul_1)
+       push    { r4-r11 }
+
+       ands    r6, n, #3
+       sub     n, n, #3
+       beq     L(b00)
+       cmp     r6, #2
+       bcc     L(b01)
+       beq     L(b10)
+
+L(b11):        mov     r6, #0
+       cmn     r13, #0                 C carry clear
+       ldr     u1, [up], #-4
+       ldr     w1, [rp], #-4
+       mov     r7, #0
+       b       L(mid)
+
+L(b00):        ldrd    u0, u1, [up]
+       ldrd    w0, w1, [rp]
+       mov     r6, #0
+       umlal   w0, r6, u0, v0
+       cmn     r13, #0                 C carry clear
+       mov     r7, #0
+       str     w0, [rp]
+       b       L(mid)
+
+L(b10):        ldrd    u0, u1, [up], #8
+       ldrd    w0, w1, [rp]
+       mov     r4, #0
+       umlal   w0, r4, u0, v0
+       cmn     r13, #0                 C carry clear
+       mov     r5, #0
+       str     w0, [rp], #8
+       umlal   w1, r5, u1, v0
+       tst     n, n
+       bmi     L(end)
+       b       L(top)
+
+L(b01):        mov     r4, #0
+       ldr     u1, [up], #4
+       ldr     w1, [rp], #4
+       mov     r5, #0
+       umlal   w1, r5, u1, v0
+       tst     n, n
+       bmi     L(end)
+
+       ALIGN(16)
+L(top):        ldrd    u0, u1, [up, #0]
+       adcs    r4, r4, w1
+       ldrd    w0, w1, [rp, #0]
+       mov     r6, #0
+       umlal   w0, r6, u0, v0          C 1 2
+       adcs    r5, r5, w0
+       mov     r7, #0
+       strd    r4, r5, [rp, #-4]
+L(mid):        umlal   w1, r7, u1, v0          C 2 3
+       ldrd    u0, u1, [up, #8]
+       adcs    r6, r6, w1
+       ldrd    w0, w1, [rp, #8]
+       mov     r4, #0
+       umlal   w0, r4, u0, v0          C 3 4
+       adcs    r7, r7, w0
+       mov     r5, #0
+       strd    r6, r7, [rp, #4]
+       umlal   w1, r5, u1, v0          C 0 1
+       sub     n, n, #4
+       add     up, up, #16
+       add     rp, rp, #16
+       tst     n, n
+       bpl     L(top)
+
+L(end):        adcs    r4, r4, w1
+       str     r4, [rp, #-4]
+       adc     r0, r5, #0
+       pop     { r4-r11 }
+       bx      r14
+EPILOGUE()
diff --git a/mpn/arm/v7a/cora15/aors_n.asm b/mpn/arm/v7a/cora15/aors_n.asm
new file mode 100644 (file)
index 0000000..dc3f839
--- /dev/null
@@ -0,0 +1,162 @@
+dnl  ARM mpn_add_n/mpn_sub_n optimised for A15.
+
+dnl  Copyright 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                best
+C StrongARM:     -
+C XScale        ?
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9     3.55                   2.5
+C Cortex-A15    1.27                   this
+
+C This was a major improvement compared to the code we had before, but it might
+C not be the best 8-way code possible.  We've tried some permutations of auto-
+C increments and separate pointer updates, but they all ran at the same speed
+C on A15.
+
+C Architecture requirements:
+C v5   -
+C v5t  -
+C v5te ldrd strd
+C v6   -
+C v6t2 -
+C v7a  -
+
+define(`rp', `r0')
+define(`up', `r1')
+define(`vp', `r2')
+define(`n',  `r3')
+
+ifdef(`OPERATION_add_n', `
+  define(`ADDSUBC',    adcs)
+  define(`IFADD',      `$1')
+  define(`SETCY',      `cmp    $1, #1')
+  define(`RETVAL',     `adc    r0, n, #0')
+  define(`RETVAL2',    `adc    r0, n, #1')
+  define(`func',       mpn_add_n)
+  define(`func_nc',    mpn_add_nc)')
+ifdef(`OPERATION_sub_n', `
+  define(`ADDSUBC',    sbcs)
+  define(`IFADD',      `')
+  define(`SETCY',      `rsbs   $1, $1, #0')
+  define(`RETVAL',     `sbc    r0, r0, r0
+                       and     r0, r0, #1')
+  define(`RETVAL2',    `RETVAL')
+  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)
+
+ASM_START()
+PROLOGUE(func_nc)
+       ldr     r12, [sp]
+       b       L(ent)
+EPILOGUE()
+PROLOGUE(func)
+       mov     r12, #0
+L(ent):        push    { r4-r9 }
+
+       ands    r6, n, #3
+       mov     n, n, lsr #2
+       beq     L(b00)
+       cmp     r6, #2
+       bcc     L(b01)
+       beq     L(b10)
+
+L(b11):        ldr     r5, [up], #4
+       ldr     r7, [vp], #4
+       SETCY(  r12)
+       ADDSUBC r9, r5, r7
+       ldrd    r4, r5, [up, #0]
+       ldrd    r6, r7, [vp, #0]
+       str     r9, [rp], #-4
+       b       L(lo)
+
+L(b00):        ldrd    r4, r5, [up], #-8
+       ldrd    r6, r7, [vp], #-8
+       SETCY(  r12)
+       sub     rp, rp, #16
+       b       L(mid)
+
+L(b01):        ldr     r5, [up], #-4
+       ldr     r7, [vp], #-4
+       SETCY(  r12)
+       ADDSUBC r9, r5, r7
+       str     r9, [rp], #-12
+       tst     n, n
+       beq     L(wd1)
+L(gt1):        ldrd    r4, r5, [up, #8]
+       ldrd    r6, r7, [vp, #8]
+       b       L(mid)
+
+L(b10):        ldrd    r4, r5, [up]
+       ldrd    r6, r7, [vp]
+       SETCY(  r12)
+       sub     rp, rp, #8
+       b       L(lo)
+
+       ALIGN(16)
+L(top):        ldrd    r4, r5, [up, #8]
+       ldrd    r6, r7, [vp, #8]
+       strd    r8, r9, [rp, #8]
+L(mid):        ADDSUBC r8, r4, r6
+       ADDSUBC r9, r5, r7
+       ldrd    r4, r5, [up, #16]
+       ldrd    r6, r7, [vp, #16]
+       strd    r8, r9, [rp, #16]
+       ADDSUBC r8, r4, r6
+       ADDSUBC r9, r5, r7
+       sub     n, n, #2
+       tst     n, n
+       bmi     L(dne)
+       ldrd    r4, r5, [up, #24]
+       ldrd    r6, r7, [vp, #24]
+       strd    r8, r9, [rp, #24]
+       ADDSUBC r8, r4, r6
+       ADDSUBC r9, r5, r7
+       ldrd    r4, r5, [up, #32]!
+       ldrd    r6, r7, [vp, #32]!
+       strd    r8, r9, [rp, #32]!
+L(lo): ADDSUBC r8, r4, r6
+       ADDSUBC r9, r5, r7
+       tst     n, n
+       bne     L(top)
+
+L(end):        strd    r8, r9, [rp, #8]
+L(wd1):        RETVAL
+       pop     { r4-r9 }
+       bx      r14
+L(dne):        strd    r8, r9, [rp, #24]
+       RETVAL2
+       pop     { r4-r9 }
+       bx      r14
+EPILOGUE()
diff --git a/mpn/arm/v7a/cora15/cnd_aors_n.asm b/mpn/arm/v7a/cora15/cnd_aors_n.asm
new file mode 100644 (file)
index 0000000..b9e5cd3
--- /dev/null
@@ -0,0 +1,158 @@
+dnl  ARM mpn_cnd_add_n/mpn_cnd_sub_n optimised for A15.
+
+dnl  Copyright 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                best
+C StrongARM:     -
+C XScale        ?
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9     3.75                    3
+C Cortex-A15    1.78                   this
+
+C This code does not run as well as one could have hoped, since 1.5 c/l seems
+C realistic for this insn mix.
+
+C Architecture requirements:
+C v5   -
+C v5t  -
+C v5te ldrd strd
+C v6   -
+C v6t2 -
+C v7a  -
+
+define(`cnd',`r0')
+define(`rp', `r1')
+define(`up', `r2')
+define(`vp', `r3')
+define(`n',  `r12')
+
+ifdef(`OPERATION_cnd_add_n', `
+  define(`ADDSUB',     adds)
+  define(`ADDSUBC',    adcs)
+  define(`IFADD',      `$1')
+  define(`INITCY',      `cmn   r0, #0')
+  define(`RETVAL',     `adc    r0, n, #0')
+  define(`RETVAL2',    `adc    r0, n, #1')
+  define(`func',       mpn_cnd_add_n)
+  define(`func_nc',    mpn_add_nc)')
+ifdef(`OPERATION_cnd_sub_n', `
+  define(`ADDSUB',     subs)
+  define(`ADDSUBC',    sbcs)
+  define(`IFADD',      `')
+  define(`INITCY',      `cmp   r0, #0')
+  define(`RETVAL',     `sbc    r0, r0, r0
+                       and     r0, r0, #1')
+  define(`RETVAL2',    `RETVAL')
+  define(`func',       mpn_cnd_sub_n)
+  define(`func_nc',    mpn_sub_nc)')
+
+MULFUNC_PROLOGUE(mpn_cnd_add_n mpn_cnd_sub_n)
+
+ASM_START()
+PROLOGUE(func)
+       ldr     n, [sp]
+       push    { r4-r9 }
+
+       cmp     cnd, #1
+       sbc     cnd, cnd, cnd           C conditionally set to 0xffffffff
+
+       ands    r6, n, #3
+       mov     n, n, lsr #2
+       beq     L(b00)
+       cmp     r6, #2
+       bcc     L(b01)
+       beq     L(b10)
+
+L(b11):        ldr     r5, [up], #4
+       ldr     r7, [vp], #4
+       bic     r7, r7, cnd
+       ADDSUB  r9, r5, r7
+       ldrd    r4, r5, [up, #0]
+       ldrd    r6, r7, [vp, #0]
+       bic     r6, r6, cnd
+       bic     r7, r7, cnd
+       str     r9, [rp], #-4
+       b       L(lo)
+
+L(b00):        ldrd    r4, r5, [up], #-8
+       ldrd    r6, r7, [vp], #-8
+       bic     r6, r6, cnd
+       bic     r7, r7, cnd
+       INITCY
+       sub     rp, rp, #16
+       b       L(mid)
+
+L(b01):        ldr     r5, [up], #-4
+       ldr     r7, [vp], #-4
+       bic     r7, r7, cnd
+       ADDSUB  r9, r5, r7
+       str     r9, [rp], #-12
+       tst     n, n
+       beq     L(wd1)
+L(gt1):        ldrd    r4, r5, [up, #8]
+       ldrd    r6, r7, [vp, #8]
+       bic     r6, r6, cnd
+       bic     r7, r7, cnd
+       b       L(mid)
+
+L(b10):        ldrd    r4, r5, [up]
+       ldrd    r6, r7, [vp]
+       bic     r6, r6, cnd
+       bic     r7, r7, cnd
+       INITCY
+       sub     rp, rp, #8
+       b       L(lo)
+
+       ALIGN(16)
+L(top):        ldrd    r6, r7, [vp, #8]
+       ldrd    r4, r5, [up, #8]
+       bic     r6, r6, cnd
+       bic     r7, r7, cnd
+       strd    r8, r9, [rp, #8]
+L(mid):        ADDSUBC r8, r4, r6
+       ADDSUBC r9, r5, r7
+       ldrd    r6, r7, [vp, #16]!
+       ldrd    r4, r5, [up, #16]!
+       bic     r6, r6, cnd
+       bic     r7, r7, cnd
+       sub     n, n, #1
+       strd    r8, r9, [rp, #16]!
+L(lo): ADDSUBC r8, r4, r6
+       ADDSUBC r9, r5, r7
+       tst     n, n
+       bne     L(top)
+
+L(end):        strd    r8, r9, [rp, #8]
+L(wd1):        RETVAL
+       pop     { r4-r9 }
+       bx      r14
+EPILOGUE()
diff --git a/mpn/arm/v7a/cora15/com.asm b/mpn/arm/v7a/cora15/com.asm
new file mode 100644 (file)
index 0000000..a258afe
--- /dev/null
@@ -0,0 +1,180 @@
+dnl  ARM mpn_com optimised for A15.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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 StrongARM     ?
+C XScale        ?
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9    2.5
+C Cortex-A15   1.0
+
+C This is great A15 core register code, but it is a bit large.
+C We use FEEDIN_VARIANT 1 to save some space, but use 8-way unrolling.
+
+C Architecture requirements:
+C v5   -
+C v5t  -
+C v5te ldrd strd
+C v6   -
+C v6t2 -
+C v7a  -
+
+define(`FEEDIN_VARIANT', 1)    C alternatives: 0 1 2
+define(`UNROLL', 4x2)          C alternatives: 4 4x2
+
+define(`rp', `r0')
+define(`up', `r1')
+define(`n',  `r2')
+
+ASM_START()
+PROLOGUE(mpn_com)
+       push    { r4-r5,r8-r9 }
+
+ifelse(FEEDIN_VARIANT,0,`
+       ands    r12, n, #3
+       mov     n, n, lsr #2
+       beq     L(b00a)
+       tst     r12, #1
+       beq     L(bx0)
+       ldr     r5, [up], #4
+       mvn     r9, r5
+       str     r9, [rp], #4
+       tst     r12, #2
+       beq     L(b00)
+L(bx0):        ldrd    r4, r5, [up, #0]
+       sub     rp, rp, #8
+       b       L(lo)
+L(b00):        tst     n, n
+       beq     L(wd1)
+L(b00a):ldrd   r4, r5, [up], #-8
+       sub     rp, rp, #16
+       b       L(mid)
+')
+ifelse(FEEDIN_VARIANT,1,`
+       and     r12, n, #3
+       mov     n, n, lsr #2
+       tst     r12, #1
+       beq     L(bx0)
+       ldr     r5, [up], #4
+       mvn     r9, r5
+       str     r9, [rp], #4
+L(bx0):        tst     r12, #2
+       beq     L(b00)
+       ldrd    r4, r5, [up, #0]
+       sub     rp, rp, #8
+       b       L(lo)
+L(b00):        tst     n, n
+       beq     L(wd1)
+       ldrd    r4, r5, [up], #-8
+       sub     rp, rp, #16
+       b       L(mid)
+')
+ifelse(FEEDIN_VARIANT,2,`
+       ands    r12, n, #3
+       mov     n, n, lsr #2
+       beq     L(b00)
+       cmp     r12, #2
+       bcc     L(b01)
+       beq     L(b10)
+
+L(b11):        ldr     r5, [up], #4
+       mvn     r9, r5
+       ldrd    r4, r5, [up, #0]
+       str     r9, [rp], #-4
+       b       L(lo)
+
+L(b00):        ldrd    r4, r5, [up], #-8
+       sub     rp, rp, #16
+       b       L(mid)
+
+L(b01):        ldr     r5, [up], #-4
+       mvn     r9, r5
+       str     r9, [rp], #-12
+       tst     n, n
+       beq     L(wd1)
+L(gt1):        ldrd    r4, r5, [up, #8]
+       b       L(mid)
+
+L(b10):        ldrd    r4, r5, [up]
+       sub     rp, rp, #8
+       b       L(lo)
+')
+       ALIGN(16)
+ifelse(UNROLL,4,`
+L(top):        ldrd    r4, r5, [up, #8]
+       strd    r8, r9, [rp, #8]
+L(mid):        mvn     r8, r4
+       mvn     r9, r5
+       ldrd    r4, r5, [up, #16]!
+       strd    r8, r9, [rp, #16]!
+       sub     n, n, #1
+L(lo): mvn     r8, r4
+       mvn     r9, r5
+       tst     n, n
+       bne     L(top)
+')
+ifelse(UNROLL,4x2,`
+L(top):        ldrd    r4, r5, [up, #8]
+       strd    r8, r9, [rp, #8]
+L(mid):        mvn     r8, r4
+       mvn     r9, r5
+       ldrd    r4, r5, [up, #16]
+       strd    r8, r9, [rp, #16]
+       mvn     r8, r4
+       mvn     r9, r5
+       sub     n, n, #2
+       tst     n, n
+       bmi     L(dne)
+       ldrd    r4, r5, [up, #24]
+       strd    r8, r9, [rp, #24]
+       mvn     r8, r4
+       mvn     r9, r5
+       ldrd    r4, r5, [up, #32]!
+       strd    r8, r9, [rp, #32]!
+L(lo): mvn     r8, r4
+       mvn     r9, r5
+       tst     n, n
+       bne     L(top)
+')
+
+L(end):        strd    r8, r9, [rp, #8]
+L(wd1):        pop     { r4-r5,r8-r9 }
+       bx      r14
+ifelse(UNROLL,4x2,`
+L(dne):        strd    r8, r9, [rp, #24]
+       pop     { r4-r5,r8-r9 }
+       bx      r14
+')
+EPILOGUE()
index bfb591084f11a4062c513c7190d06474f30fb1ef..2a06532b3eb29c4e5a0b5c94806b6f7c65c114d2 100644 (file)
@@ -1,27 +1,40 @@
 /* gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2009, 2010, 2012 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2003, 2009, 2010, 2012-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
-/* 1700MHz Cortex-A15 */
+/* 1700MHz Cortex-A15 with Neon (in spite of file position) */
+/* FFT tuning limit = 25000000 */
+/* Generated by tuneup.c, 2014-03-12, gcc 4.6 */
 
 #define MOD_1_NORM_THRESHOLD                 0  /* always */
 #define MOD_1_UNNORM_THRESHOLD               0  /* always */
@@ -31,137 +44,154 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #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_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 DIVEXACT_1_THRESHOLD                 0  /* always (native) */
 #define BMOD_1_TO_MOD_1_THRESHOLD           15
 
-#define MUL_TOOM22_THRESHOLD                31
-#define MUL_TOOM33_THRESHOLD               109
-#define MUL_TOOM44_THRESHOLD               288
-#define MUL_TOOM6H_THRESHOLD               632
-#define MUL_TOOM8H_THRESHOLD                 0  /* always */
+#define MUL_TOOM22_THRESHOLD                23
+#define MUL_TOOM33_THRESHOLD                90
+#define MUL_TOOM44_THRESHOLD               262
+#define MUL_TOOM6H_THRESHOLD               351
+#define MUL_TOOM8H_THRESHOLD               557
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD     113
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     199
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD     189
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD     211
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD     287
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD      90
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD     160
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD      89
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD     169
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     130
 
 #define SQR_BASECASE_THRESHOLD               0  /* always (native) */
-#define SQR_TOOM2_THRESHOLD                 51
-#define SQR_TOOM3_THRESHOLD                169
-#define SQR_TOOM4_THRESHOLD                662
-#define SQR_TOOM6_THRESHOLD                951
-#define SQR_TOOM8_THRESHOLD               1005
+#define SQR_TOOM2_THRESHOLD                 43
+#define SQR_TOOM3_THRESHOLD                138
+#define SQR_TOOM4_THRESHOLD                363
+#define SQR_TOOM6_THRESHOLD                517
+#define SQR_TOOM8_THRESHOLD                725
 
-#define MULMID_TOOM42_THRESHOLD             44
+#define MULMID_TOOM42_THRESHOLD             52
 
 #define MULMOD_BNM1_THRESHOLD               17
-#define SQRMOD_BNM1_THRESHOLD               30
+#define SQRMOD_BNM1_THRESHOLD               23
 
-#define MUL_FFT_MODF_THRESHOLD             525  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             550  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    505, 5}, {     27, 6}, {     28, 7}, {     15, 6}, \
-    {     33, 7}, {     17, 6}, {     35, 7}, {     19, 6}, \
-    {     41, 7}, {     21, 8}, {     11, 7}, {     23, 6}, \
-    {     47, 7}, {     27, 8}, {     15, 7}, {     35, 8}, \
+  { {    550, 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}, \
-    {     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}, {    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}, \
-    {     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}, {    351,11}, {    191,10}, {    383, 9}, \
-    {    767,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,10}, {   1215,12}, \
-    {    319,11}, {    735,12}, {    383,11}, {    799,10}, \
-    {   1599,11}, {    831,12}, {    447,11}, {    959,13}, \
-    {    255,12}, {    511,11}, {   1087,12}, {    575,11}, \
-    {   1215,12}, {    703,13}, {    383,12}, {    959,14}, \
-    {    255,13}, {    511,12}, {   1215,13}, {   8192,14}, \
-    {  16384,15}, {  32768,16} }
-#define MUL_FFT_TABLE3_SIZE 110
+    {     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}, {    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, 9}, {    383,10}, \
+    {    207,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,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,10}, \
+    {    831,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}, {    831,12}, {    447,11}, {    895,13}, \
+    {    255,12}, {    511,11}, {   1023,12}, {    575,11}, \
+    {   1151,12}, {    639,11}, {   1279,12}, {    703,13}, \
+    {    383,12}, {    767,11}, {   1599,12}, {    831,11}, \
+    {   1663,12}, {    895,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,14}, {    767,13}, \
+    {   1535,12}, {   3071,15}, {    511,14}, {   1023,13}, \
+    {   2175,14}, {   1279,13}, {   2559,12}, {   5119,13}, \
+    {   2815,12}, {   5631,13}, {   2943,14}, {  16384,15}, \
+    {  32768,16} }
+#define MUL_FFT_TABLE3_SIZE 137
 #define MUL_FFT_THRESHOLD                 5760
 
-#define SQR_FFT_MODF_THRESHOLD             535  /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD             525  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    535, 5}, {     27, 6}, {     16, 5}, {     33, 6}, \
-    {     29, 7}, {     15, 6}, {     33, 7}, {     17, 6}, \
-    {     35, 7}, {     19, 6}, {     41, 7}, {     21, 6}, \
-    {     43, 8}, {     11, 6}, {     45, 7}, {     23, 6}, \
-    {     47, 7}, {     25, 6}, {     51, 7}, {     27, 6}, \
-    {     55, 7}, {     29, 8}, {     15, 7}, {     35, 8}, \
-    {     19, 7}, {     43, 8}, {     23, 7}, {     51, 8}, \
-    {     27, 9}, {     15, 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}, {     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}, {    319, 9}, \
-    {    639,10}, {    335,11}, {    191,10}, {    383, 9}, \
-    {    767,10}, {    415,12}, {    127,11}, {    255,10}, \
-    {    511,11}, {    287,10}, {    607,11}, {    319,10}, \
-    {    639,12}, {    191,11}, {    383,10}, {    767,11}, \
-    {    415,13}, {    127,12}, {    255,11}, {    543,10}, \
-    {   1087,11}, {    607,10}, {   1215,12}, {    319,11}, \
-    {    735,12}, {    383,11}, {    831,12}, {    447,11}, \
-    {    959,13}, {    255,12}, {    511,11}, {   1087,12}, \
-    {    575,11}, {   1215,12}, {    703,13}, {    383,12}, \
-    {    959,14}, {    255,13}, {    511,12}, {   1215,13}, \
-    {   8192,14}, {  16384,15}, {  32768,16} }
-#define SQR_FFT_TABLE3_SIZE 111
-#define SQR_FFT_THRESHOLD                 4928
-
-#define MULLO_BASECASE_THRESHOLD             0  /* always */
-#define MULLO_DC_THRESHOLD                  27
-#define MULLO_MUL_N_THRESHOLD             8907
-
-#define DC_DIV_QR_THRESHOLD                 31
-#define DC_DIVAPPR_Q_THRESHOLD              45
-#define DC_BDIV_QR_THRESHOLD                29
-#define DC_BDIV_Q_THRESHOLD                 50
-
-#define INV_MULMOD_BNM1_THRESHOLD           66
-#define INV_NEWTON_THRESHOLD               171
-#define INV_APPR_THRESHOLD                  65
-
-#define BINV_NEWTON_THRESHOLD              300
-#define REDC_1_TO_REDC_2_THRESHOLD          12
-#define REDC_2_TO_REDC_N_THRESHOLD          99
-
-#define MU_DIV_QR_THRESHOLD               1895
-#define MU_DIVAPPR_Q_THRESHOLD            1895
-#define MUPI_DIV_QR_THRESHOLD               54
-#define MU_BDIV_QR_THRESHOLD              1470
-#define MU_BDIV_Q_THRESHOLD               1895
-
-#define POWM_SEC_TABLE  6,44,548,1604
+  { {    525, 5}, {     25, 6}, {     27, 7}, {     15, 6}, \
+    {     32, 7}, {     17, 6}, {     35, 7}, {     19, 6}, \
+    {     39, 7}, {     25, 6}, {     51, 7}, {     27, 8}, \
+    {     15, 7}, {     35, 8}, {     19, 7}, {     41, 8}, \
+    {     23, 7}, {     51, 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}, {    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}, {    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,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}, {    543,10}, {   1087,11}, \
+    {    607,12}, {    319,11}, {    671,10}, {   1343,11}, \
+    {    735,12}, {    383,11}, {    799,10}, {   1599,11}, \
+    {    831,12}, {    447,11}, {    895,12}, {    511,11}, \
+    {   1023,12}, {    575,11}, {   1151,12}, {    639,11}, \
+    {   1343,12}, {    703,13}, {    383,12}, {    767,11}, \
+    {   1599,12}, {    831,11}, {   1663,12}, {    895,13}, \
+    {    511,12}, {   1087,13}, {    639,12}, {   1407,13}, \
+    {    767,12}, {   1727,13}, {    895,14}, {    511,13}, \
+    {   1023,12}, {   2047,13}, {   1151,12}, {   2431,13}, \
+    {   1279,14}, {    767,13}, {   1535,12}, {   3071,15}, \
+    {    511,14}, {   1023,13}, {   2047,12}, {   4095,13}, \
+    {   2175,14}, {   1279,13}, {   2559,12}, {   5119,13}, \
+    {   2687,14}, {  16384,15}, {  32768,16} }
+#define SQR_FFT_TABLE3_SIZE 139
+#define SQR_FFT_THRESHOLD                 4736
+
+#define MULLO_BASECASE_THRESHOLD             9
+#define MULLO_DC_THRESHOLD                  39
+#define MULLO_MUL_N_THRESHOLD            11278
+
+#define DC_DIV_QR_THRESHOLD                 54
+#define DC_DIVAPPR_Q_THRESHOLD             296
+#define DC_BDIV_QR_THRESHOLD                52
+#define DC_BDIV_Q_THRESHOLD                300
+
+#define INV_MULMOD_BNM1_THRESHOLD           44
+#define INV_NEWTON_THRESHOLD               294
+#define INV_APPR_THRESHOLD                 294
+
+#define BINV_NEWTON_THRESHOLD              375
+#define REDC_1_TO_REDC_2_THRESHOLD         102
+#define REDC_2_TO_REDC_N_THRESHOLD           0  /* always */
+
+#define MU_DIV_QR_THRESHOLD               1718
+#define MU_DIVAPPR_Q_THRESHOLD            1718
+#define MUPI_DIV_QR_THRESHOLD              108
+#define MU_BDIV_QR_THRESHOLD              1528
+#define MU_BDIV_Q_THRESHOLD               1718
+
+#define POWM_SEC_TABLE  3,32,70,416,1464
 
 #define MATRIX22_STRASSEN_THRESHOLD         22
-#define HGCD_THRESHOLD                      40
-#define HGCD_APPR_THRESHOLD                 50
-#define HGCD_REDUCE_THRESHOLD             3389
-#define GCD_DC_THRESHOLD                   278
-#define GCDEXT_DC_THRESHOLD                180
+#define HGCD_THRESHOLD                     152
+#define HGCD_APPR_THRESHOLD                230
+#define HGCD_REDUCE_THRESHOLD             3259
+#define GCD_DC_THRESHOLD                   702
+#define GCDEXT_DC_THRESHOLD                538
 #define JACOBI_BASE_METHOD                   4
 
 #define GET_STR_DC_THRESHOLD                18
-#define GET_STR_PRECOMPUTE_THRESHOLD        34
-#define SET_STR_DC_THRESHOLD               198
-#define SET_STR_PRECOMPUTE_THRESHOLD       541
+#define GET_STR_PRECOMPUTE_THRESHOLD        32
+#define SET_STR_DC_THRESHOLD               119
+#define SET_STR_PRECOMPUTE_THRESHOLD      1063
 
-#define FAC_DSC_THRESHOLD                  303
-#define FAC_ODD_THRESHOLD                   28
+#define FAC_DSC_THRESHOLD                  262
+#define FAC_ODD_THRESHOLD                   26
diff --git a/mpn/arm/v7a/cora15/logops_n.asm b/mpn/arm/v7a/cora15/logops_n.asm
new file mode 100644 (file)
index 0000000..0602614
--- /dev/null
@@ -0,0 +1,253 @@
+dnl  ARM mpn_and_n, mpn_andn_n. mpn_nand_n, etc, optimised for A15.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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             cycles/limb
+C          and andn ior xor         nand iorn nior xnor
+C StrongARM     ?                       ?
+C XScale        ?                       ?
+C Cortex-A7     ?                       ?
+C Cortex-A8     ?                       ?
+C Cortex-A9    3.5                     3.56
+C Cortex-A15   1.27                    1.64
+
+C This is great A15 core register code, but it is a bit large.
+C We use FEEDIN_VARIANT 1 to save some space, but use 8-way unrolling.
+
+C Architecture requirements:
+C v5   -
+C v5t  -
+C v5te ldrd strd
+C v6   -
+C v6t2 -
+C v7a  -
+
+define(`FEEDIN_VARIANT', 1)    C alternatives: 0 1 2
+define(`UNROLL', 4x2)          C alternatives: 4 4x2
+
+define(`rp', `r0')
+define(`up', `r1')
+define(`vp', `r2')
+define(`n',  `r3')
+
+define(`POSTOP')
+
+ifdef(`OPERATION_and_n',`
+  define(`func',    `mpn_and_n')
+  define(`LOGOP',   `and       $1, $2, $3')')
+ifdef(`OPERATION_andn_n',`
+  define(`func',    `mpn_andn_n')
+  define(`LOGOP',   `bic       $1, $2, $3')')
+ifdef(`OPERATION_nand_n',`
+  define(`func',    `mpn_nand_n')
+  define(`POSTOP',  `mvn       $1, $1')
+  define(`LOGOP',   `and       $1, $2, $3')')
+ifdef(`OPERATION_ior_n',`
+  define(`func',    `mpn_ior_n')
+  define(`LOGOP',   `orr       $1, $2, $3')')
+ifdef(`OPERATION_iorn_n',`
+  define(`func',    `mpn_iorn_n')
+  define(`POSTOP',  `mvn       $1, $1')
+  define(`LOGOP',   `bic       $1, $3, $2')')
+ifdef(`OPERATION_nior_n',`
+  define(`func',    `mpn_nior_n')
+  define(`POSTOP',  `mvn       $1, $1')
+  define(`LOGOP',   `orr       $1, $2, $3')')
+ifdef(`OPERATION_xor_n',`
+  define(`func',    `mpn_xor_n')
+  define(`LOGOP',   `eor       $1, $2, $3')')
+ifdef(`OPERATION_xnor_n',`
+  define(`func',    `mpn_xnor_n')
+  define(`POSTOP',  `mvn       $1, $1')
+  define(`LOGOP',   `eor       $1, $2, $3')')
+
+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)
+
+ASM_START()
+PROLOGUE(func)
+       push    { r4-r9 }
+
+ifelse(FEEDIN_VARIANT,0,`
+       ands    r6, n, #3
+       mov     n, n, lsr #2
+       beq     L(b00a)
+       tst     r6, #1
+       beq     L(bx0)
+       ldr     r5, [up], #4
+       ldr     r7, [vp], #4
+       LOGOP(  r9, r5, r7)
+       POSTOP( r9)
+       str     r9, [rp], #4
+       tst     r6, #2
+       beq     L(b00)
+L(bx0):        ldrd    r4, r5, [up, #0]
+       ldrd    r6, r7, [vp, #0]
+       sub     rp, rp, #8
+       b       L(lo)
+L(b00):        tst     n, n
+       beq     L(wd1)
+L(b00a):ldrd   r4, r5, [up], #-8
+       ldrd    r6, r7, [vp], #-8
+       sub     rp, rp, #16
+       b       L(mid)
+')
+ifelse(FEEDIN_VARIANT,1,`
+       and     r6, n, #3
+       mov     n, n, lsr #2
+       tst     r6, #1
+       beq     L(bx0)
+       ldr     r5, [up], #4
+       ldr     r7, [vp], #4
+       LOGOP(  r9, r5, r7)
+       POSTOP( r9)
+       str     r9, [rp], #4
+L(bx0):        tst     r6, #2
+       beq     L(b00)
+       ldrd    r4, r5, [up, #0]
+       ldrd    r6, r7, [vp, #0]
+       sub     rp, rp, #8
+       b       L(lo)
+L(b00):        tst     n, n
+       beq     L(wd1)
+       ldrd    r4, r5, [up], #-8
+       ldrd    r6, r7, [vp], #-8
+       sub     rp, rp, #16
+       b       L(mid)
+')
+ifelse(FEEDIN_VARIANT,2,`
+       ands    r6, n, #3
+       mov     n, n, lsr #2
+       beq     L(b00)
+       cmp     r6, #2
+       bcc     L(b01)
+       beq     L(b10)
+
+L(b11):        ldr     r5, [up], #4
+       ldr     r7, [vp], #4
+       LOGOP(  r9, r5, r7)
+       ldrd    r4, r5, [up, #0]
+       ldrd    r6, r7, [vp, #0]
+       POSTOP( r9)
+       str     r9, [rp], #-4
+       b       L(lo)
+
+L(b00):        ldrd    r4, r5, [up], #-8
+       ldrd    r6, r7, [vp], #-8
+       sub     rp, rp, #16
+       b       L(mid)
+
+L(b01):        ldr     r5, [up], #-4
+       ldr     r7, [vp], #-4
+       LOGOP(  r9, r5, r7)
+       POSTOP( r9)
+       str     r9, [rp], #-12
+       tst     n, n
+       beq     L(wd1)
+L(gt1):        ldrd    r4, r5, [up, #8]
+       ldrd    r6, r7, [vp, #8]
+       b       L(mid)
+
+L(b10):        ldrd    r4, r5, [up]
+       ldrd    r6, r7, [vp]
+       sub     rp, rp, #8
+       b       L(lo)
+')
+       ALIGN(16)
+ifelse(UNROLL,4,`
+L(top):        ldrd    r4, r5, [up, #8]
+       ldrd    r6, r7, [vp, #8]
+       POSTOP( r8)
+       POSTOP( r9)
+       strd    r8, r9, [rp, #8]
+L(mid):        LOGOP(  r8, r4, r6)
+       LOGOP(  r9, r5, r7)
+       ldrd    r4, r5, [up, #16]!
+       ldrd    r6, r7, [vp, #16]!
+       POSTOP( r8)
+       POSTOP( r9)
+       strd    r8, r9, [rp, #16]!
+       sub     n, n, #1
+L(lo): LOGOP(  r8, r4, r6)
+       LOGOP(  r9, r5, r7)
+       tst     n, n
+       bne     L(top)
+')
+ifelse(UNROLL,4x2,`
+L(top):        ldrd    r4, r5, [up, #8]
+       ldrd    r6, r7, [vp, #8]
+       POSTOP( r8)
+       POSTOP( r9)
+       strd    r8, r9, [rp, #8]
+L(mid):        LOGOP(  r8, r4, r6)
+       LOGOP(  r9, r5, r7)
+       ldrd    r4, r5, [up, #16]
+       ldrd    r6, r7, [vp, #16]
+       POSTOP( r8)
+       POSTOP( r9)
+       strd    r8, r9, [rp, #16]
+       LOGOP(  r8, r4, r6)
+       LOGOP(  r9, r5, r7)
+       sub     n, n, #2
+       tst     n, n
+       bmi     L(dne)
+       ldrd    r4, r5, [up, #24]
+       ldrd    r6, r7, [vp, #24]
+       POSTOP( r8)
+       POSTOP( r9)
+       strd    r8, r9, [rp, #24]
+       LOGOP(  r8, r4, r6)
+       LOGOP(  r9, r5, r7)
+       ldrd    r4, r5, [up, #32]!
+       ldrd    r6, r7, [vp, #32]!
+       POSTOP( r8)
+       POSTOP( r9)
+       strd    r8, r9, [rp, #32]!
+L(lo): LOGOP(  r8, r4, r6)
+       LOGOP(  r9, r5, r7)
+       tst     n, n
+       bne     L(top)
+')
+
+L(end):        POSTOP( r8)
+       POSTOP( r9)
+       strd    r8, r9, [rp, #8]
+L(wd1):        pop     { r4-r9 }
+       bx      r14
+ifelse(UNROLL,4x2,`
+L(dne):        POSTOP( r8)
+       POSTOP( r9)
+       strd    r8, r9, [rp, #24]
+       pop     { r4-r9 }
+       bx      r14
+')
+EPILOGUE()
diff --git a/mpn/arm/v7a/cora15/mul_1.asm b/mpn/arm/v7a/cora15/mul_1.asm
new file mode 100644 (file)
index 0000000..766ba5c
--- /dev/null
@@ -0,0 +1,104 @@
+dnl  ARM mpn_mul_1 optimised for A15.
+
+dnl  Copyright 2012, 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                best
+C StrongARM:    -
+C XScale        ?
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9     5.25                   3.25
+C Cortex-A15    2.25                   this
+
+
+C This runs well on A15 but very poorly on A9.  By scheduling loads and adds
+C it is possible to get good A9 performance as well, but at the cost of using
+C many more (callee-saves) registers.
+
+C This is armv5 code, optimized for the armv7a cpu A15.  Its location in the
+C GMP file structure might be misleading.
+
+
+define(`rp', `r0')
+define(`up', `r1')
+define(`n',  `r2')
+define(`v0', `r3')
+
+ASM_START()
+PROLOGUE(mpn_mul_1c)
+       ldr     r12, [sp]
+       b       L(ent)
+EPILOGUE()
+PROLOGUE(mpn_mul_1)
+       mov     r12, #0
+L(ent):        push    {r4-r7}
+
+       ldr     r6, [up], #4
+       tst     n, #1
+       beq     L(bx0)
+
+L(bx1):        umull   r4, r7, r6, v0
+       adds    r4, r4, r12
+       tst     n, #2
+       beq     L(lo1)
+       b       L(lo3)
+
+L(bx0):        umull   r4, r5, r6, v0
+       adds    r4, r4, r12
+       tst     n, #2
+       beq     L(lo0)
+       b       L(lo2)
+
+L(top):        ldr     r6, [up], #4
+       str     r4, [rp], #4
+       umull   r4, r5, r6, v0
+       adds    r4, r4, r7
+L(lo0):        ldr     r6, [up], #4
+       str     r4, [rp], #4
+       umull   r4, r7, r6, v0
+       adcs    r4, r4, r5
+L(lo3):        ldr     r6, [up], #4
+       str     r4, [rp], #4
+       umull   r4, r5, r6, v0
+       adcs    r4, r4, r7
+L(lo2):        ldr     r6, [up], #4
+       str     r4, [rp], #4
+       umull   r4, r7, r6, v0
+       adcs    r4, r4, r5
+L(lo1):        adc     r7, r7, #0
+       subs    n, n, #4
+       bgt     L(top)
+
+       str     r4, [rp]
+       mov     r0, r7
+       pop     {r4-r7}
+       bx      lr
+EPILOGUE()
diff --git a/mpn/arm/v7a/cora15/neon/aorsorrlsh1_n.asm b/mpn/arm/v7a/cora15/neon/aorsorrlsh1_n.asm
new file mode 100644 (file)
index 0000000..d8cfe3f
--- /dev/null
@@ -0,0 +1,43 @@
+dnl  ARM mpn_addlshC_n, mpn_sublshC_n, mpn_rsblshC_n
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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')
+
+define(LSH,            1)
+
+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(`arm/v7a/cora15/neon/aorsorrlshC_n.asm')
diff --git a/mpn/arm/v7a/cora15/neon/aorsorrlsh2_n.asm b/mpn/arm/v7a/cora15/neon/aorsorrlsh2_n.asm
new file mode 100644 (file)
index 0000000..b48204d
--- /dev/null
@@ -0,0 +1,43 @@
+dnl  ARM mpn_addlshC_n, mpn_sublshC_n, mpn_rsblshC_n
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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')
+
+define(LSH,            2)
+
+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(`arm/v7a/cora15/neon/aorsorrlshC_n.asm')
diff --git a/mpn/arm/v7a/cora15/neon/aorsorrlshC_n.asm b/mpn/arm/v7a/cora15/neon/aorsorrlshC_n.asm
new file mode 100644 (file)
index 0000000..16c34a2
--- /dev/null
@@ -0,0 +1,144 @@
+dnl  ARM mpn_addlshC_n, mpn_sublshC_n, mpn_rsblshC_n
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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/.
+
+
+C           cycles/limb
+C StrongARM     -
+C XScale        -
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9     5.25
+C Cortex-A15    2.25
+
+C TODO
+C  * Consider using 4-way feed-in code.
+C  * This is ad-hoc scheduled, perhaps unnecessarily so for A15, and perhaps
+C    insufficiently for A7 and A8.
+
+define(`rp', `r0')
+define(`up', `r1')
+define(`vp', `r2')
+define(`n',  `r3')
+
+ifdef(`DO_add', `
+  define(`ADCSBCS',    `adcs   $1, $2, $3')
+  define(`CLRCY',      `cmn    r13, #1')
+  define(`RETVAL',     `adc    r0, $1, #0')
+  define(`func',       mpn_addlsh`'LSH`'_n)')
+ifdef(`DO_sub', `
+  define(`ADCSBCS',    `sbcs   $1, $2, $3')
+  define(`CLRCY',      `cmp    r13, #0')
+  define(`RETVAL',     `sbc    $2, $2, $2
+                       cmn     $2, #1
+                       adc      r0, $1, #0')
+  define(`func',       mpn_sublsh`'LSH`'_n)')
+ifdef(`DO_rsb', `
+  define(`ADCSBCS',    `sbcs   $1, $3, $2')
+  define(`CLRCY',      `cmp    r13, #0')
+  define(`RETVAL',     `sbc    r0, $1, #0')
+  define(`func',       mpn_rsblsh`'LSH`'_n)')
+
+
+ASM_START()
+PROLOGUE(func)
+       push     {r4-r10}
+       vmov.i8  d0, #0                 C could feed carry through here
+       CLRCY
+       tst     n, #1
+       beq     L(bb0)
+
+L(bb1):        vld1.32  {d3[0]}, [vp]!
+       vsli.u32 d0, d3, #LSH
+       ldr      r12, [up], #4
+       vmov.32  r5, d0[0]
+       vshr.u32 d0, d3, #32-LSH
+       ADCSBCS( r12, r12, r5)
+       str      r12, [rp], #4
+       bics     n, n, #1
+       beq      L(rtn)
+
+L(bb0):        tst     n, #2
+       beq     L(b00)
+
+L(b10):        vld1.32  {d3}, [vp]!
+       vsli.u64 d0, d3, #LSH
+       ldmia    up!, {r10,r12}
+       vmov     r4, r5, d0
+       vshr.u64 d0, d3, #64-LSH
+       ADCSBCS( r10, r10, r4)
+       ADCSBCS( r12, r12, r5)
+       stmia    rp!, {r10,r12}
+       bics     n, n, #2
+       beq      L(rtn)
+
+L(b00):        vld1.32  {d2}, [vp]!
+       vsli.u64 d0, d2, #LSH
+       vshr.u64 d1, d2, #64-LSH
+       vld1.32  {d3}, [vp]!
+       vsli.u64 d1, d3, #LSH
+       vmov     r6, r7, d0
+       vshr.u64 d0, d3, #64-LSH
+       sub      n, n, #4
+       tst      n, n
+       beq      L(end)
+
+       ALIGN(16)
+L(top):        ldmia    up!, {r8,r9,r10,r12}
+       vld1.32  {d2}, [vp]!
+       vsli.u64 d0, d2, #LSH
+       vmov     r4, r5, d1
+       vshr.u64 d1, d2, #64-LSH
+       ADCSBCS( r8, r8, r6)
+       ADCSBCS( r9, r9, r7)
+       vld1.32  {d3}, [vp]!
+       vsli.u64 d1, d3, #LSH
+       vmov     r6, r7, d0
+       vshr.u64 d0, d3, #64-LSH
+       ADCSBCS( r10, r10, r4)
+       ADCSBCS( r12, r12, r5)
+       stmia    rp!, {r8,r9,r10,r12}
+       sub      n, n, #4
+       tst      n, n
+       bne      L(top)
+
+L(end):        ldmia    up!, {r8,r9,r10,r12}
+       vmov     r4, r5, d1
+       ADCSBCS( r8, r8, r6)
+       ADCSBCS( r9, r9, r7)
+       ADCSBCS( r10, r10, r4)
+       ADCSBCS( r12, r12, r5)
+       stmia    rp!, {r8,r9,r10,r12}
+L(rtn):        vmov.32  r0, d0[0]
+       RETVAL(  r0, r1)
+       pop      {r4-r10}
+       bx       r14
+EPILOGUE()
diff --git a/mpn/arm/v7a/cora15/neon/com.asm b/mpn/arm/v7a/cora15/neon/com.asm
new file mode 100644 (file)
index 0000000..9e7a629
--- /dev/null
@@ -0,0 +1,97 @@
+dnl  ARM Neon mpn_com optimised for A15.
+
+dnl  Copyright 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 StrongARM     ?
+C XScale        ?
+C Cortex-A8     ?
+C Cortex-A9     2.1
+C Cortex-A15    0.65
+
+define(`rp', `r0')
+define(`up', `r1')
+define(`n',  `r2')
+
+ASM_START()
+PROLOGUE(mpn_com)
+       cmp             n, #7
+       ble             L(bc)
+
+C Perform a few initial operation until rp is 128-bit aligned
+       tst             rp, #4
+       beq             L(al1)
+       vld1.32         {d0[0]}, [up]!
+       sub             n, n, #1
+       vmvn            d0, d0
+       vst1.32         {d0[0]}, [rp]!
+L(al1):        tst             rp, #8
+       beq             L(al2)
+       vld1.32         {d0}, [up]!
+       sub             n, n, #2
+       vmvn            d0, d0
+       vst1.32         {d0}, [rp:64]!
+L(al2):        vld1.32         {q2}, [up]!
+       subs            n, n, #12
+       blt             L(end)
+
+       ALIGN(16)
+L(top):        vld1.32         {q0}, [up]!
+       vmvn            q2, q2
+       subs            n, n, #8
+       vst1.32         {q2}, [rp:128]!
+       vld1.32         {q2}, [up]!
+       vmvn            q0, q0
+       vst1.32         {q0}, [rp:128]!
+       bge     L(top)
+
+L(end):        vmvn            q2, q2
+       vst1.32         {q2}, [rp:128]!
+
+C Handle last 0-7 limbs.  Note that rp is aligned after loop, but not when we
+C arrive here via L(bc)
+L(bc): tst             n, #4
+       beq             L(tl1)
+       vld1.32         {q0}, [up]!
+       vmvn            q0, q0
+       vst1.32         {q0}, [rp]!
+L(tl1):        tst             n, #2
+       beq             L(tl2)
+       vld1.32         {d0}, [up]!
+       vmvn            d0, d0
+       vst1.32         {d0}, [rp]!
+L(tl2):        tst             n, #1
+       beq             L(tl3)
+       vld1.32         {d0[0]}, [up]
+       vmvn            d0, d0
+       vst1.32         {d0[0]}, [rp]
+L(tl3):        bx              lr
+EPILOGUE()
diff --git a/mpn/arm/v7a/cora15/neon/copyd.asm b/mpn/arm/v7a/cora15/neon/copyd.asm
new file mode 100644 (file)
index 0000000..98fe535
--- /dev/null
@@ -0,0 +1,110 @@
+dnl  ARM Neon mpn_copyd optimised for A15.
+
+dnl  Copyright 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 StrongARM     -
+C XScale        -
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9     1.75           slower than core register code
+C Cortex-A15    0.52
+
+define(`rp', `r0')
+define(`up', `r1')
+define(`n',  `r2')
+
+ASM_START()
+PROLOGUE(mpn_copyd)
+       add     rp, rp, n, lsl #2
+       add     up, up, n, lsl #2
+
+       cmp     n, #7
+       ble     L(bc)
+
+C Copy until rp is 128-bit aligned
+       tst     rp, #4
+       beq     L(al1)
+       sub     up, up, #4
+       vld1.32 {d22[0]}, [up]
+       sub     n, n, #1
+       sub     rp, rp, #4
+       vst1.32 {d22[0]}, [rp]
+L(al1):        tst     rp, #8
+       beq     L(al2)
+       sub     up, up, #8
+       vld1.32 {d22}, [up]
+       sub     n, n, #2
+       sub     rp, rp, #8
+       vst1.32 {d22}, [rp:64]
+L(al2):        sub     up, up, #16
+       vld1.32 {d26-d27}, [up]
+       subs    n, n, #12
+       sub     rp, rp, #16                     C offset rp for loop
+       blt     L(end)
+
+       sub     up, up, #16                     C offset up for loop
+       mov     r12, #-16
+
+       ALIGN(16)
+L(top):        vld1.32 {d22-d23}, [up], r12
+       vst1.32 {d26-d27}, [rp:128], r12
+       vld1.32 {d26-d27}, [up], r12
+       vst1.32 {d22-d23}, [rp:128], r12
+       subs    n, n, #8
+       bge     L(top)
+
+       add     up, up, #16                     C undo up offset
+                                               C rp offset undoing folded
+L(end):        vst1.32 {d26-d27}, [rp:128]
+
+C Copy last 0-7 limbs.  Note that rp is aligned after loop, but not when we
+C arrive here via L(bc)
+L(bc): tst     n, #4
+       beq     L(tl1)
+       sub     up, up, #16
+       vld1.32 {d22-d23}, [up]
+       sub     rp, rp, #16
+       vst1.32 {d22-d23}, [rp]
+L(tl1):        tst     n, #2
+       beq     L(tl2)
+       sub     up, up, #8
+       vld1.32 {d22}, [up]
+       sub     rp, rp, #8
+       vst1.32 {d22}, [rp]
+L(tl2):        tst     n, #1
+       beq     L(tl3)
+       sub     up, up, #4
+       vld1.32 {d22[0]}, [up]
+       sub     rp, rp, #4
+       vst1.32 {d22[0]}, [rp]
+L(tl3):        bx      lr
+EPILOGUE()
diff --git a/mpn/arm/v7a/cora15/neon/copyi.asm b/mpn/arm/v7a/cora15/neon/copyi.asm
new file mode 100644 (file)
index 0000000..2e05afe
--- /dev/null
@@ -0,0 +1,90 @@
+dnl  ARM Neon mpn_copyi optimised for A15.
+
+dnl  Copyright 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 StrongARM     -
+C XScale        -
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9     1.75           slower than core register code
+C Cortex-A15    0.52
+
+define(`rp', `r0')
+define(`up', `r1')
+define(`n',  `r2')
+
+ASM_START()
+PROLOGUE(mpn_copyi)
+       cmp     n, #7
+       ble     L(bc)
+
+C Copy until rp is 128-bit aligned
+       tst     rp, #4
+       beq     L(al1)
+       vld1.32 {d22[0]}, [up]!
+       sub     n, n, #1
+       vst1.32 {d22[0]}, [rp]!
+L(al1):        tst     rp, #8
+       beq     L(al2)
+       vld1.32 {d22}, [up]!
+       sub     n, n, #2
+       vst1.32 {d22}, [rp:64]!
+L(al2):        vld1.32 {d26-d27}, [up]!
+       subs    n, n, #12
+       blt     L(end)
+
+       ALIGN(16)
+L(top):        vld1.32 {d22-d23}, [up]!
+       vst1.32 {d26-d27}, [rp:128]!
+       vld1.32 {d26-d27}, [up]!
+       vst1.32 {d22-d23}, [rp:128]!
+       subs    n, n, #8
+       bge     L(top)
+
+L(end):        vst1.32 {d26-d27}, [rp:128]!
+
+C Copy last 0-7 limbs.  Note that rp is aligned after loop, but not when we
+C arrive here via L(bc)
+L(bc): tst     n, #4
+       beq     L(tl1)
+       vld1.32 {d22-d23}, [up]!
+       vst1.32 {d22-d23}, [rp]!
+L(tl1):        tst     n, #2
+       beq     L(tl2)
+       vld1.32 {d22}, [up]!
+       vst1.32 {d22}, [rp]!
+L(tl2):        tst     n, #1
+       beq     L(tl3)
+       vld1.32 {d22[0]}, [up]
+       vst1.32 {d22[0]}, [rp]
+L(tl3):        bx      lr
+EPILOGUE()
diff --git a/mpn/arm/v7a/cora15/neon/rsh1aors_n.asm b/mpn/arm/v7a/cora15/neon/rsh1aors_n.asm
new file mode 100644 (file)
index 0000000..2c11d6d
--- /dev/null
@@ -0,0 +1,177 @@
+dnl  ARM Neon mpn_rsh1add_n, mpn_rsh1sub_n.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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 StrongARM     -
+C XScale        -
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9    4-5
+C Cortex-A15    2.5
+
+C TODO
+C  * Try to make this smaller, its size (384 bytes) is excessive.
+C  * Try to reach 2.25 c/l on A15, to match the addlsh_1 family.
+C  * This is ad-hoc scheduled, perhaps unnecessarily so for A15, and perhaps
+C    insufficiently for A7 and A8.
+
+define(`rp', `r0')
+define(`up', `r1')
+define(`vp', `r2')
+define(`n',  `r3')
+
+ifdef(`OPERATION_rsh1add_n', `
+  define(`ADDSUBS',    `adds   $1, $2, $3')
+  define(`ADCSBCS',    `adcs   $1, $2, $3')
+  define(`IFADD',      `$1')
+  define(`IFSUB',      `')
+  define(`func',       mpn_rsh1add_n)')
+ifdef(`OPERATION_rsh1sub_n', `
+  define(`ADDSUBS',    `subs   $1, $2, $3')
+  define(`ADCSBCS',    `sbcs   $1, $2, $3')
+  define(`IFADD',      `')
+  define(`IFSUB',      `$1')
+  define(`func',       mpn_rsh1sub_n)')
+
+MULFUNC_PROLOGUE(mpn_rsh1add_n mpn_rsh1sub_n)
+
+ASM_START()
+PROLOGUE(func)
+       push     {r4-r10}
+
+       ands    r4, n, #3
+       beq     L(b00)
+       cmp     r4, #2
+       blo     L(b01)
+       beq     L(b10)
+
+L(b11):        ldmia    up!, {r9,r10,r12}
+       ldmia    vp!, {r5,r6,r7}
+       ADDSUBS( r9, r9, r5)
+       vmov     d4, r9, r9
+       ADCSBCS( r10, r10, r6)
+       ADCSBCS( r12, r12, r7)
+       vshr.u64 d3, d4, #1
+       vmov     d1, r10, r12
+       vsli.u64 d3, d1, #31
+       vshr.u64 d2, d1, #1
+       vst1.32  d3[0], [rp]!
+       bics     n, n, #3
+       beq      L(wd2)
+L(gt3):        ldmia    up!, {r8,r9,r10,r12}
+       ldmia    vp!, {r4,r5,r6,r7}
+       b        L(mi0)
+
+L(b10):        ldmia    up!, {r10,r12}
+       ldmia    vp!, {r6,r7}
+       ADDSUBS( r10, r10, r6)
+       ADCSBCS( r12, r12, r7)
+       vmov     d4, r10, r12
+       bics     n, n, #2
+       vshr.u64 d2, d4, #1
+       beq      L(wd2)
+L(gt2):        ldmia    up!, {r8,r9,r10,r12}
+       ldmia    vp!, {r4,r5,r6,r7}
+       b        L(mi0)
+
+L(b01):        ldr      r12, [up], #4
+       ldr      r7, [vp], #4
+       ADDSUBS( r12, r12, r7)
+       vmov     d4, r12, r12
+       bics     n, n, #1
+       bne      L(gt1)
+       mov      r5, r12, lsr #1
+IFADD(`        adc      r1, n, #0')
+IFSUB(`        adc      r1, n, #1')
+       bfi      r5, r1, #31, #1
+       str      r5, [rp]
+       and      r0, r12, #1
+       pop      {r4-r10}
+       bx       r14
+L(gt1):        ldmia    up!, {r8,r9,r10,r12}
+       ldmia    vp!, {r4,r5,r6,r7}
+       vshr.u64 d2, d4, #1
+       ADCSBCS( r8, r8, r4)
+       ADCSBCS( r9, r9, r5)
+       vmov     d0, r8, r9
+       ADCSBCS( r10, r10, r6)
+       ADCSBCS( r12, r12, r7)
+       vsli.u64 d2, d0, #31
+       vshr.u64 d3, d0, #1
+       vst1.32  d2[0], [rp]!
+       b        L(mi1)
+
+L(b00):        ldmia    up!, {r8,r9,r10,r12}
+       ldmia    vp!, {r4,r5,r6,r7}
+       ADDSUBS( r8, r8, r4)
+       ADCSBCS( r9, r9, r5)
+       vmov     d4, r8, r9
+       ADCSBCS( r10, r10, r6)
+       ADCSBCS( r12, r12, r7)
+       vshr.u64 d3, d4, #1
+       b        L(mi1)
+
+       ALIGN(16)
+L(top):        ldmia    up!, {r8,r9,r10,r12}
+       ldmia    vp!, {r4,r5,r6,r7}
+       vsli.u64 d3, d1, #63
+       vshr.u64 d2, d1, #1
+       vst1.32  d3, [rp]!
+L(mi0):        ADCSBCS( r8, r8, r4)
+       ADCSBCS( r9, r9, r5)
+       vmov     d0, r8, r9
+       ADCSBCS( r10, r10, r6)
+       ADCSBCS( r12, r12, r7)
+       vsli.u64 d2, d0, #63
+       vshr.u64 d3, d0, #1
+       vst1.32  d2, [rp]!
+L(mi1):        vmov     d1, r10, r12
+       sub      n, n, #4
+       tst      n, n
+       bne      L(top)
+
+L(end):        vsli.u64 d3, d1, #63
+       vshr.u64 d2, d1, #1
+       vst1.32  d3, [rp]!
+L(wd2):        vmov     r4, r5, d2
+IFADD(`        adc      r1, n, #0')
+IFSUB(`        adc      r1, n, #1')
+       bfi      r5, r1, #31, #1
+       stm      rp, {r4,r5}
+
+L(rtn):        vmov.32  r0, d4[0]
+       and      r0, r0, #1
+       pop      {r4-r10}
+       bx       r14
+EPILOGUE()
diff --git a/mpn/arm/v7a/cora15/submul_1.asm b/mpn/arm/v7a/cora15/submul_1.asm
new file mode 100644 (file)
index 0000000..ed7bfe8
--- /dev/null
@@ -0,0 +1,159 @@
+dnl  ARM mpn_submul_1 optimised for A15.
+
+dnl  Copyright 2012, 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                best
+C StrongARM:     -
+C XScale        ?
+C Cortex-A7     ?
+C Cortex-A8     ?
+C Cortex-A9     5.75                   3.75
+C Cortex-A15    2.32                   this
+
+C This code uses umlal and umaal for adding in the rp[] data, keeping the
+C recurrency path separate from any multiply instructions.  It performs well on
+C A15, but not quite at the multiply bandwidth like the corresponding addmul_1
+C code.
+C
+C We don't use r12 due to ldrd and strd limitations.
+C
+C This loop complements U on the fly,
+C   U' = B^n - 1 - U
+C and then uses that
+C   R - U*v = R + U'*v + v - B^n v
+
+C Architecture requirements:
+C v5   -
+C v5t  -
+C v5te ldrd strd
+C v6   umaal
+C v6t2 -
+C v7a  -
+
+define(`rp', `r0')
+define(`up', `r1')
+define(`n',  `r2')
+define(`v0', `r3')
+
+define(`w0', `r10') define(`w1', `r11')
+define(`u0', `r8')  define(`u1', `r9')
+
+ASM_START()
+PROLOGUE(mpn_submul_1)
+       sub     sp, sp, #32
+       strd    r10, r11, [sp, #24]
+       strd    r8, r9, [sp, #16]
+       strd    r6, r7, [sp, #8]
+       strd    r4, r5, [sp, #0]
+C      push    { r4-r11 }
+
+       ands    r6, n, #3
+       sub     n, n, #3
+       beq     L(b00)
+       cmp     r6, #2
+       bcc     L(b01)
+       beq     L(b10)
+
+L(b11):        mov     r6, #0
+       ldr     u1, [up], #-4
+       ldr     w1, [rp], #-16
+       mvn     u1, u1
+       adds    r7, v0, #0
+       b       L(mid)
+
+L(b00):        ldrd    u0, u1, [up]
+       ldrd    w0, w1, [rp], #-12
+       mvn     u0, u0
+       mvn     u1, u1
+       mov     r6, v0
+       umaal   w0, r6, u0, v0
+       cmn     r13, #0                 C carry clear
+       mov     r7, #0
+       str     w0, [rp, #12]
+       b       L(mid)
+
+L(b10):        ldrd    u0, u1, [up], #8
+       ldrd    w0, w1, [rp]
+       mvn     u0, u0
+       mvn     u1, u1
+       mov     r4, v0
+       umaal   w0, r4, u0, v0
+       mov     r5, #0
+       str     w0, [rp], #-4
+       umlal   w1, r5, u1, v0
+       adds    n, n, #0
+       bmi     L(end)
+       b       L(top)
+
+L(b01):        ldr     u1, [up], #4
+       ldr     w1, [rp], #-8
+       mvn     u1, u1
+       mov     r5, v0
+       mov     r4, #0
+       umaal   w1, r5, u1, v0
+       tst     n, n
+       bmi     L(end)
+
+C      ALIGN(16)
+L(top):        ldrd    u0, u1, [up, #0]
+       adcs    r4, r4, w1
+       mvn     u0, u0
+       ldrd    w0, w1, [rp, #12]
+       mvn     u1, u1
+       mov     r6, #0
+       umlal   w0, r6, u0, v0          C 1 2
+       adcs    r5, r5, w0
+       mov     r7, #0
+       strd    r4, r5, [rp, #8]
+L(mid):        umaal   w1, r7, u1, v0          C 2 3
+       ldrd    u0, u1, [up, #8]
+       add     up, up, #16
+       adcs    r6, r6, w1
+       mvn     u0, u0
+       ldrd    w0, w1, [rp, #20]
+       mvn     u1, u1
+       mov     r4, #0
+       umlal   w0, r4, u0, v0          C 3 4
+       adcs    r7, r7, w0
+       mov     r5, #0
+       strd    r6, r7, [rp, #16]!
+       sub     n, n, #4
+       umlal   w1, r5, u1, v0          C 0 1
+       tst     n, n
+       bpl     L(top)
+
+L(end):        adcs    r4, r4, w1
+       str     r4, [rp, #8]
+       adc     r0, r5, #0
+       sub     r0, v0, r0
+       pop     { r4-r11 }
+       bx      r14
+EPILOGUE()
diff --git a/mpn/arm/v7a/cora9/gmp-mparam.h b/mpn/arm/v7a/cora9/gmp-mparam.h
new file mode 100644 (file)
index 0000000..9660257
--- /dev/null
@@ -0,0 +1,209 @@
+/* gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 1991, 1993, 1994, 1999-2003, 2009, 2010, 2012-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
+
+/* 1000MHz Cortex-A9 */
+/* FFT tuning limit = 25000000 */
+/* Generated by tuneup.c, 2014-03-12, gcc 4.6 */
+
+#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         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
+#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           20
+
+#define MUL_TOOM22_THRESHOLD                45
+#define MUL_TOOM33_THRESHOLD               129
+#define MUL_TOOM44_THRESHOLD               387
+#define MUL_TOOM6H_THRESHOLD               517
+#define MUL_TOOM8H_THRESHOLD               774
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD     137
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD     222
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD     137
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD     235
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     208
+
+#define SQR_BASECASE_THRESHOLD               0  /* always (native) */
+#define SQR_TOOM2_THRESHOLD                 54
+#define SQR_TOOM3_THRESHOLD                181
+#define SQR_TOOM4_THRESHOLD                490
+#define SQR_TOOM6_THRESHOLD                656
+#define SQR_TOOM8_THRESHOLD                  0  /* always */
+
+#define MULMID_TOOM42_THRESHOLD             64
+
+#define MULMOD_BNM1_THRESHOLD               26
+#define SQRMOD_BNM1_THRESHOLD               28
+
+#define MUL_FFT_MODF_THRESHOLD             624  /* k = 5 */
+#define MUL_FFT_TABLE3                                      \
+  { {    624, 5}, {     28, 6}, {     15, 5}, {     34, 6}, \
+    {     18, 5}, {     37, 6}, {     28, 7}, {     15, 6}, \
+    {     36, 7}, {     19, 6}, {     40, 7}, {     21, 6}, \
+    {     43, 7}, {     23, 6}, {     47, 7}, {     25, 6}, \
+    {     51, 7}, {     27, 6}, {     55, 7}, {     29, 8}, \
+    {     15, 7}, {     31, 6}, {     63, 7}, {     37, 8}, \
+    {     19, 7}, {     43, 8}, {     23, 7}, {     51, 8}, \
+    {     27, 7}, {     57, 9}, {     15, 8}, {     31, 7}, \
+    {     65, 8}, {     35, 7}, {     71, 8}, {     43, 9}, \
+    {     23, 8}, {     55,10}, {     15, 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}, {    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,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}, {    575, 9}, \
+    {   1151,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}, {    607,12}, {    319,11}, {    735,12}, \
+    {    383,11}, {    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}, {   1535,12}, {    831,11}, \
+    {   1663,12}, {    959,14}, {    255,13}, {    511,12}, \
+    {   1023,11}, {   2047,12}, {   1215,13}, {    639,12}, \
+    {   1407,13}, {    767,12}, {   1663,13}, {    895,12}, \
+    {   1791,14}, {    511,13}, {   1023,12}, {   2111,13}, \
+    {   1151,12}, {   2431,13}, {   1279,12}, {   2559,13}, \
+    {   1407,14}, {    767,13}, {   1535,12}, {   3071,13}, \
+    {   1663,12}, {   3455,13}, {   1791,15}, {    511,14}, \
+    {   1023,13}, {   2047,12}, {   4095,13}, {   2175,12}, \
+    {   4351,13}, {   2431,14}, {   1279,13}, {   2559,12}, \
+    {   5119,13}, {   2815,14}, {  16384,15}, {  32768,16} }
+#define MUL_FFT_TABLE3_SIZE 160
+#define MUL_FFT_THRESHOLD                 6784
+
+#define SQR_FFT_MODF_THRESHOLD             560  /* k = 5 */
+#define SQR_FFT_TABLE3                                      \
+  { {    560, 5}, {     19, 4}, {     39, 5}, {     21, 4}, \
+    {     43, 5}, {     29, 6}, {     15, 5}, {     33, 6}, \
+    {     17, 5}, {     35, 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}, \
+    {     65, 8}, {     35, 7}, {     71, 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}, {    159,10}, {     95, 9}, {    191,10}, \
+    {    111,11}, {     63,10}, {    159,11}, {     95,10}, \
+    {    191, 9}, {    383,10}, {    207,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, 9}, {    831,11}, {    223,12}, \
+    {    127,11}, {    255,10}, {    511, 9}, {   1023,10}, \
+    {    543,11}, {    287,10}, {    575, 9}, {   1151,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}, {    575,10}, \
+    {   1151,11}, {    607,12}, {    319,11}, {    671,10}, \
+    {   1343,11}, {    735,12}, {    383,11}, {    863,12}, \
+    {    447,11}, {    959,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}, {    895,11}, \
+    {   1791,12}, {    959,13}, {    511,12}, {   1023,11}, \
+    {   2047,12}, {   1215,13}, {    639,12}, {   1407,13}, \
+    {    767,12}, {   1663,13}, {    895,12}, {   1791,14}, \
+    {    511,13}, {   1023,12}, {   2111,13}, {   1151,12}, \
+    {   2431,13}, {   1279,12}, {   2559,13}, {   1407,14}, \
+    {    767,13}, {   1535,12}, {   3071,13}, {   1663,12}, \
+    {   3455,13}, {   1791,15}, {    511,14}, {   1023,13}, \
+    {   2047,12}, {   4095,13}, {   2175,12}, {   4351,13}, \
+    {   2431,14}, {   1279,13}, {   2559,12}, {   5119,13}, \
+    {   2815,14}, {  16384,15}, {  32768,16} }
+#define SQR_FFT_TABLE3_SIZE 167
+#define SQR_FFT_THRESHOLD                 5312
+
+#define MULLO_BASECASE_THRESHOLD             0  /* always */
+#define MULLO_DC_THRESHOLD                  38
+#define MULLO_MUL_N_THRESHOLD            13463
+
+#define DC_DIV_QR_THRESHOLD                 42
+#define DC_DIVAPPR_Q_THRESHOLD             100
+#define DC_BDIV_QR_THRESHOLD                43
+#define DC_BDIV_Q_THRESHOLD                104
+
+#define INV_MULMOD_BNM1_THRESHOLD           98
+#define INV_NEWTON_THRESHOLD               138
+#define INV_APPR_THRESHOLD                 133
+
+#define BINV_NEWTON_THRESHOLD              333
+#define REDC_1_TO_REDC_2_THRESHOLD           2
+#define REDC_2_TO_REDC_N_THRESHOLD         142
+
+#define MU_DIV_QR_THRESHOLD               2350
+#define MU_DIVAPPR_Q_THRESHOLD            2259
+#define MUPI_DIV_QR_THRESHOLD               70
+#define MU_BDIV_QR_THRESHOLD              2089
+#define MU_BDIV_Q_THRESHOLD               2172
+
+#define POWM_SEC_TABLE  37,48,81,615,1925
+
+#define MATRIX22_STRASSEN_THRESHOLD         22
+#define HGCD_THRESHOLD                      64
+#define HGCD_APPR_THRESHOLD                 50
+#define HGCD_REDUCE_THRESHOLD             4284
+#define GCD_DC_THRESHOLD                   416
+#define GCDEXT_DC_THRESHOLD                298
+#define JACOBI_BASE_METHOD                   4
+
+#define GET_STR_DC_THRESHOLD                18
+#define GET_STR_PRECOMPUTE_THRESHOLD        33
+#define SET_STR_DC_THRESHOLD               140
+#define SET_STR_PRECOMPUTE_THRESHOLD       748
+
+#define FAC_DSC_THRESHOLD                  309
+#define FAC_ODD_THRESHOLD                   29
diff --git a/mpn/arm64/aors_n.asm b/mpn/arm64/aors_n.asm
new file mode 100644 (file)
index 0000000..a880cd3
--- /dev/null
@@ -0,0 +1,98 @@
+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  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    ?
+C Cortex-A57    ?
+
+changecom(@&*$)
+
+define(`rp', `x0')
+define(`up', `x1')
+define(`vp', `x2')
+define(`n',  `x3')
+
+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(`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(`func_nc',    mpn_sub_nc)')
+
+MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
+
+ASM_START()
+PROLOGUE(func_nc)
+       SETCY(  x4)
+       b       L(ent)
+EPILOGUE()
+PROLOGUE(func)
+       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
+       ret
+EPILOGUE()
diff --git a/mpn/arm64/aorsmul_1.asm b/mpn/arm64/aorsmul_1.asm
new file mode 100644 (file)
index 0000000..bf765a7
--- /dev/null
@@ -0,0 +1,122 @@
+dnl  ARM64 mpn_submul_1
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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 Cortex-A53    ?
+C Cortex-A57    ?
+
+changecom(@&*$)
+
+define(`rp', `x0')
+define(`up', `x1')
+define(`n',  `x2')
+define(`v0', `x3')
+
+ifdef(`OPERATION_addmul_1', `
+  define(`ADDSUB',     adds)
+  define(`ADDSUBC',    adcs)
+  define(`COND',       `cc')
+  define(`func',       mpn_addmul_1)')
+ifdef(`OPERATION_submul_1', `
+  define(`ADDSUB',     subs)
+  define(`ADDSUBC',    sbcs)
+  define(`COND',       `cs')
+  define(`func',       mpn_submul_1)')
+
+MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
+
+PROLOGUE(func)
+       mov     x15, #0
+
+       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]
+       ADDSUB  x8, x4, x8
+       csinc   x15, x12, x12, COND
+       str     x8, [rp],#8
+
+L(1):  tbz     n, #1, L(2)
+
+       ldp     x4, x5, [up],#16
+       mul     x8, x4, v0
+       umulh   x12, x4, v0
+       mul     x9, x5, v0
+       umulh   x13, x5, v0
+       adds    x8, x8, x15
+       adcs    x9, x9, x12
+       ldp     x4, x5, [rp,#0]
+       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)
+
+L(top):        ldp     x4, x5, [up],#16
+       ldp     x6, x7, [up],#16
+       mul     x8, x4, v0
+       umulh   x12, x4, v0
+       mul     x9, x5, v0
+       umulh   x13, x5, v0
+       adds    x8, x8, x15
+       mul     x10, x6, v0
+       umulh   x14, x6, v0
+       adcs    x9, x9, x12
+       mul     x11, x7, v0
+       umulh   x15, x7, v0
+       adcs    x10, x10, x13
+       ldp     x4, x5, [rp,#0]
+       adcs    x11, x11, x14
+       ldp     x6, x7, [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
+       ret
+EPILOGUE()
diff --git a/mpn/arm64/cnd_aors_n.asm b/mpn/arm64/cnd_aors_n.asm
new file mode 100644 (file)
index 0000000..e783650
--- /dev/null
@@ -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 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    ?
+C Cortex-A57    ?
+
+changecom(@&*$)
+
+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',     `adc    x0, xzr, xzr')
+  define(func,         mpn_cnd_add_n)')
+ifdef(`OPERATION_cnd_sub_n', `
+  define(`ADDSUBC',      sbcs)
+  define(`CLRCY',      `cmp    xzr, xzr')
+  define(`RETVAL',     `sbc    x0, xzr, xzr
+                       and     x0, x0, #1')
+  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/mpn/arm64/copyd.asm b/mpn/arm64/copyd.asm
new file mode 100644 (file)
index 0000000..bb47771
--- /dev/null
@@ -0,0 +1,93 @@
+dnl  ARM64 mpn_copyd.
+
+dnl  Copyright 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 Cortex-A53    ?
+C Cortex-A57    ?
+
+changecom(@&*$)
+
+define(`rp', `x0')
+define(`up', `x1')
+define(`n',  `x2')
+
+ASM_START()
+PROLOGUE(mpn_copyd)
+       add     rp, rp, n, lsl #3
+       add     up, up, n, lsl #3
+
+       cmp     n, #3
+       b.le    L(bc)
+
+C Copy until rp is 128-bit aligned
+       tbz     rp, #3, L(al2)
+       sub     up, up, #8
+       ld1     {v22.1d}, [up]
+       sub     n, n, #1
+       sub     rp, rp, #8
+       st1     {v22.1d}, [rp]
+
+L(al2):        sub     up, up, #16
+       ld1     {v26.2d}, [up]
+       subs    n, n, #6
+       sub     rp, rp, #16                     C offset rp for loop
+       b.lt    L(end)
+
+       sub     up, up, #16                     C offset up for loop
+       mov     x12, #-16
+
+       ALIGN(16)
+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)
+
+       add     up, up, #16                     C undo up offset
+
+L(end):        st1     {v26.2d}, [rp]
+
+C Copy last 0-3 limbs.  Note that rp is aligned after loop, but not when we
+C arrive here via L(bc)
+L(bc): tbz     n, #1, L(tl1)
+       sub     up, up, #16
+       ld1     {v22.2d}, [up]
+       sub     rp, rp, #16
+       st1     {v22.2d}, [rp]
+L(tl1):        tbz     n, #0, L(tl2)
+       sub     up, up, #8
+       ld1     {v22.1d}, [up]
+       sub     rp, rp, #8
+       st1     {v22.1d}, [rp]
+L(tl2):        ret
+EPILOGUE()
diff --git a/mpn/arm64/copyi.asm b/mpn/arm64/copyi.asm
new file mode 100644 (file)
index 0000000..8f7dbd4
--- /dev/null
@@ -0,0 +1,77 @@
+dnl  ARM64 mpn_copyi.
+
+dnl  Copyright 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 Cortex-A53    ?
+C Cortex-A57    ?
+
+changecom(@&*$)
+
+define(`rp', `x0')
+define(`up', `x1')
+define(`n',  `x2')
+
+ASM_START()
+PROLOGUE(mpn_copyi)
+       cmp     n, #3
+       b.le    L(bc)
+
+C Copy until rp is 128-bit aligned
+       tbz     rp, #3, L(al2)
+       ld1     {v22.1d}, [up], #8
+       sub     n, n, #1
+       st1     {v22.1d}, [rp], #8
+
+L(al2):        ld1     {v26.2d}, [up], #16
+       subs    n, n, #6
+       b.lt    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)
+
+L(end):        st1     {v26.2d}, [rp], #16
+
+C Copy last 0-3 limbs.  Note that rp is aligned after loop, but not when we
+C arrive here via L(bc)
+L(bc): tbz     n, #1, L(tl1)
+       ld1     {v22.2d}, [up], #16
+       st1     {v22.2d}, [rp], #16
+L(tl1):        tbz     n, #0, L(tl2)
+       ld1     {v22.1d}, [up]
+       st1     {v22.1d}, [rp]
+L(tl2):        ret
+EPILOGUE()
diff --git a/mpn/arm64/gcd_1.asm b/mpn/arm64/gcd_1.asm
new file mode 100644 (file)
index 0000000..d231dbc
--- /dev/null
@@ -0,0 +1,125 @@
+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
+       bne     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
+       bhi     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
+       blo     L(bmod)
+
+       bl      mpn_mod_1
+
+L(red0):mov    x3, x0
+L(red1):cmp    x3, #0
+       rbit    x12, x3
+       clz     x12, x12
+       bne     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
+       bne     L(top)                  C
+
+L(end):        lsl     x0, x19, x20
+       ldp     x19, x20, [sp,#16]
+       ldp     x29, x30, [sp],#32
+       ret
+EPILOGUE()
diff --git a/mpn/arm64/invert_limb.asm b/mpn/arm64/invert_limb.asm
new file mode 100644 (file)
index 0000000..2302d04
--- /dev/null
@@ -0,0 +1,83 @@
+dnl  ARM64 mpn_invert_limb -- Invert a normalized limb.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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 Cortex-A53     ?
+C Cortex-A57     ?
+
+C Compiler generated, mildly edited.  Could surely be further optimised.
+
+ASM_START()
+PROLOGUE(mpn_invert_limb)
+       lsr     x2, x0, 54
+       adrp    x1, approx_tab
+       and     x2, x2, #0x1fe
+       add     x1, x1, :lo12:approx_tab
+       ldrh    w3, [x1,x2]
+       lsr     x4, x0, 24
+       add     x4, x4, 1
+       ubfiz   x2, x3, 11, 16
+       umull   x3, w3, w3
+       mul     x3, x3, x4
+       sub     x2, x2, #1
+       sub     x2, x2, x3, lsr 40
+       lsl     x3, x2, 60
+       mul     x1, x2, x2
+       msub    x1, x1, x4, x3
+       lsl     x2, x2, 13
+       add     x1, x2, x1, lsr 47
+       and     x2, x0, 1
+       neg     x3, x2
+       and     x3, x3, x1, lsr 1
+       add     x2, x2, x0, lsr 1
+       msub    x2, x1, x2, x3
+       umulh   x2, x2, x1
+       lsl     x1, x1, 31
+       add     x1, x1, x2, lsr 1
+       mul     x3, x1, x0
+       umulh   x2, x1, x0
+       adds    x4, x3, x0
+       adc     x0, x2, x0
+       sub     x0, x1, x0
+       ret
+EPILOGUE()
+
+       RODATA
+       ALIGN(2)
+       TYPE(   approx_tab, object)
+       SIZE(   approx_tab, 512)
+approx_tab:
+forloop(i,256,512-1,dnl
+`      .hword  eval(0x7fd00/i)
+')dnl
diff --git a/mpn/arm64/logops_n.asm b/mpn/arm64/logops_n.asm
new file mode 100644 (file)
index 0000000..0f75700
--- /dev/null
@@ -0,0 +1,106 @@
+dnl  ARM64 mpn_and_n, mpn_andn_n. mpn_nand_n, etc.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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 Cortex-A53    ?
+C Cortex-A57    ?
+
+changecom(@&*$)
+
+define(`rp', `x0')
+define(`up', `x1')
+define(`vp', `x2')
+define(`n',  `x3')
+
+define(`POSTOP', `dnl')
+
+ifdef(`OPERATION_and_n',`
+  define(`func',    `mpn_and_n')
+  define(`LOGOP',   `and       $1, $2, $3')')
+ifdef(`OPERATION_andn_n',`
+  define(`func',    `mpn_andn_n')
+  define(`LOGOP',   `bic       $1, $2, $3')')
+ifdef(`OPERATION_nand_n',`
+  define(`func',    `mpn_nand_n')
+  define(`POSTOP',  `mvn       $1, $1')
+  define(`LOGOP',   `and       $1, $2, $3')')
+ifdef(`OPERATION_ior_n',`
+  define(`func',    `mpn_ior_n')
+  define(`LOGOP',   `orr       $1, $2, $3')')
+ifdef(`OPERATION_iorn_n',`
+  define(`func',    `mpn_iorn_n')
+  define(`LOGOP',   `orn       $1, $2, $3')')
+ifdef(`OPERATION_nior_n',`
+  define(`func',    `mpn_nior_n')
+  define(`POSTOP',  `mvn       $1, $1')
+  define(`LOGOP',   `orr       $1, $2, $3')')
+ifdef(`OPERATION_xor_n',`
+  define(`func',    `mpn_xor_n')
+  define(`LOGOP',   `eor       $1, $2, $3')')
+ifdef(`OPERATION_xnor_n',`
+  define(`func',    `mpn_xnor_n')
+  define(`LOGOP',   `eon       $1, $2, $3')')
+
+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)
+
+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
+       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
+EPILOGUE()
diff --git a/mpn/arm64/mul_1.asm b/mpn/arm64/mul_1.asm
new file mode 100644 (file)
index 0000000..c0c2570
--- /dev/null
@@ -0,0 +1,98 @@
+dnl  ARM64 mpn_mul_1
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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 Cortex-A53    ?
+C Cortex-A57    ?
+
+define(`rp', `x0')
+define(`up', `x1')
+define(`n',  `x2')
+define(`v0', `x3')
+
+ASM_START()
+PROLOGUE(mpn_mul_1)
+       ldr     x12, [up], #8
+       and     x6, n, #3
+       and     n, n, #-4
+       cbz     x6, L(fi0)
+       cmp     x6, #2
+       bcc     L(fi1)
+       beq     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
+       ret
+EPILOGUE()
index 60f6b1a0a015fabb34d679f5c91f7130fc11e8a0..e573cc4ca82d02f971e76245673ed8aeecc567c6 100644 (file)
@@ -2,23 +2,33 @@ divert(-1)
 dnl
 dnl  m4 macros for gmp assembly code, shared by all CPUs.
 
-dnl  Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2011 Free
-dnl  Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2006, 2011 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  These macros are designed for use with any m4 and have been used on
@@ -1233,10 +1243,10 @@ dnl  definitions.  If COUNT is redefined, the LOG2, MASK and BYTES follow
 dnl  the new definition automatically.
 dnl
 dnl  LOG2 is the log base 2 of COUNT.  MASK is COUNT-1, which can be used as
-dnl  a bit mask.  BYTES is BYTES_PER_MP_LIMB*COUNT, the number of bytes
+dnl  a bit mask.  BYTES is GMP_LIMB_BYTES*COUNT, the number of bytes
 dnl  processed in each unrolled loop.
 dnl
-dnl  BYTES_PER_MP_LIMB is defined in a CPU specific m4 include file.  It
+dnl  GMP_LIMB_BYTES is defined in a CPU specific m4 include file.  It
 dnl  exists only so the BYTES definitions here can be common to all CPUs.
 dnl  In the actual code for a given CPU, an explicit 4 or 8 may as well be
 dnl  used because the code is only for a particular CPU, it doesn't need to
@@ -1273,8 +1283,8 @@ m4_assert_defined(`UNROLL_COUNT')
 
 deflit(UNROLL_BYTES,
 m4_assert_defined(`UNROLL_COUNT')
-m4_assert_defined(`BYTES_PER_MP_LIMB')
-`eval(UNROLL_COUNT * BYTES_PER_MP_LIMB)')
+m4_assert_defined(`GMP_LIMB_BYTES')
+`eval(UNROLL_COUNT * GMP_LIMB_BYTES)')
 
 deflit(CHUNK_LOG2,
 m4_assert_defined(`CHUNK_COUNT')
@@ -1286,8 +1296,8 @@ m4_assert_defined(`CHUNK_COUNT')
 
 deflit(CHUNK_BYTES,
 m4_assert_defined(`CHUNK_COUNT')
-m4_assert_defined(`BYTES_PER_MP_LIMB')
-`eval(CHUNK_COUNT * BYTES_PER_MP_LIMB)')
+m4_assert_defined(`GMP_LIMB_BYTES')
+`eval(CHUNK_COUNT * GMP_LIMB_BYTES)')
 
 
 dnl  Usage: MPN(name)
@@ -1323,7 +1333,6 @@ define_mpn(add_err2_n)
 define_mpn(add_err3_n)
 define_mpn(add_n)
 define_mpn(add_nc)
-define_mpn(addcnd_n)
 define_mpn(addlsh1_n)
 define_mpn(addlsh1_nc)
 define_mpn(addlsh2_n)
@@ -1361,11 +1370,14 @@ define_mpn(bdiv_q_1)
 define_mpn(pi1_bdiv_q_1)
 define_mpn(bdiv_dbm1c)
 define_mpn(cmp)
+define_mpn(cnd_add_n)
+define_mpn(cnd_sub_n)
 define_mpn(com)
 define_mpn(copyd)
 define_mpn(copyi)
 define_mpn(count_leading_zeros)
 define_mpn(count_trailing_zeros)
+define_mpn(div_qr_1n_pi1)
 define_mpn(div_qr_2)
 define_mpn(div_qr_2n_pi1)
 define_mpn(div_qr_2u_pi1)
@@ -1448,7 +1460,6 @@ define_mpn(sqr_basecase)
 define_mpn(sqr_diagonal)
 define_mpn(sqr_diag_addlsh1)
 define_mpn(sub_n)
-define_mpn(subcnd_n)
 define_mpn(sublsh1_n)
 define_mpn(sublsh1_nc)
 define_mpn(sublsh1_n_ip1)
@@ -1471,7 +1482,7 @@ define_mpn(sub_n)
 define_mpn(sub_nc)
 define_mpn(submul_1)
 define_mpn(submul_1c)
-define_mpn(tabselect)
+define_mpn(sec_tabselect)
 define_mpn(umul_ppmm)
 define_mpn(umul_ppmm_r)
 define_mpn(udiv_qrnnd)
diff --git a/mpn/clipper/add_n.s b/mpn/clipper/add_n.s
deleted file mode 100644 (file)
index 225b950..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-; Clipper __gmpn_add_n -- Add two limb vectors of the same length > 0 and store
-; sum in a third limb vector.
-
-; Copyright 1995, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-.text
-       .align 16
-.globl ___gmpn_add_n
-___gmpn_add_n:
-       subq    $8,sp
-       storw   r6,(sp)
-       loadw   12(sp),r2
-       loadw   16(sp),r3
-       loadq   $0,r6           ; clear carry-save register
-
-.Loop: loadw   (r1),r4
-       loadw   (r2),r5
-       addwc   r6,r6           ; restore carry from r6
-       addwc   r5,r4
-       storw   r4,(r0)
-       subwc   r6,r6           ; save carry in r6
-       addq    $4,r0
-       addq    $4,r1
-       addq    $4,r2
-       subq    $1,r3
-       brne    .Loop
-
-       negw    r6,r0
-       loadw   (sp),r6
-       addq    $8,sp
-       ret     sp
diff --git a/mpn/clipper/mul_1.s b/mpn/clipper/mul_1.s
deleted file mode 100644 (file)
index 058a317..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-; Clipper __gmpn_mul_1 -- Multiply a limb vector with a limb and store
-; the result in a second limb vector.
-
-; Copyright 1995, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-.text
-       .align  16
-.globl ___gmpn_mul_1
-___gmpn_mul_1:
-       subq    $8,sp
-       storw   r6,(sp)
-       loadw   12(sp),r2
-       loadw   16(sp),r3
-       loadq   $0,r6           ; clear carry limb
-
-.Loop: loadw   (r1),r4
-       mulwux  r3,r4
-       addw    r6,r4           ; add old carry limb into low product limb
-       loadq   $0,r6
-       addwc   r5,r6           ; propagate cy into high product limb
-       storw   r4,(r0)
-       addq    $4,r0
-       addq    $4,r1
-       subq    $1,r2
-       brne    .Loop
-
-       movw    r6,r0
-       loadw   0(sp),r6
-       addq    $8,sp
-       ret     sp
diff --git a/mpn/clipper/sub_n.s b/mpn/clipper/sub_n.s
deleted file mode 100644 (file)
index 58c2cb3..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-; Clipper __gmpn_sub_n -- Subtract two limb vectors of the same length > 0 and
-; store difference in a third limb vector.
-
-; Copyright 1995, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-.text
-       .align 16
-.globl ___gmpn_sub_n
-___gmpn_sub_n:
-       subq    $8,sp
-       storw   r6,(sp)
-       loadw   12(sp),r2
-       loadw   16(sp),r3
-       loadq   $0,r6           ; clear carry-save register
-
-.Loop: loadw   (r1),r4
-       loadw   (r2),r5
-       addwc   r6,r6           ; restore carry from r6
-       subwc   r5,r4
-       storw   r4,(r0)
-       subwc   r6,r6           ; save carry in r6
-       addq    $4,r0
-       addq    $4,r1
-       addq    $4,r2
-       subq    $1,r3
-       brne    .Loop
-
-       negw    r6,r0
-       loadw   (sp),r6
-       addq    $8,sp
-       ret     sp
index fd62f902d13e0ec8e2c67e0a51ce55613dbe9912..25f7cdcbebd03562066e84b936fc891ce016fb04 100755 (executable)
@@ -4,20 +4,31 @@
 
 # Copyright 2001 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 # Usage: cpp-cc --cpp=CPP CC ... file.S ...
index ccd7439978d5c358bea22de78e7a02e6be48f15f..3a347d28050b6cb8dd3ff879a32da21e17f785bc 100644 (file)
@@ -1,19 +1,30 @@
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
@@ -107,4 +118,4 @@ down to 2.5 cycles/limb and mpn_addmul_1 times to 4 cycles/limb.  By
 storing even fewer bits per limb, perhaps 56, it would be possible to
 write a mul_mul_basecase that would run at effectively 1 cycle/limb.
 (Use VM here to better handle the romb-shaped multiply area, perhaps
-rouding operand sizes up to the next power of 2.)
+rounding operand sizes up to the next power of 2.)
index e4f8a0da9b08fbd160171f6d88a494c3b2dc288b..65b53bf87af8f9541fdf5ae28ab4df82764a5332 100644 (file)
@@ -6,17 +6,28 @@ Copyright 1996, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+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.  */
index c981b3d3a8fdf8166f2ba14569102437cad21820..e1d52e4a5f435028f700d43c86b45c7f6378521c 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1996, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 5038e93fefb21e61200f546871389b299c95a57a..611a9d2532d71dc9ab9bcc79db3927913b495416 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1996, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 3234913c1065ba25f058daa1bf88c5dc7655b468..71d2285fd7ec37bad0f5b8ffc6990eead960a738 100644 (file)
@@ -1,22 +1,33 @@
-*     Helper for mpn_mul_1, mpn_addmul_1, and mpn_submul_1 for Cray PVP.
+*    Helper for mpn_mul_1, mpn_addmul_1, and mpn_submul_1 for Cray PVP.
 
-*     Copyright 1996, 2000 Free Software Foundation, Inc.
-*     This file is generated from mulww.f in this same directory.
+*    Copyright 1996, 2000 Free Software Foundation, Inc.
+*    This file is generated from mulww.f in this same directory.
 
-*     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 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.
-
-*     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
-*     Lesser General Public License for more details.
-
-*     You should have received a copy of the GNU Lesser General Public License
-*     along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+*  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/.
 
             IDENT           GMPN_MULWW
 **********************************************
index 94d391c2f9adb8866d262f37b1adad08a072c040..1c2c7cddbea437392cf8e6ce0e81412ce22a4681 100644 (file)
@@ -1,22 +1,33 @@
-*     Helper for mpn_mul_1, mpn_addmul_1, and mpn_submul_1 for Cray PVP.
+*    Helper for mpn_mul_1, mpn_addmul_1, and mpn_submul_1 for Cray PVP.
 
-*     Copyright 1996, 2000 Free Software Foundation, Inc.
-*     This file is generated from mulww.f in this same directory.
+*    Copyright 1996, 2000 Free Software Foundation, Inc.
+*    This file is generated from mulww.f in this same directory.
 
-*     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 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.
-
-*     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
-*     Lesser General Public License for more details.
-
-*     You should have received a copy of the GNU Lesser General Public License
-*     along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+*  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/.
 
             IDENT           GMPN_MULWW
 **********************************************
index 0507d0ef2e7ed152b226ab38012d93b425595dc8..b44c97df45512be03d3605d7bdfc0aea6f27b48a 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1996, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 3ff8f5e1616342fb6f064ddf636932dd4f4c901d..ea8c25b32e215738bb56678a9e3b436136bbe5a3 100644 (file)
@@ -1,25 +1,35 @@
 /* Cray T90 CFP gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002, 2003, 2004 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000-2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 #if 0
 #define UMUL_TIME       519
index d80b4d6324abf4e9ef18d1c3f68fef97474748dc..8eb9ba018cdf9063e0e2751c642b6eea51a5668c 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2000 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+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"
index 158a79cba8dec0e9a4e7af85f1c4b5daeff1ebfa..6318b7c9c295a2353d057945252601f2d294570c 100644 (file)
@@ -1,22 +1,33 @@
 /* Cray PVP/IEEE mpn_addmul_1 -- multiply a limb vector with a limb and add the
    result to a second limb vector.
 
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* This code runs at just under 9 cycles/limb on a T90.  That is not perfect,
    mainly due to vector register shortage in the main loop.  Assembly code
index 3442c11fe2aec419967ce69ed13ecf7dd73ad4dc..1fdc286574adb24645556d051f59069ab163230b 100644 (file)
@@ -1,25 +1,36 @@
 /* Cray T90 IEEE gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002, 2004 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000-2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 /* Generated by tuneup.c, 2004-02-07, system compiler */
 
index 220cc25f01713d5aa24a7582acd01871629d6c6a..f951a6e138407e079937c873029cb52d4e094627 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1991, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 4dc2fd9dec5175ff89ee9e9dc2a64393b8baf87c..dad09fa8cfd0f5b74a140f5365e5c97a3aa8aa7a 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* This code runs at 5 cycles/limb on a T90.  That would probably
    be hard to improve upon, even with assembly code.  */
index ea32db312e2b7ba1c89639a6e8305e7a7c0ab67c..6dc845dd9972ef40fe05afbecc8662bb4d91be7a 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* The most critical loop of this code runs at about 5 cycles/limb on a T90.
    That is not perfect, mainly due to vector register shortage.  */
index 92a9a0e14f25666c3a9febd324ffae2034f55418..840d3dd2607db76828d715b6f024f31c81752cf8 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* This is just mpn_mul_basecase with trivial modifications.  */
 
index 4d7a6b47cd432bb54457eccda090f76c279ae056..27a1939019fa914860d1eaac15212f627784fdf1 100644 (file)
@@ -1,22 +1,33 @@
 /* Cray PVP/IEEE mpn_submul_1 -- multiply a limb vector with a limb and
    subtract the result from a second limb vector.
 
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* This code runs at just under 9 cycles/limb on a T90.  That is not perfect,
    mainly due to vector register shortage in the main loop.  Assembly code
index 4827472540d4602d33e54e5546a5fca9c27ba26f..074f38041a11f07b099c737143e6694731c129ee 100644 (file)
@@ -5,17 +5,28 @@ Copyright (C) 2000 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+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"
index e0bf96e441f6b9f90a04d5c6f2f77fe8c9c61cf6..9bddf05bc972480c6f05ecd241cfc83d5e065f09 100644 (file)
@@ -1,25 +1,36 @@
-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     The GNU MP Library is free software; you can redistribute it and/or
-c     modify it under the terms of the GNU Lesser General Public License as
-c     published by the Free Software Foundation; either version 3 of the
-c     License, or (at your option) any later version.
-
-c     The GNU MP Library is distributed in the hope that it will be useful,
-c     but WITHOUT ANY WARRANTY; without even the implied warranty of
-c     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-c     Lesser General Public License for more details.
-
-c     You should have received a copy of the GNU Lesser General Public License
-c     along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-c     p1[] = hi(a[]*s); the upper limbs of each product
-c     p0[] = low(a[]*s); the corresponding lower limbs
-c     n is number of limbs in the vectors
+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    The GNU MP Library is free software; you can redistribute it and/or modify
+c    it under the terms of either:
+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    or
+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    or both in parallel, as here.
+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    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/.
+
+c    p1[] = hi(a[]*s); the upper limbs of each product
+c    p0[] = low(a[]*s); the corresponding lower limbs
+c    n is number of limbs in the vectors
 
       subroutine gmpn_mulww(p1,p0,a,n,s)
       integer*8 p1(0:*),p0(0:*),a(0:*),s
index 3abdce85ccb7f6939f449259c538e44e055e42dc..48ddab875eda520cde80a19e896d3f691b5f001b 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2000 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+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"
index 3630b628d39e606860588a4d101e189136501861..424bede9db71d3014c6dd5d88455414c24f7e3a1 100644 (file)
@@ -5,17 +5,28 @@ Copyright (C) 2000 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+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"
index 90a5f1b1e83e5a3d2c96316b80192cd12914fe45..0cc9ad1e04ab1132b16e56c23887f1272004bbaa 100644 (file)
@@ -6,17 +6,28 @@ Copyright 1996, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+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.  */
index 8065ccf3c201889bf8648f0a7490664eb0814ad9..559f26133cfc9fcb9dad026c834c8bc04d2f6e8c 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpn_add 1
 
index 2d3fa76c2ed63e869c4605e114d0496116528735..ca2d86685282985e40d875386caf4b32e4319f94 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpn_add_1 1
 
index 8ccba7006413785eb52f61cc345e737675e4d630..b8cb75f6e89040aea9b0f28e8aa9886f900550d3 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index b5dfba73e637975b1e742cf078b43ee021fd3bc8..4b0242a32df4aef5cd8754bad016d293085cd0f1 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 612b82199ebaa3a3b840eded49935db49cbaa3ed..28cd7facf9337b6acfb9ac5bbdc7d58549d26d06 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 47b6df609923af42186d677c5c9f6601d3c9d475..1a0767090040e8585c81ba2ca268b76b2486604b 100644 (file)
@@ -1,22 +1,32 @@
 /* mpn_add_n -- Add equal length limb vectors.
 
-Copyright 1992, 1993, 1994, 1996, 2000, 2002, 2009 Free Software Foundation,
-Inc.
+Copyright 1992-1994, 1996, 2000, 2002, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 21437c67bf5b5b0e5ee2b0b9038a46e5b2706304..012eb3e33adaa254e2f0fb3a9cb76fb9906f3880 100644 (file)
@@ -4,22 +4,33 @@
    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 1999, 2000, 2001, 2006 Free Software Foundation, Inc.
+Copyright 1999-2001, 2006 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -28,7 +39,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #define L1_CACHE_SIZE 8192     /* only 68040 has less than this */
 #endif
 
-#define PART_SIZE (L1_CACHE_SIZE / BYTES_PER_MP_LIMB / 6)
+#define PART_SIZE (L1_CACHE_SIZE / GMP_LIMB_BYTES / 6)
 
 
 /* mpn_add_n_sub_n.
@@ -142,10 +153,10 @@ main (int argc, char **argv)
 
   n = strtol (argv[1], 0, 0);
 
-  r1p = malloc (n * BYTES_PER_MP_LIMB);
-  r2p = malloc (n * BYTES_PER_MP_LIMB);
-  s1p = malloc (n * BYTES_PER_MP_LIMB);
-  s2p = malloc (n * BYTES_PER_MP_LIMB);
+  r1p = malloc (n * GMP_LIMB_BYTES);
+  r2p = malloc (n * GMP_LIMB_BYTES);
+  s1p = malloc (n * GMP_LIMB_BYTES);
+  s2p = malloc (n * GMP_LIMB_BYTES);
   TIME (t,(mpn_add_n(r1p,s1p,s2p,n),mpn_sub_n(r1p,s1p,s2p,n)));
   printf ("              separate add and sub: %.3f\n", t);
   TIME (t,mpn_add_n_sub_n(r1p,r2p,s1p,s2p,n));
diff --git a/mpn/generic/addcnd_n.c b/mpn/generic/addcnd_n.c
deleted file mode 100644 (file)
index 256cfbb..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/* mpn_addcnd_n -- Compute R = U + V if CND != 0 or R = U if CND == 0.
-   Both cases should take the same time and perform the exact same memory
-   accesses, since this function is intended to be used where side-channel
-   attack resilience is relevant.
-
-   THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE.  IT IS ONLY
-   SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
-
-Copyright 1992, 1993, 1994, 1996, 2000, 2002, 2008, 2009, 2011 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 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.
-
-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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-
-mp_limb_t
-mpn_addcnd_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t cnd)
-{
-  mp_limb_t ul, vl, sl, rl, cy, cy1, cy2, mask;
-
-  ASSERT (n >= 1);
-  ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
-  ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
-
-  mask = -(mp_limb_t) (cnd != 0);
-  cy = 0;
-  do
-    {
-      ul = *up++;
-      vl = *vp++ & mask;
-#if GMP_NAIL_BITS == 0
-      sl = ul + vl;
-      cy1 = sl < ul;
-      rl = sl + cy;
-      cy2 = rl < sl;
-      cy = cy1 | cy2;
-      *rp++ = rl;
-#else
-      rl = ul + vl;
-      rl += cy;
-      cy = rl >> GMP_NUMB_BITS;
-      *rp++ = rl & GMP_NUMB_MASK;
-#endif
-    }
-  while (--n != 0);
-
-  return cy;
-}
index 861e1bc830f54e9c258b10f1058b98d124d37f15..d76b4ad135066f56bdbed5b07001f662e8e5b18a 100644 (file)
@@ -3,23 +3,33 @@
    pointed to by RP.  Return the most significant limb of the product,
    adjusted for carry-out from the addition.
 
-Copyright 1992, 1993, 1994, 1996, 2000, 2002, 2004 Free Software Foundation,
-Inc.
+Copyright 1992-1994, 1996, 2000, 2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 23cb6f1c9ed9a147efef0d4a6e15c4ebede259d6..22c3cfd2c80864ae256cfcc9b18f7536f1586219 100644 (file)
@@ -10,17 +10,28 @@ Copyright 2008, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 7cb62e8ea8b1745985927662b8d0818dc6b9ccb9..1fc1bb7c099dae5f323925feb83261f786f29377 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2006, 2007, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 727f9f0d404f22ea5bf9cb7053aff9293bbd0932..74b247d5a9ab9639a2eec55a1ac6ad177bc4b136 100644 (file)
@@ -5,22 +5,33 @@
    CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
    FUTURE GNU MP RELEASES.
 
-Copyright 2000, 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
+Copyright 2000-2003, 2005, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 8bac03e04169353ea9334c80449fa8e898107eda..6a5eedbbc2f5032964167d77bd0d27d93df5b5c2 100644 (file)
@@ -12,17 +12,28 @@ Copyright 2006, 2007, 2009, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 2ed91f31a50b89bc178524ed74a0e351408a137a..be27ea552e7856eb91e04dab2ddc0874071374d5 100644 (file)
@@ -6,23 +6,33 @@
    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, 2005, 2006, 2007, 2009, 2012 Free Software
-Foundation, Inc.
+Copyright (C) 2004-2007, 2009, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 93d3292b7ae604f856cce89996e6f304a2c14d93..6974ac8b9e811acba2ff4dbcf1bd81ad0058e813 100644 (file)
@@ -1,6 +1,6 @@
 /* mpn_broot -- Compute hensel sqrt
 
-   Contributed to the GNU project by Niels Möller
+   Contributed to the GNU project by Niels Möller
 
    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
@@ -11,17 +11,28 @@ Copyright 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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,14 +70,14 @@ powlimb (mp_limb_t a, mp_limb_t e)
 
      r' = r - (a^{k-1} r^{k+1} - r) / k
 
-   where we still have cancelation of low limbs.
+   where we still have cancellation of low limbs.
 
  */
 void
 mpn_broot_invm1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t k)
 {
   mp_size_t sizes[GMP_LIMB_BITS * 2];
-  mp_ptr akm1, tp, rnp, ep, scratch;
+  mp_ptr akm1, tp, rnp, ep;
   mp_limb_t a0, r0, km1, kp1h, kinv;
   mp_size_t rn;
   unsigned i;
@@ -142,11 +153,10 @@ mpn_broot_invm1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t k)
     {
       /* Compute x^{k+1}. */
       mpn_sqr (ep, rp, rn); /* For odd n, writes n+1 limbs in the
-                              final iteration.*/
+                              final iteration. */
       mpn_powlo (rnp, ep, &kp1h, 1, sizes[i], tp);
 
-      /* Multiply by a^{k-1}. Can use wraparound; low part equals
-        r. */
+      /* Multiply by a^{k-1}. Can use wraparound; low part equals r. */
 
       mpn_mullo_n (ep, rnp, akm1, sizes[i]);
       ASSERT (mpn_cmp (ep, rp, rn) == 0);
index 3ab547d007cf7ffbe7643492424bc0d69693b5c8..b96c97f1d36e0a865cc9b7bc4b14f2d95952f224 100644 (file)
@@ -2,22 +2,33 @@
 
    Contributed to the GNU project by Martin Boij (as part of perfpow.c).
 
-Copyright 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 2009, 2010, 2012, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -27,12 +38,11 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 static mp_limb_t
 powlimb (mp_limb_t a, mp_limb_t e)
 {
-  mp_limb_t r = 1;
-  mp_limb_t s = a;
+  mp_limb_t r;
 
-  for (r = 1, s = a; e > 0; e >>= 1, s *= s)
+  for (r = 1; e > 0; e >>= 1, a *= a)
     if (e & 1)
-      r *= s;
+      r *= a;
 
   return r;
 }
@@ -80,20 +90,19 @@ mpn_brootinv (mp_ptr rp, mp_srcptr yp, mp_size_t bn, mp_limb_t k, mp_ptr tp)
   /* 4-bit initial approximation:
 
    y%16 | 1  3  5  7  9 11 13 15,
-    k%4 +-----------------------------
-     1  | 1 11 13  7  9  3  5 15
-     3  | 1  3  5  7  9 11 13 15
+    k%4 +-------------------------+k2%4
+     1  | 1 11 13  7  9  3  5 15  |  2
+     3  | 1  3  5  7  9 11 13 15  |  0
 
   */
   y0 = yp[0];
 
-  r0 = y0 ^ (((y0 << 1) ^ (y0 << 2)) & ~(k << 2) & 8);         /* 4 bits */
+  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 & 0xffff));       /* 16 bits */
-  r0 = kinv * (k2 * r0 - y0 * powlimb(r0, k2));                        /* 32 bits */
-#if GMP_NUMB_BITS > 32
+  r0 = kinv * (k2 * r0 - y0 * powlimb(r0, k2 & 0x7fff));       /* 16 bits */
+#if GMP_NUMB_BITS > 16
   {
-    unsigned prec = 32;
+    unsigned prec = 16;
     do
       {
        r0 = kinv * (k2 * r0 - y0 * powlimb(r0, k2));
index a9f49e6ce5be761a32092e7e0e7090f6b9178c04..18ba26f440bdbb9f3f27a1dae7a16fac1f4c1525 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2009, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 2dfd02bf689e24f207b4219c217e3b211e0a15f6..33df6a3c15856bbd62dbe1036eb9012dac8ac05b 100644 (file)
@@ -7,17 +7,28 @@ Copyright 2009, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index d352076599ed57aeaa460cf76857f5c9cb57ea0a..18c7b428444c4fa0efba2a4cb555f19b95e3121c 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1991, 1993, 1994, 1996, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpn_cmp 1
 
diff --git a/mpn/generic/cnd_add_n.c b/mpn/generic/cnd_add_n.c
new file mode 100644 (file)
index 0000000..443f985
--- /dev/null
@@ -0,0 +1,70 @@
+/* mpn_cnd_add_n -- Compute R = U + V if CND != 0 or R = U if CND == 0.
+   Both cases should take the same time and perform the exact same memory
+   accesses, since this function is intended to be used where side-channel
+   attack resilience is relevant.
+
+Copyright 1992-1994, 1996, 2000, 2002, 2008, 2009, 2011, 2013 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.h"
+#include "gmp-impl.h"
+
+mp_limb_t
+mpn_cnd_add_n (mp_limb_t cnd, mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
+{
+  mp_limb_t ul, vl, sl, rl, cy, cy1, cy2, mask;
+
+  ASSERT (n >= 1);
+  ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
+  ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
+
+  mask = -(mp_limb_t) (cnd != 0);
+  cy = 0;
+  do
+    {
+      ul = *up++;
+      vl = *vp++ & mask;
+#if GMP_NAIL_BITS == 0
+      sl = ul + vl;
+      cy1 = sl < ul;
+      rl = sl + cy;
+      cy2 = rl < sl;
+      cy = cy1 | cy2;
+      *rp++ = rl;
+#else
+      rl = ul + vl;
+      rl += cy;
+      cy = rl >> GMP_NUMB_BITS;
+      *rp++ = rl & GMP_NUMB_MASK;
+#endif
+    }
+  while (--n != 0);
+
+  return cy;
+}
diff --git a/mpn/generic/cnd_sub_n.c b/mpn/generic/cnd_sub_n.c
new file mode 100644 (file)
index 0000000..bd8e029
--- /dev/null
@@ -0,0 +1,70 @@
+/* mpn_cnd_sub_n -- Compute R = U - V if CND != 0 or R = U if CND == 0.
+   Both cases should take the same time and perform the exact same memory
+   accesses, since this function is intended to be used where side-channel
+   attack resilience is relevant.
+
+Copyright 1992-1994, 1996, 2000, 2002, 2008, 2009, 2011, 2013 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.h"
+#include "gmp-impl.h"
+
+mp_limb_t
+mpn_cnd_sub_n (mp_limb_t cnd, mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
+{
+  mp_limb_t ul, vl, sl, rl, cy, cy1, cy2, mask;
+
+  ASSERT (n >= 1);
+  ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
+  ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
+
+  mask = -(mp_limb_t) (cnd != 0);
+  cy = 0;
+  do
+    {
+      ul = *up++;
+      vl = *vp++ & mask;
+#if GMP_NAIL_BITS == 0
+      sl = ul - vl;
+      cy1 = sl > ul;
+      rl = sl - cy;
+      cy2 = rl > sl;
+      cy = cy1 | cy2;
+      *rp++ = rl;
+#else
+      rl = ul - vl;
+      rl -= cy;
+      cy = rl >> (GMP_LIMB_BITS - 1);
+      *rp++ = rl & GMP_NUMB_MASK;
+#endif
+    }
+  while (--n != 0);
+
+  return cy;
+}
index ed817e6aafa6a2fcf981acf33bc2902cfaf8e0d8..cd8551df5bac99d16745dd931fb75ef8de27dc4b 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index de725d0f935c0788b65a2e9639ac4a207930f866..41bcb5f879da931cfc63dc43740ee7facef872cc 100644 (file)
@@ -8,17 +8,28 @@ Copyright 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 2a08ef48b5f7f5e6d836b58a5902468b17252e36..ba3380a82bbe1517a33f9a0ce29d9ecbb48af8d9 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index c0a047b42a16fc5a927427c0ca4098d39e4fa85f..0c39b4534bbb52926716f4148c62841dd776c6bc 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 2bc85efc4ec387915e1622de3565acdbe4f36448..a7b86c96d44b48b844120c983ee809defcd6482d 100644 (file)
@@ -1,28 +1,39 @@
 /* mpn_dcpi1_bdiv_q -- divide-and-conquer Hensel division with precomputed
    inverse, returning quotient.
 
-   Contributed to the GNU project by Niels Möller and Torbjorn Granlund.
+   Contributed to the GNU project by Niels Möller and 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 GMP RELEASE.
 
-Copyright 2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+Copyright 2006, 2007, 2009-2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 28cc82e6ff1073cd0a39d7b126b570f10a526202..8a251f8d9d8f46776175a34288049a7899653df8 100644 (file)
@@ -1,7 +1,7 @@
 /* mpn_dcpi1_bdiv_qr -- divide-and-conquer Hensel division with precomputed
    inverse, returning quotient and remainder.
 
-   Contributed to the GNU project by Niels Möller and Torbjorn Granlund.
+   Contributed to the GNU project by Niels Möller and 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
@@ -12,17 +12,28 @@ Copyright 2006, 2007, 2009, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 9e5cea520132f7e96000200735c81c163c7c3d73..32d74c31a9f3582952b7251116b2fcfe31154d62 100644 (file)
@@ -12,17 +12,28 @@ Copyright 2006, 2007, 2009, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 815173eb09123e636c7392aa8b92d0ef367c98c6..4d80c7b769265c02be9efca02a3ec1420f503d2f 100644 (file)
@@ -12,17 +12,28 @@ Copyright 2006, 2007, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index a0f79edfbb1bbbac70a6afe3f3c901a1b5afa858..c7b03c7f4962d3352fa61926f87c1a2ed0802150 100644 (file)
@@ -12,17 +12,28 @@ Copyright 2006, 2007, 2009, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index b2a0fff8ea730045cf4ac62f9b023e24e4021afe..aabcef08254fcadcfd99c4ed97083f174dd73c26 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2009, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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/mpn/generic/div_qr_1.c b/mpn/generic/div_qr_1.c
new file mode 100644 (file)
index 0000000..09401ac
--- /dev/null
@@ -0,0 +1,126 @@
+/* mpn_div_qr_1 -- mpn by limb division.
+
+   Contributed to the GNU project by Niels Möller and Torbjörn Granlund
+
+Copyright 1991, 1993, 1994, 1996, 1998-2000, 2002, 2003, 2013 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.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+#ifndef DIV_QR_1_NORM_THRESHOLD
+#define DIV_QR_1_NORM_THRESHOLD 3
+#endif
+#ifndef DIV_QR_1_UNNORM_THRESHOLD
+#define DIV_QR_1_UNNORM_THRESHOLD 3
+#endif
+
+#if GMP_NAIL_BITS > 0
+#error Nail bits not supported
+#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. */
+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)
+{
+  unsigned cnt;
+  mp_limb_t uh;
+
+  ASSERT (n > 0);
+  ASSERT (d > 0);
+
+  if (d & GMP_NUMB_HIGHBIT)
+    {
+      /* Normalized case */
+      mp_limb_t dinv, q;
+
+      uh = up[--n];
+
+      q = (uh >= d);
+      *qh = q;
+      uh -= (-q) & d;
+
+      if (BELOW_THRESHOLD (n, DIV_QR_1_NORM_THRESHOLD))
+       {
+         cnt = 0;
+       plain:
+         while (n > 0)
+           {
+             mp_limb_t ul = up[--n];
+             udiv_qrnnd (qp[n], uh, uh, ul, d);
+           }
+         return uh >> cnt;
+       }
+      invert_limb (dinv, d);
+      return mpn_div_qr_1n_pi1 (qp, up, n, uh, d, dinv);
+    }
+  else
+    {
+      /* Unnormalized case */
+      mp_limb_t dinv, ul;
+
+      if (! UDIV_NEEDS_NORMALIZATION
+         && BELOW_THRESHOLD (n, DIV_QR_1_UNNORM_THRESHOLD))
+       {
+         uh = up[--n];
+         udiv_qrnnd (*qh, uh, CNST_LIMB(0), uh, d);
+         cnt = 0;
+         goto plain;
+       }
+
+      count_leading_zeros (cnt, d);
+      d <<= cnt;
+
+#if HAVE_NATIVE_div_qr_1u_pi1
+      /* FIXME: Call loop doing on-the-fly normalization */
+#endif
+
+      /* Shift up front, use qp area for shifted copy. A bit messy,
+        since we have only n-1 limbs available, and shift the high
+        limb manually. */
+      uh = up[--n];
+      ul = (uh << cnt) | mpn_lshift (qp, up, n, cnt);
+      uh >>= (GMP_LIMB_BITS - cnt);
+
+      if (UDIV_NEEDS_NORMALIZATION
+         && BELOW_THRESHOLD (n, DIV_QR_1_UNNORM_THRESHOLD))
+       {
+         udiv_qrnnd (*qh, uh, uh, ul, d);
+         up = qp;
+         goto plain;
+       }
+      invert_limb (dinv, d);
+
+      udiv_qrnnd_preinv (*qh, uh, uh, ul, d, dinv);
+      return mpn_div_qr_1n_pi1 (qp, qp, n, uh, d, dinv) >> cnt;
+    }
+}
diff --git a/mpn/generic/div_qr_1n_pi1.c b/mpn/generic/div_qr_1n_pi1.c
new file mode 100644 (file)
index 0000000..229ee09
--- /dev/null
@@ -0,0 +1,277 @@
+/* mpn_div_qr_1n_pi1
+
+   Contributed to the GNU project by Niels Möller
+
+   THIS FILE CONTAINS 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 GNU MP RELEASE.
+
+
+Copyright 2013 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.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+#if GMP_NAIL_BITS > 0
+#error Nail bits not supported
+#endif
+
+#ifndef DIV_QR_1N_METHOD
+#define DIV_QR_1N_METHOD 2
+#endif
+
+/* FIXME: Duplicated in mod_1_1.c. Move to gmp-impl.h */
+
+#if defined (__GNUC__)
+
+#if HAVE_HOST_CPU_FAMILY_x86 && W_TYPE_SIZE == 32
+#define add_mssaaaa(m, s1, s0, a1, a0, b1, b0)                         \
+  __asm__ (  "add      %6, %k2\n\t"                                    \
+            "adc       %4, %k1\n\t"                                    \
+            "sbb       %k0, %k0"                                       \
+          : "=r" (m), "=r" (s1), "=&r" (s0)                            \
+          : "1"  ((USItype)(a1)), "g" ((USItype)(b1)),                 \
+            "%2" ((USItype)(a0)), "g" ((USItype)(b0)))
+#endif
+
+#if HAVE_HOST_CPU_FAMILY_x86_64 && W_TYPE_SIZE == 64
+#define add_mssaaaa(m, s1, s0, a1, a0, b1, b0)                         \
+  __asm__ (  "add      %6, %q2\n\t"                                    \
+            "adc       %4, %q1\n\t"                                    \
+            "sbb       %q0, %q0"                                       \
+          : "=r" (m), "=r" (s1), "=&r" (s0)                            \
+          : "1"  ((UDItype)(a1)), "rme" ((UDItype)(b1)),               \
+            "%2" ((UDItype)(a0)), "rme" ((UDItype)(b0)))
+#endif
+
+#if defined (__sparc__) && W_TYPE_SIZE == 32
+#define add_mssaaaa(m, sh, sl, ah, al, bh, bl)                         \
+  __asm__ (  "addcc    %r5, %6, %2\n\t"                                \
+            "addxcc    %r3, %4, %1\n\t"                                \
+            "subx      %%g0, %%g0, %0"                                 \
+          : "=r" (m), "=r" (sh), "=&r" (sl)                            \
+          : "rJ" (ah), "rI" (bh), "%rJ" (al), "rI" (bl)                \
+        __CLOBBER_CC)
+#endif
+
+#if defined (__sparc__) && W_TYPE_SIZE == 64
+#define add_mssaaaa(m, sh, sl, ah, al, bh, bl)                         \
+  __asm__ (  "addcc    %r5, %6, %2\n\t"                                \
+            "addccc    %r7, %8, %%g0\n\t"                              \
+            "addccc    %r3, %4, %1\n\t"                                \
+            "clr       %0\n\t"                                         \
+            "movcs     %%xcc, -1, %0"                                  \
+          : "=r" (m), "=r" (sh), "=&r" (sl)                            \
+          : "rJ" (ah), "rI" (bh), "%rJ" (al), "rI" (bl),               \
+            "rJ" ((al) >> 32), "rI" ((bl) >> 32)                       \
+        __CLOBBER_CC)
+#if __VIS__ >= 0x300
+#undef add_mssaaaa
+#define add_mssaaaa(m, sh, sl, ah, al, bh, bl)                         \
+  __asm__ (  "addcc    %r5, %6, %2\n\t"                                \
+            "addxccc   %r3, %4, %1\n\t"                                \
+            "clr       %0\n\t"                                         \
+            "movcs     %%xcc, -1, %0"                                  \
+          : "=r" (m), "=r" (sh), "=&r" (sl)                            \
+          : "rJ" (ah), "rI" (bh), "%rJ" (al), "rI" (bl)                \
+        __CLOBBER_CC)
+#endif
+#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_mssaaaa(m, s1, s0, a1, a0, b1, b0)                         \
+  __asm__ (  "add%I6c  %2, %5, %6\n\t"                                 \
+            "adde      %1, %3, %4\n\t"                                 \
+            "subfe     %0, %0, %0\n\t"                                 \
+            "nor       %0, %0, %0"                                     \
+          : "=r" (m), "=r" (s1), "=&r" (s0)                            \
+          : "r"  (a1), "r" (b1), "%r" (a0), "rI" (b0))
+#endif
+
+#if defined (__s390x__) && W_TYPE_SIZE == 64
+#define add_mssaaaa(m, s1, s0, a1, a0, b1, b0)                         \
+  __asm__ (  "algr     %2, %6\n\t"                                     \
+            "alcgr     %1, %4\n\t"                                     \
+            "lghi      %0, 0\n\t"                                      \
+            "alcgr     %0, %0\n\t"                                     \
+            "lcgr      %0, %0"                                         \
+          : "=r" (m), "=r" (s1), "=&r" (s0)                            \
+          : "1"  ((UDItype)(a1)), "r" ((UDItype)(b1)),                 \
+            "%2" ((UDItype)(a0)), "r" ((UDItype)(b0)) __CLOBBER_CC)
+#endif
+
+#if defined (__arm__) && W_TYPE_SIZE == 32
+#define add_mssaaaa(m, sh, sl, ah, al, bh, bl)                         \
+  __asm__ (  "adds     %2, %5, %6\n\t"                                 \
+            "adcs      %1, %3, %4\n\t"                                 \
+            "movcc     %0, #0\n\t"                                     \
+            "movcs     %0, #-1"                                        \
+          : "=r" (m), "=r" (sh), "=&r" (sl)                            \
+          : "r" (ah), "rI" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC)
+#endif
+#endif /* defined (__GNUC__) */
+
+#ifndef add_mssaaaa
+#define add_mssaaaa(m, s1, s0, a1, a0, b1, b0)                         \
+  do {                                                                 \
+    UWtype __s0, __s1, __c0, __c1;                                     \
+    __s0 = (a0) + (b0);                                                        \
+    __s1 = (a1) + (b1);                                                        \
+    __c0 = __s0 < (a0);                                                        \
+    __c1 = __s1 < (a1);                                                        \
+    (s0) = __s0;                                                       \
+    __s1 = __s1 + __c0;                                                        \
+    (s1) = __s1;                                                       \
+    (m) = - (__c1 + (__s1 < __c0));                                    \
+  } while (0)
+#endif
+
+#if DIV_QR_1N_METHOD == 1
+
+/* Divides (uh B^n + {up, n}) by d, storing the quotient at {qp, n}.
+   Requires that uh < d. */
+mp_limb_t
+mpn_div_qr_1n_pi1 (mp_ptr qp, mp_srcptr up, mp_size_t n, mp_limb_t uh,
+                  mp_limb_t d, mp_limb_t dinv)
+{
+  ASSERT (n > 0);
+  ASSERT (uh < d);
+  ASSERT (d & GMP_NUMB_HIGHBIT);
+  ASSERT (MPN_SAME_OR_SEPARATE_P (qp, up, n));
+
+  do
+    {
+      mp_limb_t q, ul;
+
+      ul = up[--n];
+      udiv_qrnnd_preinv (q, uh, uh, ul, d, dinv);
+      qp[n] = q;
+    }
+  while (n > 0);
+
+  return uh;
+}
+
+#elif DIV_QR_1N_METHOD == 2
+
+mp_limb_t
+mpn_div_qr_1n_pi1 (mp_ptr qp, mp_srcptr up, mp_size_t n, mp_limb_t u1,
+                  mp_limb_t d, mp_limb_t dinv)
+{
+  mp_limb_t B2;
+  mp_limb_t u0, u2;
+  mp_limb_t q0, q1;
+  mp_limb_t p0, p1;
+  mp_limb_t t;
+  mp_size_t j;
+
+  ASSERT (d & GMP_LIMB_HIGHBIT);
+  ASSERT (n > 0);
+  ASSERT (u1 < d);
+
+  if (n == 1)
+    {
+      udiv_qrnnd_preinv (qp[0], u1, u1, up[0], d, dinv);
+      return u1;
+    }
+
+  /* FIXME: Could be precomputed */
+  B2 = -d*dinv;
+
+  umul_ppmm (q1, q0, dinv, u1);
+  umul_ppmm (p1, p0, B2, u1);
+  q1 += u1;
+  ASSERT (q1 >= u1);
+  u0 = up[n-1];        /* Early read, to allow qp == up. */
+  qp[n-1] = q1;
+
+  add_mssaaaa (u2, u1, u0, u0, up[n-2], p1, p0);
+
+  /* FIXME: Keep q1 in a variable between iterations, to reduce number
+     of memory accesses. */
+  for (j = n-2; j-- > 0; )
+    {
+      mp_limb_t q2, cy;
+
+      /* Additions for the q update:
+       *       +-------+
+       *        |u1 * v |
+       *        +---+---+
+       *        | u1|
+       *    +---+---+
+       *    | 1 | v |  (conditional on u2)
+       *    +---+---+
+       *        | 1 |  (conditional on u0 + u2 B2 carry)
+       *        +---+
+       * +      | q0|
+       *   -+---+---+---+
+       *    | q2| q1| q0|
+       *    +---+---+---+
+      */
+      umul_ppmm (p1, t, u1, dinv);
+      add_ssaaaa (q2, q1, -u2, u2 & dinv, CNST_LIMB(0), u1);
+      add_ssaaaa (q2, q1, q2, q1, CNST_LIMB(0), p1);
+      add_ssaaaa (q2, q1, q2, q1, CNST_LIMB(0), q0);
+      q0 = t;
+
+      umul_ppmm (p1, p0, u1, B2);
+      ADDC_LIMB (cy, u0, u0, u2 & B2);
+      u0 -= (-cy) & d;
+
+      /* Final q update */
+      add_ssaaaa (q2, q1, q2, q1, CNST_LIMB(0), cy);
+      qp[j+1] = q1;
+      MPN_INCR_U (qp+j+2, n-j-2, q2);
+
+      add_mssaaaa (u2, u1, u0, u0, up[j], p1, p0);
+    }
+
+  q1 = (u2 > 0);
+  u1 -= (-q1) & d;
+
+  t = (u1 >= d);
+  q1 += t;
+  u1 -= (-t) & d;
+
+  udiv_qrnnd_preinv (t, u0, u1, u0, d, dinv);
+  add_ssaaaa (q1, q0, q1, q0, CNST_LIMB(0), t);
+
+  MPN_INCR_U (qp+1, n-1, q1);
+
+  qp[0] = q0;
+  return u0;
+}
+
+#else
+#error Unknown DIV_QR_1N_METHOD
+#endif
diff --git a/mpn/generic/div_qr_1n_pi2.c b/mpn/generic/div_qr_1n_pi2.c
new file mode 100644 (file)
index 0000000..7ea3410
--- /dev/null
@@ -0,0 +1,195 @@
+/* mpn_div_qr_1u_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.
+
+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/.  */
+
+/* ISSUES:
+
+   * Can we really use the high pi2 inverse limb for udiv_qrnnd_preinv?
+
+   * Are there any problems with generating n quotient limbs in the q area?  It
+     surely simplifies things.
+
+   * 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.
+*/
+#if defined (__GNUC__)  && ! defined (__INTEL_COMPILER)
+
+#if HAVE_HOST_CPU_FAMILY_x86 && W_TYPE_SIZE == 32
+#define add_sssaaaa(s2, s1, s0, a1, a0, b1, b0)                                \
+  __asm__ ("add\t%7, %k2\n\tadc\t%5, %k1\n\tadc\t$0, %k0"              \
+          : "=r" (s2), "=&r" (s1), "=&r" (s0)                          \
+          : "0"  ((USItype)(s2)),                                      \
+            "1"  ((USItype)(a1)), "g" ((USItype)(b1)),                 \
+            "%2" ((USItype)(a0)), "g" ((USItype)(b0)))
+#endif
+
+#if defined (__amd64__) && W_TYPE_SIZE == 64
+#define add_sssaaaa(s2, s1, s0, a1, a0, b1, b0)                                \
+  __asm__ ("add\t%7, %q2\n\tadc\t%5, %q1\n\tadc\t$0, %q0"              \
+          : "=r" (s2), "=&r" (s1), "=&r" (s0)                          \
+          : "0"  ((UDItype)(s2)),                                      \
+            "1"  ((UDItype)(a1)), "rme" ((UDItype)(b1)),               \
+            "%2" ((UDItype)(a0)), "rme" ((UDItype)(b0)))
+#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"       \
+          : "=r" (s2), "=&r" (s1), "=&r" (s0)                          \
+          : "r"  (s2), "r"  (a1), "r" (b1), "%r" (a0), "rI" (b0))
+#endif
+
+#endif /* __GNUC__ */
+
+#ifndef add_sssaaaa
+#define add_sssaaaa(s2, s1, s0, a1, a0, b1, b0)                                \
+  do {                                                                 \
+    UWtype __s0, __s1, __c0, __c1;                                     \
+    __s0 = (a0) + (b0);                                                        \
+    __s1 = (a1) + (b1);                                                        \
+    __c0 = __s0 < (a0);                                                        \
+    __c1 = __s1 < (a1);                                                        \
+    (s0) = __s0;                                                       \
+    __s1 = __s1 + __c0;                                                        \
+    (s1) = __s1;                                                       \
+    (s2) += __c1 + (__s1 < __c0);                                      \
+  } while (0)
+#endif
+
+struct precomp_div_1_pi2
+{
+  mp_limb_t dip[2];
+  mp_limb_t d;
+  int norm_cnt;
+};
+
+mp_limb_t
+mpn_div_qr_1n_pi2 (mp_ptr qp,
+                  mp_srcptr up, mp_size_t un,
+                  struct precomp_div_1_pi2 *pd)
+{
+  mp_limb_t most_significant_q_limb;
+  mp_size_t i;
+  mp_limb_t r, u2, u1, u0;
+  mp_limb_t d0, di1, di0;
+  mp_limb_t q3a, q2a, q2b, q1b, q2c, q1c, q1d, q0d;
+  mp_limb_t cnd;
+
+  ASSERT (un >= 2);
+  ASSERT ((pd->d & GMP_NUMB_HIGHBIT) != 0);
+  ASSERT (! MPN_OVERLAP_P (qp, un-2, up, un) || qp+2 >= up);
+  ASSERT_MPN (up, un);
+
+#define q3 q3a
+#define q2 q2b
+#define q1 q1b
+
+  up += un - 3;
+  r = up[2];
+  d0 = pd->d;
+
+  most_significant_q_limb = (r >= d0);
+  r -= d0 & -most_significant_q_limb;
+
+  qp += un - 3;
+  qp[2] = most_significant_q_limb;
+
+  di1 = pd->dip[1];
+  di0 = pd->dip[0];
+
+  for (i = un - 3; i >= 0; i -= 2)
+    {
+      u2 = r;
+      u1 = up[1];
+      u0 = up[0];
+
+      /* Dividend in {r,u1,u0} */
+
+      umul_ppmm (q1d,q0d, u1, di0);
+      umul_ppmm (q2b,q1b, u1, di1);
+      q2b++;                           /* cannot spill */
+      add_sssaaaa (r,q2b,q1b, q2b,q1b, u1,u0);
+
+      umul_ppmm (q2c,q1c, u2,  di0);
+      add_sssaaaa (r,q2b,q1b, q2b,q1b, q2c,q1c);
+      umul_ppmm (q3a,q2a, u2, di1);
+
+      add_sssaaaa (r,q2b,q1b, q2b,q1b, q2a,q1d);
+
+      q3 += r;
+
+      r = u0 - q2 * d0;
+
+      cnd = (r >= q1);
+      r += d0 & -cnd;
+      sub_ddmmss (q3,q2,  q3,q2,  0,cnd);
+
+      if (UNLIKELY (r >= d0))
+       {
+         r -= d0;
+         add_ssaaaa (q3,q2,  q3,q2,  0,1);
+       }
+
+      qp[0] = q2;
+      qp[1] = q3;
+
+      up -= 2;
+      qp -= 2;
+    }
+
+  if ((un & 1) == 0)
+    {
+      u2 = r;
+      u1 = up[1];
+
+      udiv_qrnnd_preinv (q3, r, u2, u1, d0, di1);
+      qp[1] = q3;
+    }
+
+  return r;
+
+#undef q3
+#undef q2
+#undef q1
+}
diff --git a/mpn/generic/div_qr_1u_pi2.c b/mpn/generic/div_qr_1u_pi2.c
new file mode 100644 (file)
index 0000000..83d66ef
--- /dev/null
@@ -0,0 +1,228 @@
+/* mpn_div_qr_1u_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.
+
+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/.  */
+
+/* ISSUES:
+
+   * Can we really use the high pi2 inverse limb for udiv_qrnnd_preinv?
+
+   * Are there any problems with generating n quotient limbs in the q area?  It
+     surely simplifies things.
+
+   * 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.
+*/
+#if defined (__GNUC__)  && ! defined (__INTEL_COMPILER)
+
+#if HAVE_HOST_CPU_FAMILY_x86 && W_TYPE_SIZE == 32
+#define add_sssaaaa(s2, s1, s0, a1, a0, b1, b0)                                \
+  __asm__ ("add\t%7, %k2\n\tadc\t%5, %k1\n\tadc\t$0, %k0"              \
+          : "=r" (s2), "=&r" (s1), "=&r" (s0)                          \
+          : "0"  ((USItype)(s2)),                                      \
+            "1"  ((USItype)(a1)), "g" ((USItype)(b1)),                 \
+            "%2" ((USItype)(a0)), "g" ((USItype)(b0)))
+#endif
+
+#if defined (__amd64__) && W_TYPE_SIZE == 64
+#define add_sssaaaa(s2, s1, s0, a1, a0, b1, b0)                                \
+  __asm__ ("add\t%7, %q2\n\tadc\t%5, %q1\n\tadc\t$0, %q0"              \
+          : "=r" (s2), "=&r" (s1), "=&r" (s0)                          \
+          : "0"  ((UDItype)(s2)),                                      \
+            "1"  ((UDItype)(a1)), "rme" ((UDItype)(b1)),               \
+            "%2" ((UDItype)(a0)), "rme" ((UDItype)(b0)))
+#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"       \
+          : "=r" (s2), "=&r" (s1), "=&r" (s0)                          \
+          : "r"  (s2), "r"  (a1), "r" (b1), "%r" (a0), "rI" (b0))
+#endif
+
+#endif /* __GNUC__ */
+
+#ifndef add_sssaaaa
+#define add_sssaaaa(s2, s1, s0, a1, a0, b1, b0)                                \
+  do {                                                                 \
+    UWtype __s0, __s1, __c0, __c1;                                     \
+    __s0 = (a0) + (b0);                                                        \
+    __s1 = (a1) + (b1);                                                        \
+    __c0 = __s0 < (a0);                                                        \
+    __c1 = __s1 < (a1);                                                        \
+    (s0) = __s0;                                                       \
+    __s1 = __s1 + __c0;                                                        \
+    (s1) = __s1;                                                       \
+    (s2) += __c1 + (__s1 < __c0);                                      \
+  } while (0)
+#endif
+
+struct precomp_div_1_pi2
+{
+  mp_limb_t dip[2];
+  mp_limb_t d;
+  int norm_cnt;
+};
+
+mp_limb_t
+mpn_div_qr_1u_pi2 (mp_ptr qp,
+                  mp_srcptr up, mp_size_t un,
+                  struct precomp_div_1_pi2 *pd)
+{
+  mp_size_t i;
+  mp_limb_t r, u2, u1, u0;
+  mp_limb_t d0, di1, di0;
+  mp_limb_t q3a, q2a, q2b, q1b, q2c, q1c, q1d, q0d;
+  mp_limb_t cnd;
+  int cnt;
+
+  ASSERT (un >= 2);
+  ASSERT ((pd->d & GMP_NUMB_HIGHBIT) == 0);
+  ASSERT (! MPN_OVERLAP_P (qp, un-2, up, un) || qp+2 >= up);
+  ASSERT_MPN (up, un);
+
+#define q3 q3a
+#define q2 q2b
+#define q1 q1b
+
+  up += un - 3;
+  cnt = pd->norm_cnt;
+  r = up[2] >> (GMP_NUMB_BITS - cnt);
+  d0 = pd->d << cnt;
+
+  qp += un - 2;
+
+  di1 = pd->dip[1];
+  di0 = pd->dip[0];
+
+  for (i = un - 3; i >= 0; i -= 2)
+    {
+      u2 = r;
+      u1 = (up[2] << cnt) | (up[1] >> (GMP_NUMB_BITS - cnt));
+      u0 = (up[1] << cnt) | (up[0] >> (GMP_NUMB_BITS - cnt));
+
+      /* Dividend in {r,u1,u0} */
+
+      umul_ppmm (q1d,q0d, u1, di0);
+      umul_ppmm (q2b,q1b, u1, di1);
+      q2b++;                           /* cannot spill */
+      add_sssaaaa (r,q2b,q1b, q2b,q1b, u1,u0);
+
+      umul_ppmm (q2c,q1c, u2,  di0);
+      add_sssaaaa (r,q2b,q1b, q2b,q1b, q2c,q1c);
+      umul_ppmm (q3a,q2a, u2, di1);
+
+      add_sssaaaa (r,q2b,q1b, q2b,q1b, q2a,q1d);
+
+      q3 += r;
+
+      r = u0 - q2 * d0;
+
+      cnd = (r >= q1);
+      r += d0 & -cnd;
+      sub_ddmmss (q3,q2,  q3,q2,  0,cnd);
+
+      if (UNLIKELY (r >= d0))
+       {
+         r -= d0;
+         add_ssaaaa (q3,q2,  q3,q2,  0,1);
+       }
+
+      qp[0] = q2;
+      qp[1] = q3;
+
+      up -= 2;
+      qp -= 2;
+    }
+
+  if ((un & 1) != 0)
+    {
+      u2 = r;
+      u1 = (up[2] << cnt);
+
+      udiv_qrnnd_preinv (q3, r, u2, u1, d0, di1);
+      qp[1] = q3;
+    }
+  else
+    {
+      u2 = r;
+      u1 = (up[2] << cnt) | (up[1] >> (GMP_NUMB_BITS - cnt));
+      u0 = (up[1] << cnt);
+
+      /* Dividend in {r,u1,u0} */
+
+      umul_ppmm (q1d,q0d, u1, di0);
+      umul_ppmm (q2b,q1b, u1, di1);
+      q2b++;                           /* cannot spill */
+      add_sssaaaa (r,q2b,q1b, q2b,q1b, u1,u0);
+
+      umul_ppmm (q2c,q1c, u2,  di0);
+      add_sssaaaa (r,q2b,q1b, q2b,q1b, q2c,q1c);
+      umul_ppmm (q3a,q2a, u2, di1);
+
+      add_sssaaaa (r,q2b,q1b, q2b,q1b, q2a,q1d);
+
+      q3 += r;
+
+      r = u0 - q2 * d0;
+
+      cnd = (r >= q1);
+      r += d0 & -cnd;
+      sub_ddmmss (q3,q2,  q3,q2,  0,cnd);
+
+      if (UNLIKELY (r >= d0))
+       {
+         r -= d0;
+         add_ssaaaa (q3,q2,  q3,q2,  0,1);
+       }
+
+      qp[0] = q2;
+      qp[1] = q3;
+    }
+
+  return r >> cnt;
+
+#undef q3
+#undef q2
+#undef q1
+}
index ca61d6b74d9b5dcfd910174652fa5fbd1b011a53..cb07e0e3b428e6a813feb3879e4afdbf4a606135 100644 (file)
@@ -1,31 +1,40 @@
 /* mpn_div_qr_2 -- Divide natural numbers, producing both remainder and
    quotient.  The divisor is two limbs.
 
-   Contributed to the GNU project by Torbjorn Granlund and Niels Möller
+   Contributed to the GNU project by Torbjorn Granlund and Niels Möller
 
-   THIS FILE CONTAINS 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 GNU MP
-   RELEASE.
+   THIS FILE CONTAINS 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 GNU MP RELEASE.
 
 
-Copyright 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2011 Free Software
-Foundation, Inc.
+Copyright 1993-1996, 1999-2002, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -42,13 +51,13 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 /* 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 opeand.
+     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)
 
-#if (defined (__i386__) || defined (__i486__)) && W_TYPE_SIZE == 32
+#if HAVE_HOST_CPU_FAMILY_x86 && W_TYPE_SIZE == 32
 #define add_sssaaaa(s2, s1, s0, a1, a0, b1, b0)                                \
   __asm__ ("add\t%7, %k2\n\tadc\t%5, %k1\n\tadc\t$0, %k0"              \
           : "=r" (s2), "=&r" (s1), "=&r" (s0)                          \
@@ -116,7 +125,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #endif
 
 /* Typically used with r1, r0 same as n3, n2. Other types of overlap
-   between inputs and outputs not supported. */
+   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;              \
@@ -130,10 +139,10 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
     umul_ppmm (_q1d,_q0, n2, di0);                                     \
     add_sssaaaa (_q3,_q2,_q1, _q2,_q1, _q2a,_q1d);                     \
                                                                        \
-    add_ssaaaa (r1, r0, n3, n2, 0, 1); /* FIXME: combine as in x86_64 asm */ \
+    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, 0);                                   \
+    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;                                               \
@@ -145,14 +154,14 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
                                                                        \
     _mask = -(mp_limb_t) (r1 >= _q1 & (r1 > _q1 | r0 >= _q0));  /* (r1,r0) >= (q1,q0) */  \
     add_ssaaaa (r1, r0, r1, r0, d1 & _mask, d0 & _mask);               \
-    sub_ddmmss (_q3, _q2, _q3, _q2, 0, -_mask);                                \
+    sub_ddmmss (_q3, _q2, _q3, _q2, CNST_LIMB(0), -_mask);             \
                                                                        \
     if (UNLIKELY (r1 >= d1))                                           \
       {                                                                        \
        if (r1 > d1 || r0 >= d0)                                        \
          {                                                             \
            sub_ddmmss (r1, r0, r1, r0, d1, d0);                        \
-           add_ssaaaa (_q3, _q2, _q3, _q2, 0, 1);                      \
+           add_ssaaaa (_q3, _q2, _q3, _q2, CNST_LIMB(0), CNST_LIMB(1));\
          }                                                             \
       }                                                                        \
     (q1) = _q3;                                                                \
index ac8dc3dccda14963f156998a15365f14f2e9c0d5..da500e2170e61259fb970358d2f324f33f96e421 100644 (file)
@@ -2,29 +2,38 @@
 
    Contributed to the GNU project by Torbjorn Granlund and Niels Möller
 
-   THIS FILE CONTAINS 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 GNU MP
-   RELEASE.
+   THIS FILE CONTAINS 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 GNU MP RELEASE.
 
 
-Copyright 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2011 Free Software
-Foundation, Inc.
+Copyright 1993-1996, 1999-2002, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 568bf42124724361991722a367214c8a5de4374d..0b9ddf575329d3dc177fe2045fb24a7fe5925dcb 100644 (file)
@@ -2,10 +2,9 @@
 
    Contributed to the GNU project by Niels Möller
 
-   THIS FILE CONTAINS 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 GNU MP
-   RELEASE.
+   THIS FILE CONTAINS 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 GNU MP RELEASE.
 
 
 Copyright 2011 Free Software Foundation, Inc.
@@ -13,17 +12,28 @@ Copyright 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index f246b091cec56b10f93f3a5279967b8e5123391a..1c0a4e894db8a9816a917226e7d1aed359784660 100644 (file)
@@ -4,22 +4,33 @@
    CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
    FUTURE GNU MP RELEASES.
 
-Copyright 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+Copyright 2000-2003, 2005, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -76,14 +87,6 @@ mpn_divexact_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, mp_limb_t divisor)
   ASSERT_MPN (src, size);
   ASSERT_LIMB (divisor);
 
-  s = src[0];
-
-  if (size == 1)
-    {
-      dst[0] = s / divisor;
-      return;
-    }
-
   if ((divisor & 1) == 0)
     {
       count_trailing_zeros (shift, divisor);
@@ -98,40 +101,39 @@ mpn_divexact_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, mp_limb_t divisor)
   if (shift != 0)
     {
       c = 0;
-      i = 0;
-      size--;
 
-      do
+      s = src[0];
+
+      for (i = 1; i < size; i++)
        {
-         s_next = src[i+1];
+         s_next = src[i];
          ls = ((s >> shift) | (s_next << (GMP_NUMB_BITS-shift))) & GMP_NUMB_MASK;
          s = s_next;
 
          SUBC_LIMB (c, l, ls, c);
 
          l = (l * inverse) & GMP_NUMB_MASK;
-         dst[i] = l;
+         dst[i - 1] = l;
 
          umul_ppmm (h, dummy, l, divisor);
          c += h;
-
-         i++;
        }
       while (i < size);
 
       ls = s >> shift;
       l = ls - c;
       l = (l * inverse) & GMP_NUMB_MASK;
-      dst[i] = l;
+      dst[size - 1] = l;
     }
   else
     {
+      s = src[0];
+
       l = (s * inverse) & GMP_NUMB_MASK;
       dst[0] = l;
-      i = 1;
       c = 0;
 
-      do
+      for (i = 1; i < size; i++)
        {
          umul_ppmm (h, dummy, l, divisor);
          c += h;
@@ -141,8 +143,6 @@ mpn_divexact_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, mp_limb_t divisor)
 
          l = (l * inverse) & GMP_NUMB_MASK;
          dst[i] = l;
-         i++;
        }
-      while (i < size);
     }
 }
index 6293f65a8964b669909f60b2d18b814dce3395fd..2ffd9fe777dbfe92f21d904e70f476c3d3bfa33a 100644 (file)
@@ -1,21 +1,32 @@
 /* mpn_divexact_by3c -- mpn exact division by 3.
 
-Copyright 2000, 2001, 2002, 2003, 2008 Free Software Foundation, Inc.
+Copyright 2000-2003, 2008 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index ae80dc7ef77659a6c86e2f7a92897c0681692fb7..47a47e3d80a53308461bd503159068a3e73c6d2f 100644 (file)
@@ -13,17 +13,28 @@ Copyright 2006, 2007, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index e6d08f7c97d229e680f2d221d3a5e0a4446f4db1..9e162e60d2d46a3b57cd013c08590ae55e4f5ed9 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2001, 2002, 2005, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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,9 +52,9 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
    there's no addback, but it would need a multi-precision inverse and so
    might be slower than the plain method (on small sizes at least).
 
-   When D must be normalized (shifted to low bit set), it's possible to supress
-   the bit-shifting of A down, as long as it's already been checked that A has
-   at least as many trailing zero bits as D.  */
+   When D must be normalized (shifted to low bit set), it's possible to
+   suppress the bit-shifting of A down, as long as it's already been checked
+   that A has at least as many trailing zero bits as D.  */
 
 int
 mpn_divisible_p (mp_srcptr ap, mp_size_t an,
index 57ab5250bb46bad11e55c22ab7639397c6efd333..f420992746e818fe28c359a90d99c5ee05002668 100644 (file)
@@ -1,23 +1,33 @@
 /* mpn_divrem -- Divide natural numbers, producing both remainder and
    quotient.  This is now just a middle layer calling mpn_tdiv_qr.
 
-Copyright 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2005 Free
-Software Foundation, Inc.
+Copyright 1993-1997, 1999-2002, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index e66ed80dba5ad84d11bab2bd307b2bf1626093b5..9157b5735e2b7fd8357b6460c9bedba1435da526 100644 (file)
@@ -1,22 +1,33 @@
 /* mpn_divrem_1 -- mpn by limb division.
 
-Copyright 1991, 1993, 1994, 1996, 1998, 1999, 2000, 2002, 2003 Free Software
+Copyright 1991, 1993, 1994, 1996, 1998-2000, 2002, 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 51a1e78710f1f9d405c708516daa438d645e5bac..30d24bb10251e94febeb1213246bbc90f6623ad8 100644 (file)
@@ -1,29 +1,38 @@
 /* mpn_divrem_2 -- Divide natural numbers, producing both remainder and
    quotient.  The divisor is two limbs.
 
-   THIS FILE CONTAINS 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 GNU MP
-   RELEASE.
+   THIS FILE CONTAINS 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 GNU MP RELEASE.
 
 
-Copyright 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
-Foundation, Inc.
+Copyright 1993-1996, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -98,7 +107,7 @@ mpn_divrem_2 (mp_ptr qp, mp_size_t qxn,
       for (i = qxn - 1; i >= 0; i--)
        {
          mp_limb_t q;
-         udiv_qr_3by2 (q, r1, r0, r1, r0, 0, d1, d0, di.inv32);
+         udiv_qr_3by2 (q, r1, r0, r1, r0, CNST_LIMB(0), d1, d0, di.inv32);
          qp[i] = q;
        }
     }
index 38309996cc3389a9ce10289916033633abe1d7a4..3a73fe49e318d2a70124c2f9ef6df01cfd7ac2bd 100644 (file)
@@ -3,22 +3,33 @@
    FUNCTION WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
 
 
-Copyright 1996, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
+Copyright 1996, 2000-2002, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
index ddf93faeda0267530db55cb9d3ee4e0a7b8b0824..eb6e56e736e0f4d5ca8b514c7526eb80da75ef08 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2001, 2002, 2005, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
index bf69e3a0cf182ad8dfc7d53e00610ab277a09a68..b14e1ad888f62ecf5611b031cfd88364d38a31df 100644 (file)
@@ -1,22 +1,33 @@
 /* mpn/gcd.c: mpn_gcd for gcd of two odd integers.
 
-Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003,
-2004, 2005, 2008, 2010, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993-1998, 2000-2005, 2008, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -24,7 +35,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 /* Uses the HGCD operation described in
 
-     N. Möller, On Schönhage's algorithm and subquadratic integer gcd
+     N. Möller, On Schönhage's algorithm and subquadratic integer gcd
      computation, Math. Comp. 77 (2008), 589-607.
 
   to reduce inputs until they are of size below GCD_DC_THRESHOLD, and
index 8131bdc9223c048f0af7ff7d08157d8e3c1c7a6c..f6dcb4a2eb8596f8b9f012ec27b75482c9a216f4 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1994, 1996, 2000, 2001, 2009, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 3db34073c93d2c5b51ece4a50666c1d33596f74f..18634bec9fa4258b108ca7aa3d402ba8e9a7cf32 100644 (file)
@@ -4,22 +4,33 @@
    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 2003, 2004, 2005, 2008, 2010, 2011 Free Software Foundation, Inc.
+Copyright 2003-2005, 2008, 2010, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>            /* for NULL */
 
index 48f7b779935e669ba3c1897b355941405ba1b80a..1c4ff75aab8256a5ee74fa412beab226f4812c52 100644 (file)
@@ -1,22 +1,33 @@
 /* mpn_gcdext -- Extended Greatest Common Divisor.
 
-Copyright 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2012 Free
-Software Foundation, Inc.
+Copyright 1996, 1998, 2000-2005, 2008, 2009, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 3bb4d21df1028205ff5fed0ac24eaba056bd985e..ea46cceb72981d7440e88f33ef149a2681d22be7 100644 (file)
@@ -1,22 +1,32 @@
 /* mpn_gcdext -- Extended Greatest Common Divisor.
 
-Copyright 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 Free Software
-Foundation, Inc.
+Copyright 1996, 1998, 2000-2005, 2008, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -55,7 +65,7 @@ mpn_gcdext_1 (mp_limb_signed_t *sp, mp_limb_signed_t *tp,
      V = s1 u + s0 v
 
      where U, V are the inputs (without any shared power of two),
-     and the matris has determinant Â± 2^{shift}.
+     and the matrix has determinant Â± 2^{shift}.
   */
   mp_limb_t s0 = 1;
   mp_limb_t t0 = 0;
index 101dd498ec1210a9f59a5e9dad0f7a3bc91f23b3..547f69a40984e57948e35ca3237d5d43801eda27 100644 (file)
@@ -1,22 +1,33 @@
 /* mpn_gcdext -- Extended Greatest Common Divisor.
 
-Copyright 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2012 Free
-Software Foundation, Inc.
+Copyright 1996, 1998, 2000-2005, 2008, 2009, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index c12d17686c4c19b05b4293063b5bfe242e04dc97..d73d314856c19c0d37fb0f2ddb5ca17bf1ef6d96 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2003, 2004, 2007, 2009, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -78,7 +89,7 @@ static volatile const long CONST_NEG_1022_SUB_53 = -1022 - 53;
    should come out nice and compact.
 
    The generic code used to work one bit at a time, which was not only slow,
-   but implicitly relied upon denoms for intermediates, since the lowest bits'
+   but implicitly relied upon denorms for intermediates, since the lowest bits'
    weight of a perfectly valid fp number underflows in non-denorm.  Therefore,
    the generic code now works limb-per-limb, initially creating a number x such
    that 1 <= x <= BASE.  (BASE is reached only as result of rounding.)  Then
index e17497cb0e7d2db49e623bdb7195b7679b4b4ab1..42e93c9cee41119cb5f1adfa736aa87f8fd1c2a9 100644 (file)
@@ -7,23 +7,34 @@
    FACT, IT IS ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE
    GNU MP RELEASE.
 
-Copyright 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002, 2004, 2006, 2007,
-2008, 2011, 2012 Free Software Foundation, Inc.
+Copyright 1991-1994, 1996, 2000-2002, 2004, 2006-2008, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -535,7 +546,7 @@ mpn_get_str (unsigned char *str, int base, mp_ptr up, mp_size_t un)
 
   /* Using our precomputed powers, now in powtab[], convert our number.  */
   tmp = TMP_BALLOC_LIMBS (mpn_dc_get_str_itch (un));
-  out_len = mpn_dc_get_str (str, 0, up, un, powtab - 1 + pi, tmp) - str;
+  out_len = mpn_dc_get_str (str, 0, up, un, powtab + (pi - 1), tmp) - str;
   TMP_FREE;
 
   return out_len;
index aab5fa510e427b05e4716f02d2ceb8a2b9781c4a..7dc057aa0c33d7befa22332ce434892098f9d0a4 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1991, 1993, 1994, 2000 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /* Values for GMP_LIMB_BITS etc will be determined by ./configure and put
index f51bbde81c2f330e8ca90365d92cb7056812a35f..e27a9bdd8208eb5313fc0e41987fa2e0f7f84df3 100644 (file)
@@ -4,22 +4,33 @@
    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 2003, 2004, 2005, 2008, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2003-2005, 2008, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -98,7 +109,7 @@ mpn_hgcd (mp_ptr ap, mp_ptr bp, mp_size_t n,
          success = 1;
        }
 
-      /* NOTE: It apppears this loop never runs more than once (at
+      /* NOTE: It appears this loop never runs more than once (at
         least when not recursing to hgcd_appr). */
       while (n > n2)
        {
index 08641cc527abdf686b0bd4c6dc97b0760edcaa23..129637063f935e334ef008c568219803031ab354 100644 (file)
@@ -4,23 +4,33 @@
    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, 2001, 2002, 2003, 2004, 2008, 2012 Free Software
-Foundation, Inc.
+Copyright 1996, 1998, 2000-2004, 2008, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index c888deb1d07913ceaf757b1efc6d77f2f6d668d7..e59c32a3414eee6f4d7f37c027f50d2f4bb00f16 100644 (file)
@@ -4,23 +4,33 @@
    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, 2001, 2002, 2003, 2004, 2008, 2011 Free Software
-Foundation, Inc.
+Copyright 1996, 1998, 2000-2004, 2008, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index bb8536ae6157232828becd0d50aa93ef91aa912d..660219372f8951a92af0d816bcff21e5f4967cad 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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 +108,7 @@ mpn_hgcd_appr (mp_ptr ap, mp_ptr bp, mp_size_t n,
             sbits <-- sbits + 1 - p,
 
             rather than just sbits <-- sbits - p. This adjustment makes
-            the produced matrix sligthly smaller than it could be. */
+            the produced matrix slightly smaller than it could be. */
 
          if (GMP_NUMB_BITS * (n + 1) + 2 * extra_bits <= 2*GMP_NUMB_BITS * s)
            {
@@ -130,14 +141,13 @@ mpn_hgcd_appr (mp_ptr ap, mp_ptr bp, mp_size_t n,
 
       if (extra_bits > 0)
        {
-         /* We can get here only of we have dropped at least one of the
-            least significant bits, so we can decrement ap and bp. We can
-            then shift left extra bits using mpn_shiftr. */
-         /* NOTE: In the unlikely case that n is large, it would be
-            preferable to do an initial subdiv step to reduce the size
-            before shifting, but that would mean daplicating
-            mpn_gcd_subdiv_step with a bit count rather than a limb
-            count. */
+         /* We can get here only of we have dropped at least one of the least
+            significant bits, so we can decrement ap and bp. We can then shift
+            left extra bits using mpn_rshift. */
+         /* NOTE: In the unlikely case that n is large, it would be preferable
+            to do an initial subdiv step to reduce the size before shifting,
+            but that would mean duplicating mpn_gcd_subdiv_step with a bit
+            count rather than a limb count. */
          ap--; bp--;
          ap[0] = mpn_rshift (ap+1, ap+1, n, GMP_NUMB_BITS - extra_bits);
          bp[0] = mpn_rshift (bp+1, bp+1, n, GMP_NUMB_BITS - extra_bits);
index 728755a62037d35d170a1fb9d0a719e1d3a1f2f9..0a49e5b3a78848f677cf8df77b5474e4b937177a 100644 (file)
@@ -4,22 +4,33 @@
    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 2003, 2004, 2005, 2008, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2003-2005, 2008, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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 +71,7 @@ hgcd_jacobi_hook (void *p, mp_srcptr gp, mp_size_t gn,
    below the given size s. Return new size for a and b, or 0 if no
    more steps are possible.
 
-   If hgcd2 succeds, needs temporary space for hgcd_matrix_mul_1, M->n
+   If hgcd2 succeeds, needs temporary space for hgcd_matrix_mul_1, M->n
    limbs, and hgcd_mul_matrix1_inverse_vector, n limbs. If hgcd2
    fails, needs space for the quotient, qn <= n - s + 1 limbs, for and
    hgcd_matrix_update_q, qn + (size of the appropriate column of M) <=
index 9eee8ffe8e3755a3617aee4d6b652bac66bc487f..d9db331603b214a11063f45b50d9e387bda79721 100644 (file)
@@ -4,22 +4,33 @@
    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 2003, 2004, 2005, 2008, 2012 Free Software Foundation, Inc.
+Copyright 2003-2005, 2008, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index ec201f5df505d7f7953107d33d763533916573cf..6f3d61eceabba037e43f6a4c184ca98a81a1bbfd 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 740c56b282860577945cbb5401944d98196c3227..e58894ff3b420150525f7d38760d61671cdf6da7 100644 (file)
@@ -4,22 +4,33 @@
    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 2003, 2004, 2005, 2008, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2003-2005, 2008, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -51,7 +62,7 @@ hgcd_hook (void *p, mp_srcptr gp, mp_size_t gn,
    below the given size s. Return new size for a and b, or 0 if no
    more steps are possible.
 
-   If hgcd2 succeds, needs temporary space for hgcd_matrix_mul_1, M->n
+   If hgcd2 succeeds, needs temporary space for hgcd_matrix_mul_1, M->n
    limbs, and hgcd_mul_matrix1_inverse_vector, n limbs. If hgcd2
    fails, needs space for the quotient, qn <= n - s limbs, for and
    hgcd_matrix_update_q, qn + (size of the appropriate column of M) <=
index ac62d23722ebedb20d534e30aec9df5b2f7059aa..4bc459d728b72542a9be4c96be9349c757649c89 100644 (file)
@@ -11,17 +11,28 @@ Copyright (C) 2007, 2009, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 6430d2ea3dc67a03f572baf6160ccaf6ec6d65a3..12326b8b75c84a70a75aa024adc6db22d0a572be 100644 (file)
@@ -17,17 +17,28 @@ Copyright (C) 2007, 2009, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* FIXME: Remove NULL and TMP_*, as soon as all the callers properly
    allocate and pass the scratch to the function. */
@@ -37,7 +48,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #include "gmp-impl.h"
 #include "longlong.h"
 
-/* FIXME: The iterative version splits the operand in two slighty unbalanced
+/* FIXME: The iterative version splits the operand in two slightly unbalanced
    parts, the use of log_2 (or counting the bits) underestimate the maximum
    number of iterations.  */
 
index 0cd80d83140743823945d8e7ee7f075d6fe4904a..cd52bc951339530aaf010755e09ae9719f41f646 100644 (file)
@@ -3,22 +3,33 @@
    THIS INTERFACE IS PRELIMINARY AND MIGHT DISAPPEAR OR BE SUBJECT TO
    INCOMPATIBLE CHANGES IN A FUTURE RELEASE OF GMP.
 
-Copyright 1999, 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
+Copyright 1999-2002, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 478f063be96798017138f482722197573fd1e20e..bdc3ec67da1bc5a929598201435cedd725c192c3 100644 (file)
@@ -4,23 +4,34 @@
    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, 2001, 2002, 2003, 2004, 2008, 2010, 2011 Free Software
-Foundation, Inc.
+Copyright 1996, 1998, 2000-2004, 2008, 2010, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 9a8a2b551b1736e2c61c65cb64964c04e6672d6f..9f480f7834a19fb0a02a6b9e517a735ddb75d949 100644 (file)
@@ -4,23 +4,33 @@
    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, 2001, 2002, 2003, 2004, 2008, 2010 Free Software
-Foundation, Inc.
+Copyright 1996, 1998, 2000-2004, 2008, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 618efe5937817ff8cc738f83a2189a26bb1e9731..1b534ff4ba53b373dcddedbe80648dff59a93dda 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index fdc7e4423e203a67f470d0c211116410b4fd2fb1..5182632976c6aee9bb74d554cf8b94f85d5f9fbf 100644 (file)
@@ -1,22 +1,32 @@
 /* mpn_lshift -- Shift left low level.
 
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 1996, 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 80c1efe10ad2c2e042937b7de56f715f2fe95a5d..e8051b7b931db9aa9ee2214dcd9e89253feacd86 100644 (file)
@@ -1,22 +1,33 @@
 /* mpn_lshiftc -- Shift left low level with complement.
 
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002, 2009 Free Software Foundation,
+Copyright 1991, 1993, 1994, 1996, 2000-2002, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 6e0e67586f72545c90a7147888081c85089dfce2..59531eb1b26a1846abfd77090350a597c5faf9f2 100644 (file)
@@ -1,27 +1,38 @@
 /* matrix22_mul.c.
 
-   Contributed by Niels Möller and Marco Bodrato.
+   Contributed by Niels Möller and Marco Bodrato.
 
    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'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
 
-Copyright 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
+Copyright 2003-2005, 2008, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index c8a58119ac2a95c79cd5858ba56fa067542d5001..83b2fb5134381d7d6efdd13d8fb5d6afbcbaad46 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2008, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 66c332ea3831d260b6f90ebbca269025fe14f99a..0212020201f9d059b4777d1340d2a177df3e5ee1 100644 (file)
@@ -3,23 +3,34 @@
    Return the single-limb remainder.
    There are no constraints on the value of the divisor.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2002, 2007, 2008, 2009, 2012 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 2002, 2007-2009, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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,7 +70,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #endif
 
 #if TUNE_PROGRAM_BUILD && !HAVE_NATIVE_mpn_mod_1_1p
-/* Duplicates declaratinos in tune/speed.h */
+/* Duplicates declarations in tune/speed.h */
 mp_limb_t mpn_mod_1_1p_1 (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [4]);
 mp_limb_t mpn_mod_1_1p_2 (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [4]);
 
index d0e885d5f54e9b68be88610118d045a6e51ffeab..2e111399eda21b6f3eed253ba1bb0f85410aa4a7 100644 (file)
@@ -1,29 +1,40 @@
 /* mpn_mod_1_1p (ap, n, b, cps)
    Divide (ap,,n) by b.  Return the single-limb remainder.
 
-   Contributed to the GNU project by Torbjorn Granlund and Niels Möller.
+   Contributed to the GNU project by Torbjorn Granlund and Niels Möller.
    Based on a suggestion by Peter L. Montgomery.
 
    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 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+Copyright 2008-2011, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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,6 +91,17 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
           : "rJ" (ah), "rI" (bh), "%rJ" (al), "rI" (bl),               \
             "rJ" ((al) >> 32), "rI" ((bl) >> 32)                       \
         __CLOBBER_CC)
+#if __VIS__ >= 0x300
+#undef add_mssaaaa
+#define add_mssaaaa(m, sh, sl, ah, al, bh, bl)                         \
+  __asm__ (  "addcc    %r5, %6, %2\n\t"                                \
+            "addxccc   %r3, %4, %1\n\t"                                \
+            "clr       %0\n\t"                                         \
+            "movcs     %%xcc, -1, %0"                                  \
+          : "=r" (m), "=r" (sh), "=&r" (sl)                            \
+          : "rJ" (ah), "rI" (bh), "%rJ" (al), "rI" (bl)                \
+        __CLOBBER_CC)
+#endif
 #endif
 
 #if HAVE_HOST_CPU_FAMILY_powerpc && !defined (_LONG_LONG_LIMB)
@@ -160,12 +182,12 @@ mpn_mod_1_1p_cps (mp_limb_t cps[4], mp_limb_t b)
    *   B2modb = - b * bi;
    *   ASSERT (B2modb <= b);    // NB: equality iff b = B/2
    */
-  udiv_rnnd_preinv (B2modb, B1modb, 0, b, bi);
+  udiv_rnnd_preinv (B2modb, B1modb, CNST_LIMB(0), b, bi);
   cps[3] = B2modb >> cnt;
 }
 
 mp_limb_t
-mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4])
+mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t bmodb[4])
 {
   mp_limb_t rh, rl, bi, ph, pl, r;
   mp_limb_t B1modb, B2modb;
@@ -180,7 +202,7 @@ mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4])
 
   rl = ap[n - 1];
   umul_ppmm (ph, pl, rl, B1modb);
-  add_ssaaaa (rh, rl, ph, pl, 0, ap[n - 2]);
+  add_ssaaaa (rh, rl, ph, pl, CNST_LIMB(0), ap[n - 2]);
 
   for (i = n - 3; i >= 0; i -= 1)
     {
@@ -189,7 +211,7 @@ mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4])
            + HI(rr)  * (B^2 mod b)             <= (B-1)(b-1)
       */
       umul_ppmm (ph, pl, rl, B1modb);
-      add_ssaaaa (ph, pl, ph, pl, 0, ap[i]);
+      add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[i]);
 
       umul_ppmm (rh, rl, rh, B2modb);
       add_ssaaaa (rh, rl, rh, rl, ph, pl);
@@ -239,7 +261,7 @@ mpn_mod_1_1p_cps (mp_limb_t cps[4], mp_limb_t b)
 }
 
 mp_limb_t
-mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4])
+mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t bmodb[4])
 {
   int cnt;
   mp_limb_t bi, B1modb;
@@ -294,8 +316,7 @@ mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4])
       r1 = (r1 << cnt) | (r0 >> (GMP_LIMB_BITS - cnt));
       r0 <<= cnt;
 
-      /* NOTE: Might get r1 == b here, but udiv_rnnd_preinv allows
-        that. */
+      /* NOTE: Might get r1 == b here, but udiv_rnnd_preinv allows that. */
     }
   else
     {
index 7fec9504c9ff514340146d033e0af79d74bb030e..7acf3dbdd10a9580767b68b95bbe2146996803ec 100644 (file)
@@ -9,22 +9,33 @@
    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 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2008-2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -51,10 +62,10 @@ mpn_mod_1s_2p_cps (mp_limb_t cps[5], mp_limb_t b)
   ASSERT (B1modb <= b);                /* NB: not fully reduced mod b */
   cps[2] = B1modb >> cnt;
 
-  udiv_rnnd_preinv (B2modb, B1modb, 0, b, bi);
+  udiv_rnnd_preinv (B2modb, B1modb, CNST_LIMB(0), b, bi);
   cps[3] = B2modb >> cnt;
 
-  udiv_rnnd_preinv (B3modb, B2modb, 0, b, bi);
+  udiv_rnnd_preinv (B3modb, B2modb, CNST_LIMB(0), b, bi);
   cps[4] = B3modb >> cnt;
 
 #if WANT_ASSERT
@@ -71,7 +82,7 @@ mpn_mod_1s_2p_cps (mp_limb_t cps[5], mp_limb_t b)
 }
 
 mp_limb_t
-mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[5])
+mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t cps[5])
 {
   mp_limb_t rh, rl, bi, ph, pl, ch, cl, r;
   mp_limb_t B1modb, B2modb, B3modb;
@@ -97,7 +108,7 @@ mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[5])
        }
 
       umul_ppmm (ph, pl, ap[n - 2], B1modb);
-      add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 3]);
+      add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[n - 3]);
       umul_ppmm (rh, rl, ap[n - 1], B2modb);
       add_ssaaaa (rh, rl, rh, rl, ph, pl);
       n--;
@@ -116,7 +127,7 @@ mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[5])
            + HI(rr)  * (B^3 mod b)             <= (B-1)(b-1)
       */
       umul_ppmm (ph, pl, ap[i + 1], B1modb);
-      add_ssaaaa (ph, pl, ph, pl, 0, ap[i + 0]);
+      add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[i + 0]);
 
       umul_ppmm (ch, cl, rl, B2modb);
       add_ssaaaa (ph, pl, ph, pl, ch, cl);
@@ -126,7 +137,7 @@ mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[5])
     }
 
   umul_ppmm (rh, cl, rh, B1modb);
-  add_ssaaaa (rh, rl, rh, rl, 0, cl);
+  add_ssaaaa (rh, rl, rh, rl, CNST_LIMB(0), cl);
 
   cnt = cps[1];
   bi = cps[0];
index 75d1cca3cb48cf36fbe1bd414ab07a988ebe389a..f4137f4315566b44de543b68a6b940101999c013 100644 (file)
@@ -9,22 +9,33 @@
    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 2008, 2009, 2010, 2013 Free Software Foundation, Inc.
+Copyright 2008-2010, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -51,13 +62,13 @@ mpn_mod_1s_3p_cps (mp_limb_t cps[6], mp_limb_t b)
   ASSERT (B1modb <= b);                /* NB: not fully reduced mod b */
   cps[2] = B1modb >> cnt;
 
-  udiv_rnnd_preinv (B2modb, B1modb, 0, b, bi);
+  udiv_rnnd_preinv (B2modb, B1modb, CNST_LIMB(0), b, bi);
   cps[3] = B2modb >> cnt;
 
-  udiv_rnnd_preinv (B3modb, B2modb, 0, b, bi);
+  udiv_rnnd_preinv (B3modb, B2modb, CNST_LIMB(0), b, bi);
   cps[4] = B3modb >> cnt;
 
-  udiv_rnnd_preinv (B4modb, B3modb, 0, b, bi);
+  udiv_rnnd_preinv (B4modb, B3modb, CNST_LIMB(0), b, bi);
   cps[5] = B4modb >> cnt;
 
 #if WANT_ASSERT
@@ -74,7 +85,7 @@ mpn_mod_1s_3p_cps (mp_limb_t cps[6], mp_limb_t b)
 }
 
 mp_limb_t
-mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[6])
+mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t cps[6])
 {
   mp_limb_t rh, rl, bi, ph, pl, ch, cl, r;
   mp_limb_t B1modb, B2modb, B3modb, B4modb;
@@ -95,7 +106,7 @@ mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[6])
     {
     case 0:
       umul_ppmm (ph, pl, ap[n - 2], B1modb);
-      add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 3]);
+      add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[n - 3]);
       umul_ppmm (rh, rl, ap[n - 1], B2modb);
       add_ssaaaa (rh, rl, rh, rl, ph, pl);
       n -= 3;
@@ -121,7 +132,7 @@ mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[6])
            + HI(rr)  * (B^4 mod b)             <= (B-1)(b-1)
       */
       umul_ppmm (ph, pl, ap[i + 1], B1modb);
-      add_ssaaaa (ph, pl, ph, pl, 0, ap[i + 0]);
+      add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[i + 0]);
 
       umul_ppmm (ch, cl, ap[i + 2], B2modb);
       add_ssaaaa (ph, pl, ph, pl, ch, cl);
@@ -134,7 +145,7 @@ mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[6])
     }
 
   umul_ppmm (rh, cl, rh, B1modb);
-  add_ssaaaa (rh, rl, rh, rl, 0, cl);
+  add_ssaaaa (rh, rl, rh, rl, CNST_LIMB(0), cl);
 
   cnt = cps[1];
   bi = cps[0];
index 570ff43e217bfe6aad6ff09b14eb08b3fbad235a..716a0c66de49c80a6530b40d329c0fe42bf56def 100644 (file)
@@ -9,22 +9,33 @@
    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 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2008-2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -51,16 +62,16 @@ mpn_mod_1s_4p_cps (mp_limb_t cps[7], mp_limb_t b)
   ASSERT (B1modb <= b);                /* NB: not fully reduced mod b */
   cps[2] = B1modb >> cnt;
 
-  udiv_rnnd_preinv (B2modb, B1modb, 0, b, bi);
+  udiv_rnnd_preinv (B2modb, B1modb, CNST_LIMB(0), b, bi);
   cps[3] = B2modb >> cnt;
 
-  udiv_rnnd_preinv (B3modb, B2modb, 0, b, bi);
+  udiv_rnnd_preinv (B3modb, B2modb, CNST_LIMB(0), b, bi);
   cps[4] = B3modb >> cnt;
 
-  udiv_rnnd_preinv (B4modb, B3modb, 0, b, bi);
+  udiv_rnnd_preinv (B4modb, B3modb, CNST_LIMB(0), b, bi);
   cps[5] = B4modb >> cnt;
 
-  udiv_rnnd_preinv (B5modb, B4modb, 0, b, bi);
+  udiv_rnnd_preinv (B5modb, B4modb, CNST_LIMB(0), b, bi);
   cps[6] = B5modb >> cnt;
 
 #if WANT_ASSERT
@@ -77,7 +88,7 @@ mpn_mod_1s_4p_cps (mp_limb_t cps[7], mp_limb_t b)
 }
 
 mp_limb_t
-mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
+mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t cps[7])
 {
   mp_limb_t rh, rl, bi, ph, pl, ch, cl, r;
   mp_limb_t B1modb, B2modb, B3modb, B4modb, B5modb;
@@ -96,7 +107,7 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
     {
     case 0:
       umul_ppmm (ph, pl, ap[n - 3], B1modb);
-      add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 4]);
+      add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[n - 4]);
       umul_ppmm (ch, cl, ap[n - 2], B2modb);
       add_ssaaaa (ph, pl, ph, pl, ch, cl);
       umul_ppmm (rh, rl, ap[n - 1], B3modb);
@@ -115,7 +126,7 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
       break;
     case 3:
       umul_ppmm (ph, pl, ap[n - 2], B1modb);
-      add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 3]);
+      add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[n - 3]);
       umul_ppmm (rh, rl, ap[n - 1], B2modb);
       add_ssaaaa (rh, rl, rh, rl, ph, pl);
       n -= 3;
@@ -132,7 +143,7 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
            + HI(rr)  * (B^5 mod b)             <= (B-1)(b-1)
       */
       umul_ppmm (ph, pl, ap[i + 1], B1modb);
-      add_ssaaaa (ph, pl, ph, pl, 0, ap[i + 0]);
+      add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[i + 0]);
 
       umul_ppmm (ch, cl, ap[i + 2], B2modb);
       add_ssaaaa (ph, pl, ph, pl, ch, cl);
@@ -148,7 +159,7 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
     }
 
   umul_ppmm (rh, cl, rh, B1modb);
-  add_ssaaaa (rh, rl, rh, rl, 0, cl);
+  add_ssaaaa (rh, rl, rh, rl, CNST_LIMB(0), cl);
 
   cnt = cps[1];
   bi = cps[0];
index 6bd149892d2097e04341ad45e0eb4c5462d74e24..7c07af7acc24d0f6deead0b7878bcaa84392581d 100644 (file)
@@ -4,22 +4,33 @@
    CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
    FUTURE GNU MP RELEASES.
 
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index e8978a4c576a7c34e3dc45c51adb02ee00107b91..ec91da223d4880577b8b1e5dc75651ad0ffadd53 100644 (file)
@@ -4,22 +4,33 @@
    CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
    FUTURE GNU MP RELEASES.
 
-Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright 2000-2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 01df1e3a368600da5b41f6a201ec6fffb1fd9b78..0a8010ec153cb1f8ac0d160273ca4957dacb6dbe 100644 (file)
@@ -8,22 +8,33 @@
    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, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2005-2007, 2009, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /*
index fabdc4690d16bca3b177707c77d9fb7d967eccc6..d265440f2baa4d567fa7f2e06ecff0c7ac23cff0 100644 (file)
@@ -8,22 +8,33 @@
    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, 2006, 2007, 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 2005-2007, 2009, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /*
index 86182ac15119fb1518da84d23ce4158f07e8606a..8768ba6c60cbc1bb398133de8f0304fdd7c0ba9f 100644 (file)
@@ -6,22 +6,33 @@
    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, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2005-2007, 2009, 2010, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /*
@@ -37,11 +48,6 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
   1. This is a rudimentary implementation of mpn_mu_div_q.  The algorithm is
      probably close to optimal, except when mpn_mu_divappr_q fails.
 
-     An alternative which could be considered for much simpler code for the
-     complex qn>=dn arm would be to allocate a temporary nn+1 limb buffer, then
-     simply call mpn_mu_divappr_q.  Such a temporary allocation is
-     unfortunately very large.
-
   2. We used to fall back to mpn_mu_div_qr when we detect a possible
      mpn_mu_divappr_q rounding problem, now we multiply and compare.
      Unfortunately, since mpn_mu_divappr_q does not return the partial
@@ -63,8 +69,8 @@ mpn_mu_div_q (mp_ptr qp,
              mp_srcptr dp, mp_size_t dn,
              mp_ptr scratch)
 {
-  mp_ptr tp, rp, ip, this_ip;
-  mp_size_t qn, in, this_in;
+  mp_ptr tp, rp;
+  mp_size_t qn;
   mp_limb_t cy, qh;
   TMP_DECL;
 
@@ -76,57 +82,18 @@ mpn_mu_div_q (mp_ptr qp,
 
   if (qn >= dn)                        /* nn >= 2*dn + 1 */
     {
-      /* Find max inverse size needed by the two preinv calls.  FIXME: This is
-        not optimal, it underestimates the invariance.  */
-      if (dn != qn)
-       {
-         mp_size_t in1, in2;
-
-         in1 = mpn_mu_div_qr_choose_in (qn - dn, dn, 0);
-         in2 = mpn_mu_divappr_q_choose_in (dn + 1, dn, 0);
-         in = MAX (in1, in2);
-       }
-      else
-       {
-         in = mpn_mu_divappr_q_choose_in (dn + 1, dn, 0);
-       }
-
-      ip = TMP_BALLOC_LIMBS (in + 1);
-
-      if (dn == in)
-       {
-         MPN_COPY (scratch + 1, dp, in);
-         scratch[0] = 1;
-         mpn_invertappr (ip, scratch, in + 1, NULL);
-         MPN_COPY_INCR (ip, ip + 1, in);
-       }
-      else
-       {
-         cy = mpn_add_1 (scratch, dp + dn - (in + 1), in + 1, 1);
-         if (UNLIKELY (cy != 0))
-           MPN_ZERO (ip, in);
-         else
-           {
-             mpn_invertappr (ip, scratch, in + 1, NULL);
-             MPN_COPY_INCR (ip, ip + 1, in);
-           }
-       }
-
        /* |_______________________|   dividend
                         |________|   divisor  */
-      rp = TMP_BALLOC_LIMBS (2 * dn + 1);
-
-      this_in = mpn_mu_div_qr_choose_in (qn - dn, dn, 0);
-      this_ip = ip + in - this_in;
-      qh = mpn_preinv_mu_div_qr (tp + dn + 1, rp + dn + 1, np + dn, qn, dp, dn,
-                                this_ip, this_in, scratch);
 
-      MPN_COPY (rp + 1, np, dn);
+      rp = TMP_BALLOC_LIMBS (nn + 1);
+      MPN_COPY (rp + 1, np, nn);
       rp[0] = 0;
-      this_in = mpn_mu_divappr_q_choose_in (dn + 1, dn, 0);
-      this_ip = ip + in - this_in;
-      cy = mpn_preinv_mu_divappr_q (tp, rp, 2 * dn + 1, dp, dn,
-                                   this_ip, this_in, scratch);
+
+      qh = mpn_cmp (rp + 1 + nn - dn, dp, dn) >= 0;
+      if (qh != 0)
+       mpn_sub_n (rp + 1 + nn - dn, rp + 1 + nn - dn, dp, dn);
+
+      cy = mpn_mu_divappr_q (tp, rp, nn + 1, dp, dn, scratch);
 
       if (UNLIKELY (cy != 0))
        {
@@ -134,7 +101,7 @@ mpn_mu_div_q (mp_ptr qp,
             canonically reduced, replace the returned value of B^(qn-dn)+eps
             by the largest possible value.  */
          mp_size_t i;
-         for (i = 0; i < dn + 1; i++)
+         for (i = 0; i < qn + 1; i++)
            tp[i] = GMP_NUMB_MAX;
        }
 
@@ -149,8 +116,7 @@ mpn_mu_div_q (mp_ptr qp,
          mp_limb_t cy;
          mp_ptr pp;
 
-         /* FIXME: can we use already allocated space? */
-         pp = TMP_BALLOC_LIMBS (nn);
+         pp = rp;
          mpn_mul (pp, tp + 1, qn, dp, dn);
 
          cy = (qh != 0) ? mpn_add_n (pp + qn, pp + qn, dp, dn) : 0;
@@ -205,18 +171,15 @@ mpn_mu_div_q (mp_ptr qp,
 mp_size_t
 mpn_mu_div_q_itch (mp_size_t nn, mp_size_t dn, int mua_k)
 {
-  mp_size_t qn, itch1, itch2;
+  mp_size_t qn;
 
   qn = nn - dn;
   if (qn >= dn)
     {
-      itch1 = mpn_mu_div_qr_itch (qn, dn, mua_k);
-      itch2 = mpn_mu_divappr_q_itch (2 * dn + 1, dn, mua_k);
-      return MAX (itch1, itch2);
+      return mpn_mu_divappr_q_itch (nn + 1, dn, mua_k);
     }
   else
     {
-      itch1 = mpn_mu_divappr_q_itch (2 * qn + 2, qn + 1, mua_k);
-      return itch1;
+      return mpn_mu_divappr_q_itch (2 * qn + 2, qn + 1, mua_k);
     }
 }
index b7aaa70b6fc5c3cf88fe350d29ab680ac2a5a218..f4700a1ea675b28fb3c3d14a640c746253e85999 100644 (file)
    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, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2005-2007, 2009, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /*
index 0e9afa3c6979c17bfc8dc120553d3ee69012b8ad..c218b59fee4a2151319838f8bf04dbc3d1f1c0d8 100644 (file)
    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, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2005-2007, 2009, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /*
index 8e8ce5817dcc0cbb50e92e17702632c5712b68c3..2d72df3d4d4fb5b37f39189c686a61ecf4672f32 100644 (file)
@@ -2,23 +2,34 @@
 
    Contributed to the GNU project by Torbjorn Granlund.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2005,
-2006, 2007, 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 1999-2003, 2005-2007, 2009, 2010, 2012
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index b8290cc6af81f695d7c2d317d92a2997daa51cb1..6b2ee59a2c92ac716a1ea4fb998d158e5ca14237 100644 (file)
@@ -1,23 +1,33 @@
 /* mpn_mul_1 -- Multiply a limb vector with a single limb and store the
    product in a second limb vector.
 
-Copyright 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002 Free Software
-Foundation, Inc.
+Copyright 1991-1994, 1996, 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 0eac22473a759ddbf2a451c3586e82e7482397c8..9309ef72c8818f699593c50fe88869131ce7f826 100644 (file)
@@ -4,23 +4,33 @@
    THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE.  IT IS ONLY
    SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
 
-Copyright 1991, 1992, 1993, 1994, 1996, 1997, 2000, 2001, 2002 Free Software
-Foundation, Inc.
+Copyright 1991-1994, 1996, 1997, 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index e2555c7d143719f58e0367f4acd2a20a523150d3..5e763a3a73662d31fb7c02866656f1bde661aacb 100644 (file)
@@ -6,23 +6,33 @@
    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, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 1998-2010, 2012, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /* References:
@@ -67,8 +77,8 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 static mp_limb_t mpn_mul_fft_internal (mp_ptr, mp_size_t, int, mp_ptr *,
                                       mp_ptr *, mp_ptr, mp_ptr, mp_size_t,
                                       mp_size_t, mp_size_t, int **, mp_ptr, int);
-static void mpn_mul_fft_decompose (mp_ptr, mp_ptr *, int, int, mp_srcptr,
-                                  mp_size_t, int, int, mp_ptr);
+static void mpn_mul_fft_decompose (mp_ptr, mp_ptr *, mp_size_t, mp_size_t, mp_srcptr,
+                                  mp_size_t, mp_size_t, mp_size_t, mp_ptr);
 
 
 /* Find the best k to use for a mod 2^(m*GMP_NUMB_BITS)+1 FFT for m >= n.
@@ -192,38 +202,39 @@ mpn_fft_initl (int **l, int k)
    r and a must have n+1 limbs, and not overlap.
 */
 static void
-mpn_fft_mul_2exp_modF (mp_ptr r, mp_srcptr a, unsigned int d, mp_size_t n)
+mpn_fft_mul_2exp_modF (mp_ptr r, mp_srcptr a, mp_bitcnt_t d, mp_size_t n)
 {
-  int sh;
+  unsigned int sh;
+  mp_size_t m;
   mp_limb_t cc, rd;
 
   sh = d % GMP_NUMB_BITS;
-  d /= GMP_NUMB_BITS;
+  m = d / GMP_NUMB_BITS;
 
-  if (d >= n)                  /* negate */
+  if (m >= n)                  /* negate */
     {
-      /* r[0..d-1]  <-- lshift(a[n-d]..a[n-1], sh)
-        r[d..n-1]  <-- -lshift(a[0]..a[n-d-1],  sh) */
+      /* r[0..m-1]  <-- lshift(a[n-m]..a[n-1], sh)
+        r[m..n-1]  <-- -lshift(a[0]..a[n-m-1],  sh) */
 
-      d -= n;
+      m -= n;
       if (sh != 0)
        {
          /* no out shift below since a[n] <= 1 */
-         mpn_lshift (r, a + n - d, d + 1, sh);
-         rd = r[d];
-         cc = mpn_lshiftc (r + d, a, n - d, sh);
+         mpn_lshift (r, a + n - m, m + 1, sh);
+         rd = r[m];
+         cc = mpn_lshiftc (r + m, a, n - m, sh);
        }
       else
        {
-         MPN_COPY (r, a + n - d, d);
+         MPN_COPY (r, a + n - m, m);
          rd = a[n];
-         mpn_com (r + d, a, n - d);
+         mpn_com (r + m, a, n - m);
          cc = 0;
        }
 
-      /* add cc to r[0], and add rd to r[d] */
+      /* add cc to r[0], and add rd to r[m] */
 
-      /* now add 1 in r[d], subtract 1 in r[n], i.e. add 1 in r[0] */
+      /* now add 1 in r[m], subtract 1 in r[n], i.e. add 1 in r[0] */
 
       r[n] = 0;
       /* cc < 2^sh <= 2^(GMP_NUMB_BITS-1) thus no overflow here */
@@ -233,46 +244,46 @@ mpn_fft_mul_2exp_modF (mp_ptr r, mp_srcptr a, unsigned int d, mp_size_t n)
       rd++;
       /* rd might overflow when sh=GMP_NUMB_BITS-1 */
       cc = (rd == 0) ? 1 : rd;
-      r = r + d + (rd == 0);
+      r = r + m + (rd == 0);
       mpn_incr_u (r, cc);
     }
   else
     {
-      /* r[0..d-1]  <-- -lshift(a[n-d]..a[n-1], sh)
-        r[d..n-1]  <-- lshift(a[0]..a[n-d-1],  sh)  */
+      /* r[0..m-1]  <-- -lshift(a[n-m]..a[n-1], sh)
+        r[m..n-1]  <-- lshift(a[0]..a[n-m-1],  sh)  */
       if (sh != 0)
        {
          /* no out bits below since a[n] <= 1 */
-         mpn_lshiftc (r, a + n - d, d + 1, sh);
-         rd = ~r[d];
-         /* {r, d+1} = {a+n-d, d+1} << sh */
-         cc = mpn_lshift (r + d, a, n - d, sh); /* {r+d, n-d} = {a, n-d}<<sh */
+         mpn_lshiftc (r, a + n - m, m + 1, sh);
+         rd = ~r[m];
+         /* {r, m+1} = {a+n-m, m+1} << sh */
+         cc = mpn_lshift (r + m, a, n - m, sh); /* {r+m, n-m} = {a, n-m}<<sh */
        }
       else
        {
-         /* r[d] is not used below, but we save a test for d=0 */
-         mpn_com (r, a + n - d, d + 1);
+         /* r[m] is not used below, but we save a test for m=0 */
+         mpn_com (r, a + n - m, m + 1);
          rd = a[n];
-         MPN_COPY (r + d, a, n - d);
+         MPN_COPY (r + m, a, n - m);
          cc = 0;
        }
 
-      /* now complement {r, d}, subtract cc from r[0], subtract rd from r[d] */
+      /* now complement {r, m}, subtract cc from r[0], subtract rd from r[m] */
 
-      /* if d=0 we just have r[0]=a[n] << sh */
-      if (d != 0)
+      /* if m=0 we just have r[0]=a[n] << sh */
+      if (m != 0)
        {
-         /* now add 1 in r[0], subtract 1 in r[d] */
+         /* now add 1 in r[0], subtract 1 in r[m] */
          if (cc-- == 0) /* then add 1 to r[0] */
            cc = mpn_add_1 (r, r, n, CNST_LIMB(1));
-         cc = mpn_sub_1 (r, r, d, cc) + 1;
+         cc = mpn_sub_1 (r, r, m, cc) + 1;
          /* add 1 to cc instead of rd since rd might overflow */
        }
 
-      /* now subtract cc and rd from r[d..n] */
+      /* now subtract cc and rd from r[m..n] */
 
-      r[n] = -mpn_sub_1 (r + d, r + d, n - d, cc);
-      r[n] -= mpn_sub_1 (r + d, r + d, n - d, rd);
+      r[n] = -mpn_sub_1 (r + m, r + m, n - m, cc);
+      r[n] -= mpn_sub_1 (r + m, r + m, n - m, rd);
       if (r[n] & GMP_LIMB_HIGHBIT)
        r[n] = mpn_add_1 (r, r, n, CNST_LIMB(1));
     }
@@ -283,7 +294,7 @@ mpn_fft_mul_2exp_modF (mp_ptr r, mp_srcptr a, unsigned int d, mp_size_t n)
    Assumes a and b are semi-normalized.
 */
 static inline void
-mpn_fft_add_modF (mp_ptr r, mp_srcptr a, mp_srcptr b, int n)
+mpn_fft_add_modF (mp_ptr r, mp_srcptr a, mp_srcptr b, mp_size_t n)
 {
   mp_limb_t c, x;
 
@@ -314,7 +325,7 @@ mpn_fft_add_modF (mp_ptr r, mp_srcptr a, mp_srcptr b, int n)
    Assumes a and b are semi-normalized.
 */
 static inline void
-mpn_fft_sub_modF (mp_ptr r, mp_srcptr a, mp_srcptr b, int n)
+mpn_fft_sub_modF (mp_ptr r, mp_srcptr a, mp_srcptr b, mp_size_t n)
 {
   mp_limb_t c, x;
 
@@ -366,14 +377,14 @@ mpn_fft_fft (mp_ptr *Ap, mp_size_t K, int **ll,
     }
   else
     {
-      int j;
+      mp_size_t j, K2 = K >> 1;
       int *lk = *ll;
 
-      mpn_fft_fft (Ap,     K >> 1, ll-1, 2 * omega, n, inc * 2, tp);
-      mpn_fft_fft (Ap+inc, K >> 1, ll-1, 2 * omega, n, inc * 2, tp);
+      mpn_fft_fft (Ap,     K2, ll-1, 2 * omega, n, inc * 2, tp);
+      mpn_fft_fft (Ap+inc, K2, ll-1, 2 * omega, n, inc * 2, tp);
       /* A[2*j*inc]   <- A[2*j*inc] + omega^l[k][2*j*inc] A[(2j+1)inc]
         A[(2j+1)inc] <- A[2*j*inc] + omega^l[k][(2j+1)inc] A[(2j+1)inc] */
-      for (j = 0; j < (K >> 1); j++, lk += 2, Ap += 2 * inc)
+      for (j = 0; j < K2; j++, lk += 2, Ap += 2 * inc)
        {
          /* Ap[inc] <- Ap[0] + Ap[inc] * 2^(lk[1] * omega)
             Ap[0]   <- Ap[0] + Ap[inc] * 2^(lk[0] * omega) */
@@ -418,7 +429,7 @@ mpn_fft_normalize (mp_ptr ap, mp_size_t n)
 
 /* a[i] <- a[i]*b[i] mod 2^(n*GMP_NUMB_BITS)+1 for 0 <= i < K */
 static void
-mpn_fft_mul_modF_K (mp_ptr *ap, mp_ptr *bp, mp_size_t n, int K)
+mpn_fft_mul_modF_K (mp_ptr *ap, mp_ptr *bp, mp_size_t n, mp_size_t K)
 {
   int i;
   int sqr = (ap == bp);
@@ -428,12 +439,13 @@ mpn_fft_mul_modF_K (mp_ptr *ap, mp_ptr *bp, mp_size_t n, int K)
 
   if (n >= (sqr ? SQR_FFT_MODF_THRESHOLD : MUL_FFT_MODF_THRESHOLD))
     {
-      int k, K2, nprime2, Nprime2, M2, maxLK, l, Mp2;
-      int **fft_l;
+      mp_size_t K2, nprime2, Nprime2, M2, maxLK, l, Mp2;
+      int k;
+      int **fft_l, *tmp;
       mp_ptr *Ap, *Bp, A, B, T;
 
       k = mpn_fft_best_k (n, sqr);
-      K2 = 1 << k;
+      K2 = (mp_size_t) 1 << k;
       ASSERT_ALWAYS((n & (K2 - 1)) == 0);
       maxLK = (K2 > GMP_NUMB_BITS) ? K2 : GMP_NUMB_BITS;
       M2 = n * GMP_NUMB_BITS >> k;
@@ -445,10 +457,10 @@ mpn_fft_mul_modF_K (mp_ptr *ap, mp_ptr *bp, mp_size_t n, int K)
       /* we should ensure that nprime2 is a multiple of the next K */
       if (nprime2 >= (sqr ? SQR_FFT_MODF_THRESHOLD : MUL_FFT_MODF_THRESHOLD))
        {
-         unsigned long K3;
+         mp_size_t K3;
          for (;;)
            {
-             K3 = 1L << mpn_fft_best_k (nprime2, sqr);
+             K3 = (mp_size_t) 1 << mpn_fft_best_k (nprime2, sqr);
              if ((nprime2 & (K3 - 1)) == 0)
                break;
              nprime2 = (nprime2 + K3 - 1) & -K3;
@@ -460,17 +472,22 @@ mpn_fft_mul_modF_K (mp_ptr *ap, mp_ptr *bp, mp_size_t n, int K)
 
       Mp2 = Nprime2 >> k;
 
-      Ap = TMP_ALLOC_MP_PTRS (K2);
-      Bp = TMP_ALLOC_MP_PTRS (K2);
-      A = TMP_ALLOC_LIMBS (2 * (nprime2 + 1) << k);
-      T = TMP_ALLOC_LIMBS (2 * (nprime2 + 1));
+      Ap = TMP_BALLOC_MP_PTRS (K2);
+      Bp = TMP_BALLOC_MP_PTRS (K2);
+      A = TMP_BALLOC_LIMBS (2 * (nprime2 + 1) << k);
+      T = TMP_BALLOC_LIMBS (2 * (nprime2 + 1));
       B = A + ((nprime2 + 1) << k);
-      fft_l = TMP_ALLOC_TYPE (k + 1, int *);
+      fft_l = TMP_BALLOC_TYPE (k + 1, int *);
+      tmp = TMP_BALLOC_TYPE ((size_t) 2 << k, int);
       for (i = 0; i <= k; i++)
-       fft_l[i] = TMP_ALLOC_TYPE (1<<i, int);
+       {
+         fft_l[i] = tmp;
+         tmp += (mp_size_t) 1 << i;
+       }
+
       mpn_fft_initl (fft_l, k);
 
-      TRACE (printf ("recurse: %ldx%ld limbs -> %d times %dx%d (%1.2f)\n", n,
+      TRACE (printf ("recurse: %ldx%ld limbs -> %ld times %ldx%ld (%1.2f)\n", n,
                    n, K2, nprime2, nprime2, 2.0*(double)n/nprime2/K2));
       for (i = 0; i < K; i++, ap++, bp++)
        {
@@ -492,10 +509,10 @@ mpn_fft_mul_modF_K (mp_ptr *ap, mp_ptr *bp, mp_size_t n, int K)
     {
       mp_ptr a, b, tp, tpn;
       mp_limb_t cc;
-      int n2 = 2 * n;
-      tp = TMP_ALLOC_LIMBS (n2);
+      mp_size_t n2 = 2 * n;
+      tp = TMP_BALLOC_LIMBS (n2);
       tpn = tp + n;
-      TRACE (printf ("  mpn_mul_n %d of %ld limbs\n", K, n));
+      TRACE (printf ("  mpn_mul_n %ld of %ld limbs\n", K, n));
       for (i = 0; i < K; i++)
        {
          a = *ap++;
@@ -529,7 +546,7 @@ mpn_fft_mul_modF_K (mp_ptr *ap, mp_ptr *bp, mp_size_t n, int K)
    This condition is also fulfilled at exit.
 */
 static void
-mpn_fft_fftinv (mp_ptr *Ap, int K, mp_size_t omega, mp_size_t n, mp_ptr tp)
+mpn_fft_fftinv (mp_ptr *Ap, mp_size_t K, mp_size_t omega, mp_size_t n, mp_ptr tp)
 {
   if (K == 2)
     {
@@ -548,7 +565,7 @@ mpn_fft_fftinv (mp_ptr *Ap, int K, mp_size_t omega, mp_size_t n, mp_ptr tp)
     }
   else
     {
-      int j, K2 = K >> 1;
+      mp_size_t j, K2 = K >> 1;
 
       mpn_fft_fftinv (Ap,      K2, 2 * omega, n, tp);
       mpn_fft_fftinv (Ap + K2, K2, 2 * omega, n, tp);
@@ -568,12 +585,12 @@ mpn_fft_fftinv (mp_ptr *Ap, int K, mp_size_t omega, mp_size_t n, mp_ptr tp)
 
 /* R <- A/2^k mod 2^(n*GMP_NUMB_BITS)+1 */
 static void
-mpn_fft_div_2exp_modF (mp_ptr r, mp_srcptr a, int k, mp_size_t n)
+mpn_fft_div_2exp_modF (mp_ptr r, mp_srcptr a, mp_bitcnt_t k, mp_size_t n)
 {
-  int i;
+  mp_bitcnt_t i;
 
   ASSERT (r != a);
-  i = 2 * n * GMP_NUMB_BITS - k;
+  i = (mp_bitcnt_t) 2 * n * GMP_NUMB_BITS - k;
   mpn_fft_mul_2exp_modF (r, a, i, n);
   /* 1/2^k = 2^(2nL-k) mod 2^(n*GMP_NUMB_BITS)+1 */
   /* normalize so that R < 2^(n*GMP_NUMB_BITS)+1 */
@@ -585,13 +602,11 @@ mpn_fft_div_2exp_modF (mp_ptr r, mp_srcptr a, int k, mp_size_t n)
    Returns carry out, i.e. 1 iff {ap,an} = -1 mod 2^(n*GMP_NUMB_BITS)+1,
    then {rp,n}=0.
 */
-static int
+static mp_size_t
 mpn_fft_norm_modF (mp_ptr rp, mp_size_t n, mp_ptr ap, mp_size_t an)
 {
-  mp_size_t l;
-  long int m;
+  mp_size_t l, m, rpn;
   mp_limb_t cc;
-  int rpn;
 
   ASSERT ((n <= an) && (an <= 3 * n));
   m = an - 2 * n;
@@ -625,10 +640,11 @@ mpn_fft_norm_modF (mp_ptr rp, mp_size_t n, mp_ptr ap, mp_size_t an)
    We must have nl <= 2*K*l.
 */
 static void
-mpn_mul_fft_decompose (mp_ptr A, mp_ptr *Ap, int K, int nprime, mp_srcptr n,
-                      mp_size_t nl, int l, int Mp, mp_ptr T)
+mpn_mul_fft_decompose (mp_ptr A, mp_ptr *Ap, mp_size_t K, mp_size_t nprime,
+                      mp_srcptr n, mp_size_t nl, mp_size_t l, mp_size_t Mp,
+                      mp_ptr T)
 {
-  int i, j;
+  mp_size_t i, j;
   mp_ptr tmp;
   mp_size_t Kl = K * l;
   TMP_DECL;
@@ -639,7 +655,7 @@ mpn_mul_fft_decompose (mp_ptr A, mp_ptr *Ap, int K, int nprime, mp_srcptr n,
       mp_size_t dif = nl - Kl;
       mp_limb_signed_t cy;
 
-      tmp = TMP_ALLOC_LIMBS(Kl + 1);
+      tmp = TMP_BALLOC_LIMBS(Kl + 1);
 
       if (dif > Kl)
        {
@@ -712,11 +728,11 @@ mpn_mul_fft_internal (mp_ptr op, mp_size_t pl, int k,
                      mp_size_t nprime, mp_size_t l, mp_size_t Mp,
                      int **fft_l, mp_ptr T, int sqr)
 {
-  int K, i, pla, lo, sh, j;
+  mp_size_t K, i, pla, lo, sh, j;
   mp_ptr p;
   mp_limb_t cc;
 
-  K = 1 << k;
+  K = (mp_size_t) 1 << k;
 
   /* direct fft's */
   mpn_fft_fft (Ap, K, fft_l + k, 2 * Mp, nprime, 1, T);
@@ -792,10 +808,10 @@ mpn_mul_fft_internal (mp_ptr op, mp_size_t pl, int k,
 }
 
 /* return the lcm of a and 2^k */
-static unsigned long int
-mpn_mul_fft_lcm (unsigned long int a, unsigned int k)
+static mp_bitcnt_t
+mpn_mul_fft_lcm (mp_bitcnt_t a, int k)
 {
-  unsigned long int l = k;
+  mp_bitcnt_t l = k;
 
   while (a % 2 == 0 && k > 0)
     {
@@ -812,10 +828,11 @@ mpn_mul_fft (mp_ptr op, mp_size_t pl,
             mp_srcptr m, mp_size_t ml,
             int k)
 {
-  int K, maxLK, i;
+  int i;
+  mp_size_t K, maxLK;
   mp_size_t N, Nprime, nprime, M, Mp, l;
   mp_ptr *Ap, *Bp, A, T, B;
-  int **fft_l;
+  int **fft_l, *tmp;
   int sqr = (n == m && nl == ml);
   mp_limb_t h;
   TMP_DECL;
@@ -825,58 +842,63 @@ mpn_mul_fft (mp_ptr op, mp_size_t pl,
 
   TMP_MARK;
   N = pl * GMP_NUMB_BITS;
-  fft_l = TMP_ALLOC_TYPE (k + 1, int *);
+  fft_l = TMP_BALLOC_TYPE (k + 1, int *);
+  tmp = TMP_BALLOC_TYPE ((size_t) 2 << k, int);
   for (i = 0; i <= k; i++)
-    fft_l[i] = TMP_ALLOC_TYPE (1 << i, int);
+    {
+      fft_l[i] = tmp;
+      tmp += (mp_size_t) 1 << i;
+    }
+
   mpn_fft_initl (fft_l, k);
-  K = 1 << k;
+  K = (mp_size_t) 1 << k;
   M = N >> k;  /* N = 2^k M */
   l = 1 + (M - 1) / GMP_NUMB_BITS;
-  maxLK = mpn_mul_fft_lcm ((unsigned long) GMP_NUMB_BITS, k); /* lcm (GMP_NUMB_BITS, 2^k) */
+  maxLK = mpn_mul_fft_lcm (GMP_NUMB_BITS, k); /* lcm (GMP_NUMB_BITS, 2^k) */
 
   Nprime = (1 + (2 * M + k + 2) / maxLK) * maxLK;
   /* Nprime = ceil((2*M+k+3)/maxLK)*maxLK; */
   nprime = Nprime / GMP_NUMB_BITS;
-  TRACE (printf ("N=%ld K=%d, M=%ld, l=%ld, maxLK=%d, Np=%ld, np=%ld\n",
+  TRACE (printf ("N=%ld K=%ld, M=%ld, l=%ld, maxLK=%ld, Np=%ld, np=%ld\n",
                 N, K, M, l, maxLK, Nprime, nprime));
   /* we should ensure that recursively, nprime is a multiple of the next K */
   if (nprime >= (sqr ? SQR_FFT_MODF_THRESHOLD : MUL_FFT_MODF_THRESHOLD))
     {
-      unsigned long K2;
+      mp_size_t K2;
       for (;;)
        {
-         K2 = 1L << mpn_fft_best_k (nprime, sqr);
+         K2 = (mp_size_t) 1 << mpn_fft_best_k (nprime, sqr);
          if ((nprime & (K2 - 1)) == 0)
            break;
          nprime = (nprime + K2 - 1) & -K2;
          Nprime = nprime * GMP_LIMB_BITS;
          /* warning: since nprime changed, K2 may change too! */
        }
-      TRACE (printf ("new maxLK=%d, Np=%ld, np=%ld\n", maxLK, Nprime, nprime));
+      TRACE (printf ("new maxLK=%ld, Np=%ld, np=%ld\n", maxLK, Nprime, nprime));
     }
   ASSERT_ALWAYS (nprime < pl); /* otherwise we'll loop */
 
-  T = TMP_ALLOC_LIMBS (2 * (nprime + 1));
+  T = TMP_BALLOC_LIMBS (2 * (nprime + 1));
   Mp = Nprime >> k;
 
-  TRACE (printf ("%ldx%ld limbs -> %d times %ldx%ld limbs (%1.2f)\n",
+  TRACE (printf ("%ldx%ld limbs -> %ld times %ldx%ld limbs (%1.2f)\n",
                pl, pl, K, nprime, nprime, 2.0 * (double) N / Nprime / K);
         printf ("   temp space %ld\n", 2 * K * (nprime + 1)));
 
-  A = TMP_ALLOC_LIMBS (K * (nprime + 1));
-  Ap = TMP_ALLOC_MP_PTRS (K);
+  A = TMP_BALLOC_LIMBS (K * (nprime + 1));
+  Ap = TMP_BALLOC_MP_PTRS (K);
   mpn_mul_fft_decompose (A, Ap, K, nprime, n, nl, l, Mp, T);
   if (sqr)
     {
       mp_size_t pla;
       pla = l * (K - 1) + nprime + 1; /* number of required limbs for p */
-      B = TMP_ALLOC_LIMBS (pla);
-      Bp = TMP_ALLOC_MP_PTRS (K);
+      B = TMP_BALLOC_LIMBS (pla);
+      Bp = TMP_BALLOC_MP_PTRS (K);
     }
   else
     {
-      B = TMP_ALLOC_LIMBS (K * (nprime + 1));
-      Bp = TMP_ALLOC_MP_PTRS (K);
+      B = TMP_BALLOC_LIMBS (K * (nprime + 1));
+      Bp = TMP_BALLOC_MP_PTRS (K);
       mpn_mul_fft_decompose (B, Bp, K, nprime, m, ml, l, Mp, T);
     }
   h = mpn_mul_fft_internal (op, pl, k, Ap, Bp, A, B, nprime, l, Mp, fft_l, T, sqr);
@@ -894,9 +916,9 @@ mpn_mul_fft_full (mp_ptr op,
 {
   mp_ptr pad_op;
   mp_size_t pl, pl2, pl3, l;
+  mp_size_t cc, c2, oldcc;
   int k2, k3;
   int sqr = (n == m && nl == ml);
-  int cc, c2, oldcc;
 
   pl = nl + ml; /* total number of limbs of the result */
 
@@ -953,7 +975,7 @@ mpn_mul_fft_full (mp_ptr op,
     TMP_DECL;
 
     TMP_MARK;
-    tmp = TMP_ALLOC_LIMBS (l);
+    tmp = TMP_BALLOC_LIMBS (l);
     MPN_COPY (tmp, pad_op, l);
     c2 = mpn_sub_n (pad_op,      pad_op, pad_op + l, l);
     cc += mpn_add_n (pad_op + l, tmp,    pad_op + l, l);
index 80cfb08f9984c8710eb01a3a4f8e0460d352bed3..5df8b16fa01b34dd6522911de414115d3d340cbb 100644 (file)
@@ -1,22 +1,33 @@
 /* mpn_mul_n -- multiply natural numbers.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-2005, 2008, 2009 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996-2003, 2005, 2008, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index ceea829dba89c3f241ce4f383b78913e9f7b1438..2120f44c3d8891a07d05e89a8560b92acbba1dbc 100644 (file)
@@ -10,17 +10,28 @@ Copyright (C) 2000, 2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 8c39b2bff0806fea71f1fc697cf32518b5469ca8..dad75ee8f76b07cdcc48dc4fb1626ba8129ac956 100644 (file)
@@ -12,17 +12,28 @@ Copyright 2004, 2005, 2009, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 67afd09b7569d7b2afe7d7f49c4ef30ea99889fe..6b4ea3253dc3a46504b407fe65fcbe94aa65942a 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index e926cc4e23c15098859646e016072c45420abb0b..400e9764240b9257552ef25d7a25e62a578481df 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
@@ -58,7 +69,7 @@ mpn_mulmid_basecase (mp_ptr rp,
     {
       up--, vp++;
       cy = mpn_addmul_1 (rp, up, un, vp[0]);
-      add_ssaaaa (hi, lo, hi, lo, 0, cy);
+      add_ssaaaa (hi, lo, hi, lo, CNST_LIMB(0), cy);
     }
 
   /* store final limbs */
index b78f0078bf1ccd4ef1a9885a15a265efa4a61be3..2280ba3a3664205172503f25efc6056fd19ae326 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 44bfe90a90e958fe79ff79065ecdb0288b9f9728..871032458384075ed9500b6cd45ac8b360e6221b 100644 (file)
@@ -1,28 +1,39 @@
 /* mulmod_bnm1.c -- multiplication mod B^n-1.
 
-   Contributed to the GNU project by Niels Möller, Torbjorn Granlund and
+   Contributed to the GNU project by Niels Möller, Torbjorn Granlund and
    Marco Bodrato.
 
    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 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 2009, 2010, 2012, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
@@ -151,25 +162,22 @@ mpn_mulmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an, mp_srcptr
        mp_size_t anm, bnm;
        mp_ptr so;
 
+       bm1 = b0;
+       bnm = bn;
        if (LIKELY (an > n))
          {
            am1 = xp;
            cy = mpn_add (xp, a0, n, a1, an - n);
            MPN_INCR_U (xp, n, cy);
            anm = n;
+           so = xp + n;
            if (LIKELY (bn > n))
              {
-               bm1 = xp + n;
-               cy = mpn_add (xp + n, b0, n, b1, bn - n);
-               MPN_INCR_U (xp + n, n, cy);
+               bm1 = so;
+               cy = mpn_add (so, b0, n, b1, bn - n);
+               MPN_INCR_U (so, n, cy);
                bnm = n;
-               so = xp + 2*n;
-             }
-           else
-             {
-               so = xp + n;
-               bm1 = b0;
-               bnm = bn;
+               so += n;
              }
          }
        else
@@ -177,8 +185,6 @@ mpn_mulmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an, mp_srcptr
            so = xp;
            am1 = a0;
            anm = an;
-           bm1 = b0;
-           bnm = bn;
          }
 
        mpn_mulmod_bnm1 (rp, n, am1, anm, bm1, bnm, so);
@@ -189,35 +195,33 @@ mpn_mulmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an, mp_srcptr
        mp_srcptr ap1, bp1;
        mp_size_t anp, bnp;
 
+       bp1 = b0;
+       bnp = bn;
        if (LIKELY (an > n)) {
          ap1 = sp1;
          cy = mpn_sub (sp1, a0, n, a1, an - n);
          sp1[n] = 0;
          MPN_INCR_U (sp1, n + 1, cy);
          anp = n + ap1[n];
+         if (LIKELY (bn > n)) {
+           bp1 = sp1 + n + 1;
+           cy = mpn_sub (sp1 + n + 1, b0, n, b1, bn - n);
+           sp1[2*n+1] = 0;
+           MPN_INCR_U (sp1 + n + 1, n + 1, cy);
+           bnp = n + bp1[n];
+         }
        } else {
          ap1 = a0;
          anp = an;
        }
 
-       if (LIKELY (bn > n)) {
-         bp1 = sp1 + n + 1;
-         cy = mpn_sub (sp1 + n + 1, b0, n, b1, bn - n);
-         sp1[2*n+1] = 0;
-         MPN_INCR_U (sp1 + n + 1, n + 1, cy);
-         bnp = n + bp1[n];
-       } else {
-         bp1 = b0;
-         bnp = bn;
-       }
-
        if (BELOW_THRESHOLD (n, MUL_FFT_MODF_THRESHOLD))
          k=0;
        else
          {
            int mask;
            k = mpn_fft_best_k (n, 0);
-           mask = (1<<k) -1;
+           mask = (1<<k) - 1;
            while (n & mask) {k--; mask >>=1;};
          }
        if (k >= FFT_FIRST_K)
index 980e59e67532e4d3dae60ea351d8c68aee7733d1..2d752e912d1f7ce0f5bdd3761ddbfe60d2087ad9 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpn_neg 1
 
index 131faf8cfbc86ecd3d2625b6f8289bf3bcdb0d52..d2bf19ad56a166ec5e4786767e82d1baf6d69471 100644 (file)
@@ -12,17 +12,28 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index b62dee89ab2f4572f9e5c06abaf9cbf653c90623..bbed6309d52b5e815c78dd998ce83aee0450e424 100644 (file)
@@ -7,17 +7,28 @@ Copyright 2009, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 892da1ae729b20f3c81343e818d9b495ef870a47..bdd82ccd96e47c20c154822c100a4436114318b2 100644 (file)
@@ -1,23 +1,34 @@
 /* mpn_perfect_square_p(u,usize) -- Return non-zero if U is a perfect square,
    zero otherwise.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2005, 2012 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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"
index 4aa0674d570762bf26d87fc6c5d7f65afbd08308..13e529b7cdaaf9760e8b79dbdb2cf2897c296e5a 100644 (file)
@@ -1,22 +1,33 @@
 /* mpn_popcount, mpn_hamdist -- mpn bit population count/hamming distance.
 
-Copyright 1994, 1996, 2000, 2001, 2002, 2005, 2011, 2012 Free Software
-Foundation, Inc.
+Copyright 1994, 1996, 2000-2002, 2005, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index d379836e31d3772d66e63f7854813a8cf6b8c944..2333206554ca22df3b3f3bc7ddcbcca14194588f 100644 (file)
@@ -4,22 +4,33 @@
    CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
    FUTURE GNU MP RELEASES.
 
-Copyright 2002 Free Software Foundation, Inc.
+Copyright 2002, 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 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.
+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 Lesser General Public License
+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 a copy of the GNU Lesser General Public License along
-with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
@@ -57,11 +68,13 @@ mpn_pow_1 (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_limb_t exp, mp_ptr tp)
      so much time that the slowness of this code will be negligible.  */
   par = 0;
   cnt = GMP_LIMB_BITS;
-  for (x = exp; x != 0; x >>= 1)
+  x = exp;
+  do
     {
-      par ^= x & 1;
+      par ^= x;
       cnt--;
-    }
+      x >>= 1;
+    } while (x != 0);
   exp <<= cnt;
 
   if (bn == 1)
index f6cc2bd97e3271639c44d49a8d5fc345249f9a08..adcd96eb518053e79cfcf7129f95b20bee90ad01 100644 (file)
@@ -1,21 +1,32 @@
 /* mpn_powlo -- Compute R = U^E mod B^n, where B is the limb base.
 
-Copyright 2007, 2008, 2009, 2012 Free Software Foundation, Inc.
+Copyright 2007-2009, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 14a73934f5ab521d1e975b216d56bfa91ea3b885..9968116016bd9fbb80d1808d18a94d9095076523 100644 (file)
@@ -6,22 +6,33 @@
    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, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2007-2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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/mpn/generic/powm_sec.c b/mpn/generic/powm_sec.c
deleted file mode 100644 (file)
index ba7c0c7..0000000
+++ /dev/null
@@ -1,446 +0,0 @@
-/* mpn_powm_sec -- Compute R = U^E mod M.  Secure variant, side-channel silent
-   under the assumption that the multiply instruction is side channel silent.
-
-   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 2007, 2008, 2009, 2011, 2012 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 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.
-
-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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://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
-
-  2. Compute table U^0, U^1, U^2... of E-dependent size
-
-  3. While there are more bits in E
-       W <- power left-to-right base-k
-
-
-  TODO:
-
-   * Make getbits a macro, thereby allowing it to update the index operand.
-     That will simplify the code using getbits.  (Perhaps make getbits' sibling
-     getbit then have similar form, for symmetry.)
-
-   * Write an itch function.  Or perhaps get rid of tp parameter since the huge
-     pp area is allocated locally anyway?
-
-   * Choose window size without looping.  (Superoptimize or think(tm).)
-
-   * Call side-channel silent division function for converting to REDC residue.
-
-   * REDC_1_TO_REDC_2_THRESHOLD might actually represent the cutoff between
-     redc_1 and redc_n.  On such systems, we will switch to redc_2 causing
-     slowdown.
-*/
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-
-#undef MPN_REDC_1_SEC
-#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_subcnd_n (rp, rp, mp, n, cy);                                  \
-  } while (0)
-
-#undef MPN_REDC_2_SEC
-#define MPN_REDC_2_SEC(rp, up, mp, n, mip)                             \
-  do {                                                                 \
-    mp_limb_t cy;                                                      \
-    cy = mpn_redc_2 (rp, up, mp, n, mip);                              \
-    mpn_subcnd_n (rp, rp, mp, n, cy);                                  \
-  } while (0)
-
-#if HAVE_NATIVE_mpn_addmul_2 || HAVE_NATIVE_mpn_redc_2
-#define WANT_REDC_2 1
-#endif
-
-/* Define our own mpn squaring function.  We do this since we cannot use a
-   native mpn_sqr_basecase over TUNE_SQR_TOOM2_MAX, or a non-native one over
-   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
-#endif
-
-#if HAVE_NATIVE_mpn_sqr_basecase
-#ifdef TUNE_SQR_TOOM2_MAX
-/* We slightly abuse TUNE_SQR_TOOM2_MAX here.  If it is set for an assembly
-   mpn_sqr_basecase, it comes from SQR_TOOM2_THRESHOLD_MAX in the assembly
-   file.  An assembly mpn_sqr_basecase that does not define it, should allow
-   any size.  */
-#define SQR_BASECASE_LIM  SQR_TOOM2_THRESHOLD
-#endif
-#endif
-
-#ifdef WANT_FAT_BINARY
-/* For fat builds, we use SQR_TOOM2_THRESHOLD which will expand to a read from
-   __gmpn_cpuvec.  Perhaps any possible sqr_basecase.asm allow any size, and we
-   limit the use unnecessarily.  We cannot tell, so play it safe.  FIXME.  */
-#define SQR_BASECASE_LIM  SQR_TOOM2_THRESHOLD
-#endif
-
-#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
-/* Define our own squaring function, which uses mpn_sqr_basecase for its
-   allowed sizes, but its own code for larger sizes.  */
-static void
-mpn_local_sqr (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_ptr tp)
-{
-  mp_size_t i;
-
-  ASSERT (n >= 1);
-  ASSERT (! MPN_OVERLAP_P (rp, 2*n, up, n));
-
-  if (BELOW_THRESHOLD (n, SQR_BASECASE_LIM))
-    {
-      mpn_sqr_basecase (rp, up, n);
-      return;
-    }
-
-  {
-    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)
-    {
-      mp_limb_t cy;
-
-      cy = mpn_mul_1 (tp, up + 1, n - 1, up[0]);
-      tp[n - 1] = cy;
-      for (i = 2; i < n; i++)
-       {
-         mp_limb_t cy;
-         cy = mpn_addmul_1 (tp + 2 * i - 2, up + i, n - i, up[i - 1]);
-         tp[n + i - 2] = cy;
-       }
-      MPN_SQR_DIAGONAL (rp + 2, up + 1, n - 1);
-
-      {
-       mp_limb_t cy;
-#if HAVE_NATIVE_mpn_addlsh1_n
-       cy = mpn_addlsh1_n (rp + 1, rp + 1, tp, 2 * n - 2);
-#else
-       cy = mpn_lshift (tp, tp, 2 * n - 2, 1);
-       cy += mpn_add_n (rp + 1, rp + 1, tp, 2 * n - 2);
-#endif
-       rp[2 * n - 1] += cy;
-      }
-    }
-}
-#endif
-
-#define getbit(p,bi) \
-  ((p[(bi - 1) / GMP_NUMB_BITS] >> (bi - 1) % GMP_NUMB_BITS) & 1)
-
-static inline mp_limb_t
-getbits (const mp_limb_t *p, mp_bitcnt_t bi, int nbits)
-{
-  int nbits_in_r;
-  mp_limb_t r;
-  mp_size_t i;
-
-  if (bi < nbits)
-    {
-      return p[0] & (((mp_limb_t) 1 << bi) - 1);
-    }
-  else
-    {
-      bi -= nbits;                     /* bit index of low bit to extract */
-      i = bi / GMP_NUMB_BITS;          /* word index of low bit to extract */
-      bi %= GMP_NUMB_BITS;             /* bit index in low word */
-      r = p[i] >> bi;                  /* extract (low) bits */
-      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);
-    }
-}
-
-#ifndef POWM_SEC_TABLE
-#if GMP_NUMB_BITS < 50
-#define POWM_SEC_TABLE  2,33,96,780,2741
-#else
-#define POWM_SEC_TABLE  2,130,524,2578
-#endif
-#endif
-
-#if TUNE_PROGRAM_BUILD
-extern int win_size (mp_bitcnt_t);
-#else
-static inline int
-win_size (mp_bitcnt_t eb)
-{
-  int k;
-  static mp_bitcnt_t x[] = {0,POWM_SEC_TABLE,~(mp_bitcnt_t)0};
-  for (k = 1; eb > x[k]; k++)
-    ;
-  return k;
-}
-#endif
-
-/* Convert U to REDC form, U_r = B^n * U mod M.
-   Uses scratch space at tp of size 2un + n + 1.  */
-static void
-redcify (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr mp, mp_size_t n, mp_ptr tp)
-{
-#if 0
-  mp_ptr qp;
-
-  qp = tp + un + n;            /* un + n - n + 1 = un + 1 limbs */
-
-  MPN_ZERO (tp, n);
-  MPN_COPY (tp + n, up, un);
-
-  mpn_tdiv_qr (qp, rp, 0L, tp, un + n, mp, n);
-#else
-  /* FIXME: Use passed scratch space instead of allocating our own!  */
-  mp_ptr scratch;
-  TMP_DECL;
-  TMP_MARK;
-
-  MPN_ZERO (tp, n);
-  MPN_COPY (tp + n, up, un);
-
-  scratch = TMP_ALLOC_LIMBS ((un + n) + 2 * n + 2);
-  mpn_sb_div_r_sec (tp, un + n, mp, n, scratch);
-  MPN_COPY (rp, tp, n);
-  TMP_FREE;
-#endif
-}
-
-/* rp[n-1..0] = bp[bn-1..0] ^ ep[en-1..0] mod mp[n-1..0]
-   Requires that mp[n-1..0] is odd.
-   Requires that ep[en-1..0] > 1.
-   Uses scratch space at tp as defined by mpn_powm_sec_itch.  */
-void
-mpn_powm_sec (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
-             mp_srcptr ep, mp_size_t en,
-             mp_srcptr mp, mp_size_t n, mp_ptr tp)
-{
-  mp_limb_t ip[2], *mip;
-  mp_bitcnt_t ebi;
-  int windowsize, this_windowsize;
-  mp_limb_t expbits;
-  mp_ptr pp, this_pp;
-  long i;
-  int cnd;
-
-  ASSERT (en > 1 || (en == 1 && ep[0] > 0));
-  ASSERT (n >= 1 && ((mp[0] & 1) != 0));
-
-  MPN_SIZEINBASE_2EXP(ebi, ep, en, 1);
-
-  windowsize = win_size (ebi);
-
-#if WANT_REDC_2
-  if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
-    {
-      mip = ip;
-      binvert_limb (mip[0], mp[0]);
-      mip[0] = -mip[0];
-    }
-  else
-    {
-      mip = ip;
-      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 */
-
-  /* Compute pp[0] table entry */
-  /* scratch: |   n   | 1 |   n+2    |  */
-  /*          | pp[0] | 1 | redcify  |  */
-  this_pp = pp;
-  this_pp[n] = 1;
-  redcify (this_pp, this_pp + n, 1, mp, n, this_pp + n + 1);
-  this_pp += n;
-
-  /* Compute pp[1] table entry.  To avoid excessive scratch usage in the
-     degenerate situation where B >> M, we let redcify use scratch space which
-     will later be used by the pp table (element 2 and up).  */
-  /* scratch: |   n   |   n   |  bn + n + 1  |  */
-  /*          | pp[0] | pp[1] |   redcify    |  */
-  redcify (this_pp, bp, bn, mp, n, this_pp + n);
-
-  /* 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--)
-    {
-      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
-    }
-
-  expbits = getbits (ep, ebi, windowsize);
-  if (ebi < windowsize)
-    ebi = 0;
-  else
-    ebi -= windowsize;
-
-  mpn_tabselect (rp, pp, n, 1 << windowsize, expbits);
-
-  /* Main exponentiation loop.  */
-  /* scratch: |   n   |   n   | ...  |                    |     3n-4n     |  */
-  /*          | pp[0] | pp[1] | ...  | pp[2^windowsize-1] |  loop scratch |  */
-
-#define INNERLOOP                                                      \
-  while (ebi != 0)                                                     \
-    {                                                                  \
-      expbits = getbits (ep, ebi, windowsize);                         \
-      this_windowsize = windowsize;                                    \
-      if (ebi < windowsize)                                            \
-       {                                                               \
-         this_windowsize -= windowsize - ebi;                          \
-         ebi = 0;                                                      \
-       }                                                               \
-      else                                                             \
-       ebi -= windowsize;                                              \
-                                                                       \
-      do                                                               \
-       {                                                               \
-         mpn_local_sqr (tp, rp, n, tp + 2 * n);                        \
-         MPN_REDUCE (rp, tp, mp, n, mip);                              \
-         this_windowsize--;                                            \
-       }                                                               \
-      while (this_windowsize != 0);                                    \
-                                                                       \
-      mpn_tabselect (tp + 2*n, pp, n, 1 << windowsize, expbits);       \
-      mpn_mul_basecase (tp, rp, n, tp + 2*n, n);                       \
-                                                                       \
-      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_subcnd_n (rp, rp, mp, n, !cnd);
-}
-
-mp_size_t
-mpn_powm_sec_itch (mp_size_t bn, mp_size_t en, mp_size_t n)
-{
-  int windowsize;
-  mp_size_t redcify_itch, itch;
-
-  /* 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
-     mpn_sqr_basecase.  We assume 4n always for now.) */
-
-  windowsize = win_size (en * GMP_NUMB_BITS); /* slight over-estimate of exp */
-
-  /* The 2n term is due to pp[0] and pp[1] at the time of the 2nd redcify call,
-     the 2bn + n + 1 term is due to redcify's own usage.  */
-  redcify_itch = (2 * n) + (2 * bn + n + 1);
-
-  /* The n * 2^windowsize term is due to the power table, the 4n term is due to
-     scratch needs of squaring/multiplication in the exponentiation loop.  */
-  itch = (n << windowsize) + (4 * n);
-
-  return MAX (itch, redcify_itch);
-}
index 134b4cb4443f7957647938b7f7827d384db985bf..8027f0216e52b3b1edcc3955ddc4c3d0d58b6382 100644 (file)
@@ -4,22 +4,33 @@
    CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
    FUTURE GNU MP RELEASES.
 
-Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2000-2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 1486d6e2e74c9194f0f74a60d12adee3b5847a9a..cb38f4a48f4ae85c40bf76e116d568b67bbc52dd 100644 (file)
@@ -2,23 +2,34 @@
    DINV should be 2^(2*GMP_LIMB_BITS) / D - 2^GMP_LIMB_BITS.
    Return the single-limb remainder.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2004, 2005 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2002, 2004, 2005 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 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.
+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 Lesser General Public License
+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 a copy of the GNU Lesser General Public License along
-with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index c0b85ea07535d19eebc70f59ee71e8bc56e213c8..5489becf4dc841a4b3cf41a9769e94894ff35d6e 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index a778d4901286e6ea476a0cd5b0f277603b0e37d3..980b15367fcfe9ff0016173f2fb43322cb2d634f 100644 (file)
@@ -1,23 +1,33 @@
 /* mpn_random2 -- Generate random numbers with relatively long strings
    of ones and zeroes.  Suitable for border testing.
 
-Copyright 1992, 1993, 1994, 1996, 2000, 2001, 2002, 2004, 2012 Free Software
-Foundation, Inc.
+Copyright 1992-1994, 1996, 2000-2002, 2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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 +72,7 @@ gmp_rrandomb (mp_ptr rp, gmp_randstate_t rstate, mp_bitcnt_t nbits)
   mp_size_t i;
 
   /* Set entire result to 111..1  */
-  i = (nbits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS - 1;
+  i = BITS_TO_LIMBS (nbits) - 1;
   rp[i] = GMP_NUMB_MAX >> (GMP_NUMB_BITS - (nbits % GMP_NUMB_BITS)) % GMP_NUMB_BITS;
   for (i = i - 1; i >= 0; i--)
     rp[i] = GMP_NUMB_MAX;
index 8c84aea0e62a2c716d561696b0036c104f6fddb2..0d33421f634ad337897668f7e4d240798a3b9e3d 100644 (file)
@@ -4,23 +4,33 @@
    THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE.  IT IS ONLY
    SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
 
-Copyright (C) 2000, 2001, 2002, 2004, 2008, 2009, 2012 Free Software
-Foundation, Inc.
+Copyright (C) 2000-2002, 2004, 2008, 2009, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index efc1e925444ccda12a55c83aedd6e10cb805a549..07d90fa20d1aee529c76a82c1d171fffb58db0c8 100644 (file)
@@ -4,23 +4,33 @@
    THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE.  IT IS ONLY
    SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
 
-Copyright (C) 2000, 2001, 2002, 2004, 2008, 2012 Free Software Foundation,
-Inc.
+Copyright (C) 2000-2002, 2004, 2008, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index debfba2218589aa068089b93410c8ef10e2f268a..c3d0cfe7fa364967257e20add11ae5cf4e84c520 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2009, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 446b259b783a0abdabf8c876e970c3c9af42f512..ef1a06ea1433a2b25ce54475a39257def11bccbe 100644 (file)
@@ -7,22 +7,33 @@
    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 Free Software Foundation, Inc.
+Copyright 2009, 2012, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -42,9 +53,10 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
    FIXME: We currently allow any operand overlap.  This is quite non mpn-ish
    and might be changed, since it cost significant temporary space.
-   * If we require W to have space for un limbs, we could save qp or qp2 (but
-     we will still need to copy things into wp 50% of the time).
-   * If we allow ourselves to clobber U, we could save the other of qp and qp2.
+   * If we require W to have space for un + 1 limbs, we could save qp or qp2
+     (but we will still need to copy things into wp 50% of the time).
+   * If we allow ourselves to clobber U, we could save the other of qp and qp2,
+     and the initial COPY (but also here we would need un + 1 limbs).
 */
 
 /* FIXME: We need to wrap mpn_bdiv_qr due to the itch interface.  This need
@@ -89,7 +101,6 @@ mpn_remove (mp_ptr wp, mp_size_t *wn,
   tp = TMP_ALLOC_LIMBS ((un + 1 + vn) / 2); /* remainder */
   qp = TMP_ALLOC_LIMBS (un + 1);       /* quotient, alternating */
   qp2 = TMP_ALLOC_LIMBS (un + 1);      /* quotient, alternating */
-  np = TMP_ALLOC_LIMBS (un + LOG);     /* powers of V */
   pp = vp;
   pn = vn;
 
@@ -119,18 +130,20 @@ mpn_remove (mp_ptr wp, mp_size_t *wn,
       if (nn > qn)
        break;                  /* next power would be overlarge */
 
+      if (npowers == 1)                /* Alloc once, but only if it's needed */
+       np = TMP_ALLOC_LIMBS (qn + LOG);        /* powers of V */
+      else
+       np += pn;
+
       mpn_sqr (np, pp, pn);
-      nn += np[nn] != 0;
+      pn = nn + (np[nn] != 0);
       pp = np;
-      pn = nn;
-      np += nn;
     }
 
   pwr = ((mp_bitcnt_t) 1 << npowers) - 1;
 
   for (i = npowers - 1; i >= 0; i--)
     {
-      pp = pwpsp[i];
       pn = pwpsn[i];
       if (qn < pn)
        continue;
@@ -139,7 +152,7 @@ mpn_remove (mp_ptr wp, mp_size_t *wn,
        continue;               /* V^i would bring us past cap */
 
       qp[qn] = 0;
-      mpn_bdiv_qr_wrap (qp2, tp, qp, qn + 1, pp, pn);
+      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 */
 
index b3664121409fd0a57744451a036c5494fda4068a..2edc74baa36c96a6a699035113335bdca304ce47 100644 (file)
@@ -8,22 +8,33 @@
    ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES.  IN FACT, IT'S ALMOST
    GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
 
-Copyright 2002, 2005, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2002, 2005, 2009-2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* FIXME:
      This implementation is not optimal when remp == NULL, since the complexity
index 62256656dece681506c85ae6c9e45133b08f44d5..ec61f2f7e248841e81890214e02a81c2039183c2 100644 (file)
@@ -1,22 +1,32 @@
 /* mpn_rshift -- Shift right low level.
 
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 1996, 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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/mpn/generic/sb_div_sec.c b/mpn/generic/sb_div_sec.c
deleted file mode 100644 (file)
index d47e7e2..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/* mpn_sb_div_qr_sec, mpn_sb_div_r_sec -- Compute Q = floor(U / V), U = U mod
-   V.  Side-channel silent under the assumption that the used instructions are
-   side-channel silent.
-
-   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 2011, 2012 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 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.
-
-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 Lesser General Public License
-for more details.
-
-You should have received a copy of the GNU Lesser General Public License along
-with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-
-#if OPERATION_sb_div_qr_sec
-/* Needs (nn + dn + 1) + mpn_sbpi1_div_qr_sec's needs of (2nn' - dn + 1) for a
-   total of 3nn + 4 limbs at tp.  Note that mpn_sbpi1_div_qr_sec's nn is one
-   greater than ours, therefore +4 and not just +2.  */
-#define FNAME mpn_sb_div_qr_sec
-#define Q(q) q,
-#endif
-#if OPERATION_sb_div_r_sec
-/* Needs (nn + dn + 1) + mpn_sbpi1_div_r_sec's needs of (dn + 1) for a total of
-   nn + 2dn + 2 limbs at tp.  */
-#define FNAME mpn_sb_div_r_sec
-#define Q(q)
-#endif
-
-void
-FNAME (Q(mp_ptr qp)
-       mp_ptr np, mp_size_t nn,
-       mp_srcptr dp, mp_size_t dn,
-       mp_ptr tp)
-{
-  mp_limb_t d1, d0, qh;
-  unsigned int cnt;
-  mp_ptr np2, dp2;
-  gmp_pi1_t dinv;
-  mp_limb_t inv32;
-  mp_limb_t cy;
-
-  ASSERT (dn >= 1);
-  ASSERT (nn >= dn);
-  ASSERT (dp[dn - 1] != 0);
-
-  d1 = dp[dn - 1];
-  count_leading_zeros (cnt, d1);
-
-  if (cnt != 0)
-    {
-      dp2 = tp;                                        /* dn limbs */
-      mpn_lshift (dp2, dp, dn, cnt);
-
-      np2 = tp + dn;                           /* (nn + 1) limbs */
-      cy = mpn_lshift (np2, np, nn, cnt);
-      np2[nn++] = cy;
-    }
-  else
-    {
-      /* FIXME: Consider copying np->np2 here, adding a 0-limb at the top.
-        That would simplify the underlying sbpi1 function, since then it
-        could assume nn > dn.  */
-      dp2 = (mp_ptr) dp;
-      np2 = np;
-    }
-
-  d0 = dp2[dn - 1];
-  d0 += (~d0 != 0);
-  invert_limb (inv32, d0);
-
-  /* We add nn + dn to tp here, not nn + 1 + dn, as expected.  This is since nn
-     here will have been incremented.  */
-#if OPERATION_sb_div_qr_sec
-  qh = mpn_sbpi1_div_qr_sec (qp, np2, nn, dp2, dn, inv32, tp + nn + dn);
-#else
-  mpn_sbpi1_div_r_sec (np2, nn, dp2, dn, inv32, tp + nn + dn);
-#endif
-
-  if (cnt == 0)
-    ;                          /* we have np = np2 here. */
-  else
-    mpn_rshift (np, np2, dn, cnt);
-
-#if OPERATION_sb_div_qr_sec
-  if (cnt == 0)
-    qp[nn - dn] = qh;
-#endif
-}
index 013eb81b5a5da47625b70875d4f9a7a26bb0ae26..645b1d9b6a42a594f9f3eb0b7f45823d3be27113 100644 (file)
@@ -1,7 +1,7 @@
 /* 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.
 
    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
@@ -12,17 +12,28 @@ Copyright 2005, 2006, 2009, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 666f801d9b3b7dde35a8c02c31b5962ae8b53f4e..0e56f5814873f80a7cd87f5d4976d8372b3621d6 100644 (file)
@@ -1,7 +1,7 @@
 /* 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.
 
    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
@@ -12,17 +12,28 @@ Copyright 2006, 2009, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 595a03f09228dad44076430c7087acccf1feac9d..3abbd579336f0fce001569e3bbd24e09629c9203 100644 (file)
@@ -1,4 +1,4 @@
-/* mpn_sbpi1_div_q -- Schoolbook division using the Möller-Granlund 3/2
+/* mpn_sbpi1_div_q -- Schoolbook division using the Möller-Granlund 3/2
    division algorithm.
 
    Contributed to the GNU project by Torbjorn Granlund.
@@ -12,17 +12,28 @@ Copyright 2007, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 7e53aae58f4addf68c3b7797bcbf3b0dad114be5..0c3e4cb72987199af3f4024891b76109e019018f 100644 (file)
@@ -1,4 +1,4 @@
-/* mpn_sbpi1_div_qr -- Schoolbook division using the Möller-Granlund 3/2
+/* mpn_sbpi1_div_qr -- Schoolbook division using the Möller-Granlund 3/2
    division algorithm.
 
    Contributed to the GNU project by Torbjorn Granlund.
@@ -12,17 +12,28 @@ Copyright 2007, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
diff --git a/mpn/generic/sbpi1_div_sec.c b/mpn/generic/sbpi1_div_sec.c
deleted file mode 100644 (file)
index 60dfe6f..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/* mpn_sbpi1_div_qr_sec, mpn_sbpi1_div_r_sec -- Compute Q = floor(U / V), U = U
-   mod V.  Side-channel silent under the assumption that the used instructions
-   are side-channel silent.
-
-   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 2011, 2012, 2013 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 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.
-
-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 Lesser General Public License
-for more details.
-
-You should have received a copy of the GNU Lesser General Public License along
-with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-
-/* This side-channel silent division algorithm reduces the partial remainder by
-   GMP_NUMB_BITS/2 bits at a time, compared to GMP_NUMB_BITS for the main
-   division algorithm.  We do not insists on reducing by exactly
-   GMP_NUMB_BITS/2, but may leave a partial remainder that is D*B^i to 3D*B^i
-   too large (B is the limb base, D is the divisor, and i is the induction
-   variable); the subsequent step will handle the extra partial remainder bits.
-
-   With that partial remainder reduction, each step generates a quotient "half
-   limb".  The outer loop generates two quotient half limbs, an upper (q1h) and
-   a lower (q0h) which are stored sparsely in separate limb arrays.  These
-   arrays are added at the end; using separate arrays avoids data-dependent
-   carry propagation which could else pose a side-channel leakage problem.
-
-   The quotient half limbs may be between -3 to 0 from the accurate value
-   ("accurate" being the one which corresponds to a reduction to a principal
-   partial remainder).  Too small quotient half limbs correspond to too large
-   remainders, which we reduce later, as described above.
-
-   In order to keep quotients from getting too big, corresponding to a negative
-   partial remainder, we use an inverse which is slightly smaller than usually.
-*/
-
-#if OPERATION_sbpi1_div_qr_sec
-/* Needs (dn + 1) + (nn - dn) + (nn - dn) = 2nn - dn + 1 limbs at tp. */
-#define FNAME mpn_sbpi1_div_qr_sec
-#define Q(q) q,
-#define RETTYPE mp_limb_t
-#endif
-#if OPERATION_sbpi1_div_r_sec
-/* Needs (dn + 1) limbs at tp.  */
-#define FNAME mpn_sbpi1_div_r_sec
-#define Q(q)
-#define RETTYPE void
-#endif
-
-RETTYPE
-FNAME (Q(mp_ptr qp)
-       mp_ptr np, mp_size_t nn,
-       mp_srcptr dp, mp_size_t dn,
-       mp_limb_t dinv,
-       mp_ptr tp)
-{
-  mp_limb_t nh, cy, q1h, q0h, dummy, cnd;
-  mp_size_t i;
-  mp_ptr hp;
-#if OPERATION_sbpi1_div_qr_sec
-  mp_limb_t qh;
-  mp_ptr qlp, qhp;
-#endif
-
-  ASSERT (dn >= 1);
-  ASSERT (nn >= dn);
-  ASSERT ((dp[dn - 1] & GMP_NUMB_HIGHBIT) != 0);
-
-  if (nn == dn)
-    {
-      cy = mpn_sub_n (np, np, dp, dn);
-      mpn_addcnd_n (np, np, dp, dn, cy);
-#if OPERATION_sbpi1_div_qr_sec
-      return 1 - cy;
-#else
-      return;
-#endif
-    }
-
-  /* Create a divisor copy shifted half a limb.  */
-  hp = tp;                                     /* (dn + 1) limbs */
-  hp[dn] = mpn_lshift (hp, dp, dn, GMP_NUMB_BITS / 2);
-
-#if OPERATION_sbpi1_div_qr_sec
-  qlp = tp + (dn + 1);                         /* (nn - dn) limbs */
-  qhp = tp + (nn + 1);                         /* (nn - dn) limbs */
-#endif
-
-  np += nn - dn;
-  nh = 0;
-
-  for (i = nn - dn - 1; i >= 0; i--)
-    {
-      np--;
-
-      nh = (nh << GMP_NUMB_BITS/2) + (np[dn] >> GMP_NUMB_BITS/2);
-      umul_ppmm (q1h, dummy, nh, dinv);
-      q1h += nh;
-#if OPERATION_sbpi1_div_qr_sec
-      qhp[i] = q1h;
-#endif
-      mpn_submul_1 (np, hp, dn + 1, q1h);
-
-      nh = np[dn];
-      umul_ppmm (q0h, dummy, nh, dinv);
-      q0h += nh;
-#if OPERATION_sbpi1_div_qr_sec
-      qlp[i] = q0h;
-#endif
-      nh -= mpn_submul_1 (np, dp, dn, q0h);
-    }
-
-  /* 1st adjustment depends on extra high remainder limb.  */
-  cnd = nh != 0;                               /* FIXME: cmp-to-int */
-#if OPERATION_sbpi1_div_qr_sec
-  qlp[0] += cnd;
-#endif
-  nh -= mpn_subcnd_n (np, np, dp, dn, cnd);
-
-  /* 2nd adjustment depends on remainder/divisor comparison as well as whether
-     extra remainder limb was nullified by previous subtract.  */
-  cy = mpn_sub_n (np, np, dp, dn);
-  cy = cy - nh;
-#if OPERATION_sbpi1_div_qr_sec
-  qlp[0] += 1 - cy;
-#endif
-  mpn_addcnd_n (np, np, dp, dn, cy);
-
-  /* 3rd adjustment depends on remainder/divisor comparison.  */
-  cy = mpn_sub_n (np, np, dp, dn);
-#if OPERATION_sbpi1_div_qr_sec
-  qlp[0] += 1 - cy;
-#endif
-  mpn_addcnd_n (np, np, dp, dn, cy);
-
-#if OPERATION_sbpi1_div_qr_sec
-  /* Combine quotient halves into final quotient.  */
-  qh = mpn_lshift (qhp, qhp, nn - dn, GMP_NUMB_BITS/2);
-  qh += mpn_add_n (qp, qhp, qlp, nn - dn);
-
-  return qh;
-#else
-  return;
-#endif
-}
index 53d4a250666bd6d8a594a52345551da1a8a4e354..3e7cf91ba610ba2c3e41451960f3a23b3ea9b754 100644 (file)
@@ -1,4 +1,4 @@
-/* mpn_sbpi1_divappr_q -- Schoolbook division using the Möller-Granlund 3/2
+/* mpn_sbpi1_divappr_q -- Schoolbook division using the Möller-Granlund 3/2
    division algorithm, returning approximate quotient.  The quotient returned
    is either correct, or one too large.
 
@@ -13,17 +13,28 @@ Copyright 2007, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 234ba9bfba7d969f351d599024007daa640f9a3d..8171fd5afeec71f3f56bc5abc851169ffd8db54c 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1994, 1996, 2001, 2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 9fb2446af5829575accb04c57e4a2e1583e4185a..e22ad5d827a3c736575fcf6bffd1e2002a790941 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1994, 1996, 2001, 2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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/mpn/generic/sec_aors_1.c b/mpn/generic/sec_aors_1.c
new file mode 100644 (file)
index 0000000..d789a57
--- /dev/null
@@ -0,0 +1,60 @@
+/* mpn_sec_add_1, mpn_sec_sub_1
+
+   Contributed to the GNU project by Niels Möller
+
+Copyright 2013, 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/.  */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+
+#if OPERATION_sec_add_1
+#define FNAME mpn_sec_add_1
+#define FNAME_itch mpn_sec_add_1_itch
+#define OP_N mpn_add_n
+#endif
+#if OPERATION_sec_sub_1
+#define FNAME mpn_sec_sub_1
+#define FNAME_itch mpn_sec_sub_1_itch
+#define OP_N mpn_sub_n
+#endif
+
+/* It's annoying to that we need scratch space */
+mp_size_t
+FNAME_itch (mp_size_t n)
+{
+  return n;
+}
+
+mp_limb_t
+FNAME (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_ptr scratch)
+{
+  scratch[0] = b;
+  MPN_ZERO (scratch + 1, n-1);
+  return OP_N (rp, ap, scratch, n);
+}
diff --git a/mpn/generic/sec_div.c b/mpn/generic/sec_div.c
new file mode 100644 (file)
index 0000000..483b118
--- /dev/null
@@ -0,0 +1,133 @@
+/* mpn_sec_div_qr, mpn_sec_div_r -- Compute Q = floor(U / V), U = U mod V.
+   Side-channel silent under the assumption that the used instructions are
+   side-channel silent.
+
+   Contributed to the GNU project by Torbjörn Granlund.
+
+Copyright 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/.  */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+#if OPERATION_sec_div_qr
+#define FNAME mpn_sec_div_qr
+#define FNAME_itch mpn_sec_div_qr_itch
+#define Q(q) q,
+#define RETTYPE mp_limb_t
+#endif
+#if OPERATION_sec_div_r
+#define FNAME mpn_sec_div_r
+#define FNAME_itch mpn_sec_div_r_itch
+#define Q(q)
+#define RETTYPE void
+#endif
+
+mp_size_t
+FNAME_itch (mp_size_t nn, mp_size_t dn)
+{
+#if OPERATION_sec_div_qr
+/* Needs (nn + dn + 1) + mpn_sec_pi1_div_qr's needs of (2nn' - dn + 1) for a
+   total of 3nn + 4 limbs at tp.  Note that mpn_sec_pi1_div_qr's nn is one
+   greater than ours, therefore +4 and not just +2.  */
+  return 3 * nn + 4;
+#endif
+#if OPERATION_sec_div_r
+/* Needs (nn + dn + 1) + mpn_sec_pi1_div_r's needs of (dn + 1) for a total of
+   nn + 2dn + 2 limbs at tp.  */
+  return nn + 2 * dn + 2;
+#endif
+}
+
+RETTYPE
+FNAME (Q(mp_ptr qp)
+       mp_ptr np, mp_size_t nn,
+       mp_srcptr dp, mp_size_t dn,
+       mp_ptr tp)
+{
+  mp_limb_t d1, d0;
+  unsigned int cnt;
+  gmp_pi1_t dinv;
+  mp_limb_t inv32;
+
+  ASSERT (dn >= 1);
+  ASSERT (nn >= dn);
+  ASSERT (dp[dn - 1] != 0);
+
+  d1 = dp[dn - 1];
+  count_leading_zeros (cnt, d1);
+
+  if (cnt != 0)
+    {
+      mp_limb_t qh, cy;
+      mp_ptr np2, dp2;
+      dp2 = tp;                                        /* dn limbs */
+      mpn_lshift (dp2, dp, dn, cnt);
+
+      np2 = tp + dn;                           /* (nn + 1) limbs */
+      cy = mpn_lshift (np2, np, nn, cnt);
+      np2[nn++] = cy;
+
+      d0 = dp2[dn - 1];
+      d0 += (~d0 != 0);
+      invert_limb (inv32, d0);
+
+      /* We add nn + dn to tp here, not nn + 1 + dn, as expected.  This is
+        since nn here will have been incremented.  */
+#if OPERATION_sec_div_qr
+      qh = mpn_sec_pi1_div_qr (np2 + dn, np2, nn, dp2, dn, inv32, tp + nn + dn);
+      ASSERT (qh == 0);                /* FIXME: this indicates inefficiency! */
+      MPN_COPY (qp, np2 + dn, nn - dn - 1);
+      qh = np2[nn - 1];
+#else
+      mpn_sec_pi1_div_r (np2, nn, dp2, dn, inv32, tp + nn + dn);
+#endif
+
+      mpn_rshift (np, np2, dn, cnt);
+
+#if OPERATION_sec_div_qr
+      return qh;
+#endif
+    }
+  else
+    {
+      /* FIXME: Consider copying np => np2 here, adding a 0-limb at the top.
+        That would simplify the underlying pi1 function, since then it could
+        assume nn > dn.  */
+      d0 = dp[dn - 1];
+      d0 += (~d0 != 0);
+      invert_limb (inv32, d0);
+
+#if OPERATION_sec_div_qr
+      return mpn_sec_pi1_div_qr (qp, np, nn, dp, dn, inv32, tp);
+#else
+      mpn_sec_pi1_div_r (np, nn, dp, dn, inv32, tp);
+#endif
+    }
+}
diff --git a/mpn/generic/sec_invert.c b/mpn/generic/sec_invert.c
new file mode 100644 (file)
index 0000000..43a578b
--- /dev/null
@@ -0,0 +1,195 @@
+/* mpn_sec_invert
+
+   Contributed to the GNU project by Niels Möller
+
+Copyright 2013 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.h"
+#include "gmp-impl.h"
+
+#if 0
+/* Currently unused. Should be resurrected once mpn_cnd_neg is
+   advertised. */
+static mp_size_t
+mpn_cnd_neg_itch (mp_size_t n)
+{
+  return n;
+}
+#endif
+
+/* FIXME: Ought to return carry */
+static void
+mpn_cnd_neg (int cnd, mp_limb_t *rp, const mp_limb_t *ap, mp_size_t n,
+            mp_ptr scratch)
+{
+  mpn_lshift (scratch, ap, n, 1);
+  mpn_cnd_sub_n (cnd, rp, ap, scratch, n);
+}
+
+static void
+mpn_cnd_swap (int cnd, volatile mp_limb_t *ap, volatile mp_limb_t *bp,
+             mp_size_t n)
+{
+  volatile mp_limb_t mask = - (mp_limb_t) (cnd != 0);
+  mp_size_t i;
+  for (i = 0; i < n; i++)
+    {
+      mp_limb_t a, b, t;
+      a = ap[i];
+      b = bp[i];
+      t = (a ^ b) & mask;
+      ap[i] = a ^ t;
+      bp[i] = b ^ t;
+    }
+}
+
+static int
+mpn_sec_eq_ui (mp_srcptr ap, mp_size_t n, mp_limb_t b)
+{
+  mp_limb_t d;
+  ASSERT (n > 0);
+
+  d = ap[0] ^ b;
+
+  while (--n > 0)
+    d |= ap[n];
+
+  return d == 0;
+}
+
+mp_size_t
+mpn_sec_invert_itch (mp_size_t n)
+{
+  return 4*n;
+}
+
+/* Compute V <-- A^{-1} (mod M), in data-independent time. M must be
+   odd. Returns 1 on success, and 0 on failure (i.e., if gcd (A, m) !=
+   1). Inputs and outputs of size n, and no overlap allowed. The {ap,
+   n} area is destroyed. For arbitrary inputs, bit_size should be
+   2*n*GMP_NUMB_BITS, but if A or M are known to be smaller, e.g., if
+   M = 2^521 - 1 and A < M, bit_size can be any bound on the sum of
+   the bit sizes of A and M. */
+int
+mpn_sec_invert (mp_ptr vp, mp_ptr ap, mp_srcptr mp,
+               mp_size_t n, mp_bitcnt_t bit_size,
+               mp_ptr scratch)
+{
+  ASSERT (n > 0);
+  ASSERT (bit_size > 0);
+  ASSERT (mp[0] & 1);
+  ASSERT (! MPN_OVERLAP_P (ap, n, vp, n));
+#define bp (scratch + n)
+#define up (scratch + 2*n)
+#define m1hp (scratch + 3*n)
+
+  /* Maintain
+
+       a = u * orig_a (mod m)
+       b = v * orig_a (mod m)
+
+     and b odd at all times. Initially,
+
+       a = a_orig, u = 1
+       b = m,      v = 0
+     */
+
+
+  up[0] = 1;
+  mpn_zero (up+1, n - 1);
+  mpn_copyi (bp, mp, n);
+  mpn_zero (vp, n);
+
+  ASSERT_CARRY (mpn_rshift (m1hp, mp, n, 1));
+  ASSERT_NOCARRY (mpn_sec_add_1 (m1hp, m1hp, n, 1, scratch));
+
+  while (bit_size-- > 0)
+    {
+      mp_limb_t odd, swap, cy;
+
+      /* Always maintain b odd. The logic of the iteration is as
+        follows. For a, b:
+
+          odd = a & 1
+          a -= odd * b
+          if (underflow from a-b)
+            {
+              b += a, assigns old a
+              a = B^n-a
+            }
+
+          a /= 2
+
+        For u, v:
+
+          if (underflow from a - b)
+            swap u, v
+          u -= odd * v
+          if (underflow from u - v)
+            u += m
+
+          u /= 2
+          if (a one bit was shifted out)
+            u += (m+1)/2
+
+        As long as a > 0, the quantity
+
+          (bitsize of a) + (bitsize of b)
+
+        is reduced by at least one bit per iteration, hence after (bit_size of
+        orig_a) + (bit_size of m) - 1 iterations we surely have a = 0. Then b
+        = gcd(orig_a, m) and if b = 1 then also v = orig_a^{-1} (mod m).
+      */
+
+      ASSERT (bp[0] & 1);
+      odd = ap[0] & 1;
+
+      swap = mpn_cnd_sub_n (odd, ap, ap, bp, n);
+      mpn_cnd_add_n (swap, bp, bp, ap, n);
+      mpn_cnd_neg (swap, ap, ap, n, scratch);
+
+      mpn_cnd_swap (swap, up, vp, n);
+      cy = mpn_cnd_sub_n (odd, up, up, vp, n);
+      cy -= mpn_cnd_add_n (cy, up, up, mp, n);
+      ASSERT (cy == 0);
+
+      cy = mpn_rshift (ap, ap, n, 1);
+      ASSERT (cy == 0);
+      cy = mpn_rshift (up, up, n, 1);
+      cy = mpn_cnd_add_n (cy, up, up, m1hp, n);
+      ASSERT (cy == 0);
+    }
+  /* Should be all zeros, but check only extreme limbs */
+  ASSERT ( (ap[0] | ap[n-1]) == 0);
+  /* Check if indeed gcd == 1. */
+  return mpn_sec_eq_ui (bp, n, 1);
+#undef bp
+#undef up
+#undef m1hp
+}
diff --git a/mpn/generic/sec_mul.c b/mpn/generic/sec_mul.c
new file mode 100644 (file)
index 0000000..2cd87fa
--- /dev/null
@@ -0,0 +1,49 @@
+/* mpn_sec_mul.
+
+   Contributed to the GNU project by Torbjörn Granlund.
+
+Copyright 2013 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.h"
+#include "gmp-impl.h"
+
+void
+mpn_sec_mul (mp_ptr rp,
+            mp_srcptr ap, mp_size_t an,
+            mp_srcptr bp, mp_size_t bn,
+            mp_ptr tp)
+{
+  mpn_mul_basecase (rp, ap, an, bp, bn);
+}
+
+mp_size_t
+mpn_sec_mul_itch (mp_size_t an, mp_size_t bn)
+{
+  return 0;
+}
diff --git a/mpn/generic/sec_pi1_div.c b/mpn/generic/sec_pi1_div.c
new file mode 100644 (file)
index 0000000..1e075da
--- /dev/null
@@ -0,0 +1,173 @@
+/* mpn_sec_pi1_div_qr, mpn_sec_pi1_div_r -- Compute Q = floor(U / V), U = U
+   mod V.  Side-channel silent under the assumption that the used instructions
+   are side-channel silent.
+
+   Contributed to the GNU project by Torbjörn 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 2011-2013 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.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+/* This side-channel silent division algorithm reduces the partial remainder by
+   GMP_NUMB_BITS/2 bits at a time, compared to GMP_NUMB_BITS for the main
+   division algorithm.  We actually do not insist on reducing by exactly
+   GMP_NUMB_BITS/2, but may leave a partial remainder that is D*B^i to 3D*B^i
+   too large (B is the limb base, D is the divisor, and i is the induction
+   variable); the subsequent step will handle the extra partial remainder bits.
+
+   With that partial remainder reduction, each step generates a quotient "half
+   limb".  The outer loop generates two quotient half limbs, an upper (q1h) and
+   a lower (q0h) which are stored sparsely in separate limb arrays.  These
+   arrays are added at the end; using separate arrays avoids data-dependent
+   carry propagation which could else pose a side-channel leakage problem.
+
+   The quotient half limbs may be between -3 to 0 from the accurate value
+   ("accurate" being the one which corresponds to a reduction to a principal
+   partial remainder).  Too small quotient half limbs correspond to too large
+   remainders, which we reduce later, as described above.
+
+   In order to keep quotients from getting too big, corresponding to a negative
+   partial remainder, we use an inverse which is slightly smaller than usually.
+*/
+
+#if OPERATION_sec_pi1_div_qr
+/* Needs (dn + 1) + (nn - dn) + (nn - dn) = 2nn - dn + 1 limbs at tp. */
+#define FNAME mpn_sec_pi1_div_qr
+#define Q(q) q,
+#define RETTYPE mp_limb_t
+#endif
+#if OPERATION_sec_pi1_div_r
+/* Needs (dn + 1) limbs at tp.  */
+#define FNAME mpn_sec_pi1_div_r
+#define Q(q)
+#define RETTYPE void
+#endif
+
+RETTYPE
+FNAME (Q(mp_ptr qp)
+       mp_ptr np, mp_size_t nn,
+       mp_srcptr dp, mp_size_t dn,
+       mp_limb_t dinv,
+       mp_ptr tp)
+{
+  mp_limb_t nh, cy, q1h, q0h, dummy, cnd;
+  mp_size_t i;
+  mp_ptr hp;
+#if OPERATION_sec_pi1_div_qr
+  mp_limb_t qh;
+  mp_ptr qlp, qhp;
+#endif
+
+  ASSERT (dn >= 1);
+  ASSERT (nn >= dn);
+  ASSERT ((dp[dn - 1] & GMP_NUMB_HIGHBIT) != 0);
+
+  if (nn == dn)
+    {
+      cy = mpn_sub_n (np, np, dp, dn);
+      mpn_cnd_add_n (cy, np, np, dp, dn);
+#if OPERATION_sec_pi1_div_qr
+      return 1 - cy;
+#else
+      return;
+#endif
+    }
+
+  /* Create a divisor copy shifted half a limb.  */
+  hp = tp;                                     /* (dn + 1) limbs */
+  hp[dn] = mpn_lshift (hp, dp, dn, GMP_NUMB_BITS / 2);
+
+#if OPERATION_sec_pi1_div_qr
+  qlp = tp + (dn + 1);                         /* (nn - dn) limbs */
+  qhp = tp + (nn + 1);                         /* (nn - dn) limbs */
+#endif
+
+  np += nn - dn;
+  nh = 0;
+
+  for (i = nn - dn - 1; i >= 0; i--)
+    {
+      np--;
+
+      nh = (nh << GMP_NUMB_BITS/2) + (np[dn] >> GMP_NUMB_BITS/2);
+      umul_ppmm (q1h, dummy, nh, dinv);
+      q1h += nh;
+#if OPERATION_sec_pi1_div_qr
+      qhp[i] = q1h;
+#endif
+      mpn_submul_1 (np, hp, dn + 1, q1h);
+
+      nh = np[dn];
+      umul_ppmm (q0h, dummy, nh, dinv);
+      q0h += nh;
+#if OPERATION_sec_pi1_div_qr
+      qlp[i] = q0h;
+#endif
+      nh -= mpn_submul_1 (np, dp, dn, q0h);
+    }
+
+  /* 1st adjustment depends on extra high remainder limb.  */
+  cnd = nh != 0;                               /* FIXME: cmp-to-int */
+#if OPERATION_sec_pi1_div_qr
+  qlp[0] += cnd;
+#endif
+  nh -= mpn_cnd_sub_n (cnd, np, np, dp, dn);
+
+  /* 2nd adjustment depends on remainder/divisor comparison as well as whether
+     extra remainder limb was nullified by previous subtract.  */
+  cy = mpn_sub_n (np, np, dp, dn);
+  cy = cy - nh;
+#if OPERATION_sec_pi1_div_qr
+  qlp[0] += 1 - cy;
+#endif
+  mpn_cnd_add_n (cy, np, np, dp, dn);
+
+  /* 3rd adjustment depends on remainder/divisor comparison.  */
+  cy = mpn_sub_n (np, np, dp, dn);
+#if OPERATION_sec_pi1_div_qr
+  qlp[0] += 1 - cy;
+#endif
+  mpn_cnd_add_n (cy, np, np, dp, dn);
+
+#if OPERATION_sec_pi1_div_qr
+  /* Combine quotient halves into final quotient.  */
+  qh = mpn_lshift (qhp, qhp, nn - dn, GMP_NUMB_BITS/2);
+  qh += mpn_add_n (qp, qhp, qlp, nn - dn);
+
+  return qh;
+#else
+  return;
+#endif
+}
diff --git a/mpn/generic/sec_powm.c b/mpn/generic/sec_powm.c
new file mode 100644 (file)
index 0000000..67de44e
--- /dev/null
@@ -0,0 +1,438 @@
+/* mpn_sec_powm -- Compute R = U^E mod M.  Secure variant, side-channel silent
+   under the assumption that the multiply instruction is side channel silent.
+
+   Contributed to the GNU project by Torbjörn Granlund.
+
+Copyright 2007-2009, 2011, 2012, 2013 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/.  */
+
+
+/*
+  BASIC ALGORITHM, Compute U^E mod M, where M < B^n is odd.
+
+  1. T <- (B^n * U) mod M                Convert to REDC form
+
+  2. Compute table U^0, U^1, U^2... of E-dependent size
+
+  3. While there are more bits in E
+       W <- power left-to-right base-k
+
+
+  TODO:
+
+   * Make getbits a macro, thereby allowing it to update the index operand.
+     That will simplify the code using getbits.  (Perhaps make getbits' sibling
+     getbit then have similar form, for symmetry.)
+
+   * Choose window size without looping.  (Superoptimize or think(tm).)
+
+   * REDC_1_TO_REDC_2_THRESHOLD might actually represent the cutoff between
+     redc_1 and redc_n.  On such systems, we will switch to redc_2 causing
+     slowdown.
+*/
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+#undef MPN_REDC_1_SEC
+#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)
+
+#undef MPN_REDC_2_SEC
+#define MPN_REDC_2_SEC(rp, up, mp, n, mip)                             \
+  do {                                                                 \
+    mp_limb_t cy;                                                      \
+    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
+#endif
+
+/* Define our own mpn squaring function.  We do this since we cannot use a
+   native mpn_sqr_basecase over TUNE_SQR_TOOM2_MAX, or a non-native one over
+   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
+#endif
+
+#if HAVE_NATIVE_mpn_sqr_basecase
+#ifdef TUNE_SQR_TOOM2_MAX
+/* We slightly abuse TUNE_SQR_TOOM2_MAX here.  If it is set for an assembly
+   mpn_sqr_basecase, it comes from SQR_TOOM2_THRESHOLD_MAX in the assembly
+   file.  An assembly mpn_sqr_basecase that does not define it, should allow
+   any size.  */
+#define SQR_BASECASE_LIM  SQR_TOOM2_THRESHOLD
+#endif
+#endif
+
+#ifdef WANT_FAT_BINARY
+/* For fat builds, we use SQR_TOOM2_THRESHOLD which will expand to a read from
+   __gmpn_cpuvec.  Perhaps any possible sqr_basecase.asm allow any size, and we
+   limit the use unnecessarily.  We cannot tell, so play it safe.  FIXME.  */
+#define SQR_BASECASE_LIM  SQR_TOOM2_THRESHOLD
+#endif
+
+#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
+/* Define our own squaring function, which uses mpn_sqr_basecase for its
+   allowed sizes, but its own code for larger sizes.  */
+static void
+mpn_local_sqr (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_ptr tp)
+{
+  mp_size_t i;
+
+  ASSERT (n >= 1);
+  ASSERT (! MPN_OVERLAP_P (rp, 2*n, up, n));
+
+  if (BELOW_THRESHOLD (n, SQR_BASECASE_LIM))
+    {
+      mpn_sqr_basecase (rp, up, n);
+      return;
+    }
+
+  {
+    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)
+    {
+      mp_limb_t cy;
+
+      cy = mpn_mul_1 (tp, up + 1, n - 1, up[0]);
+      tp[n - 1] = cy;
+      for (i = 2; i < n; i++)
+       {
+         mp_limb_t cy;
+         cy = mpn_addmul_1 (tp + 2 * i - 2, up + i, n - i, up[i - 1]);
+         tp[n + i - 2] = cy;
+       }
+      MPN_SQR_DIAGONAL (rp + 2, up + 1, n - 1);
+
+      {
+       mp_limb_t cy;
+#if HAVE_NATIVE_mpn_addlsh1_n
+       cy = mpn_addlsh1_n (rp + 1, rp + 1, tp, 2 * n - 2);
+#else
+       cy = mpn_lshift (tp, tp, 2 * n - 2, 1);
+       cy += mpn_add_n (rp + 1, rp + 1, tp, 2 * n - 2);
+#endif
+       rp[2 * n - 1] += cy;
+      }
+    }
+}
+#endif
+
+#define getbit(p,bi) \
+  ((p[(bi - 1) / GMP_NUMB_BITS] >> (bi - 1) % GMP_NUMB_BITS) & 1)
+
+/* FIXME: Maybe some things would get simpler if all callers ensure
+   that bi >= nbits. As far as I understand, with the current code bi
+   < nbits can happen only for the final iteration. */
+static inline mp_limb_t
+getbits (const mp_limb_t *p, mp_bitcnt_t bi, int nbits)
+{
+  int nbits_in_r;
+  mp_limb_t r;
+  mp_size_t i;
+
+  if (bi < nbits)
+    {
+      return p[0] & (((mp_limb_t) 1 << bi) - 1);
+    }
+  else
+    {
+      bi -= nbits;                     /* bit index of low bit to extract */
+      i = bi / GMP_NUMB_BITS;          /* word index of low bit to extract */
+      bi %= GMP_NUMB_BITS;             /* bit index in low word */
+      r = p[i] >> bi;                  /* extract (low) bits */
+      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);
+    }
+}
+
+#ifndef POWM_SEC_TABLE
+#if GMP_NUMB_BITS < 50
+#define POWM_SEC_TABLE  2,33,96,780,2741
+#else
+#define POWM_SEC_TABLE  2,130,524,2578
+#endif
+#endif
+
+#if TUNE_PROGRAM_BUILD
+extern int win_size (mp_bitcnt_t);
+#else
+static inline int
+win_size (mp_bitcnt_t enb)
+{
+  int k;
+  /* Find k, such that x[k-1] < enb <= x[k].
+
+     We require that x[k] >= k, then it follows that enb > x[k-1] >=
+     k-1, which implies k <= enb.
+  */
+  static const mp_bitcnt_t x[] = {0,POWM_SEC_TABLE,~(mp_bitcnt_t)0};
+  for (k = 1; enb > x[k]; k++)
+    ;
+  ASSERT (k <= enb);
+  return k;
+}
+#endif
+
+/* Convert U to REDC form, U_r = B^n * U mod M.
+   Uses scratch space at tp of size 2un + n + 1.  */
+static void
+redcify (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr mp, mp_size_t n, mp_ptr tp)
+{
+  MPN_ZERO (tp, n);
+  MPN_COPY (tp + n, up, un);
+
+  mpn_sec_div_r (tp, un + n, mp, n, tp + un + n);
+  MPN_COPY (rp, tp, n);
+}
+
+/* {rp, n} <-- {bp, bn} ^ {ep, en} mod {mp, n},
+   where en = ceil (enb / GMP_NUMB_BITS)
+   Requires that {mp, n} is odd (and hence also mp[0] odd).
+   Uses scratch space at tp as defined by mpn_sec_powm_itch.  */
+void
+mpn_sec_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
+             mp_srcptr ep, mp_bitcnt_t enb,
+             mp_srcptr mp, mp_size_t n, mp_ptr tp)
+{
+  mp_limb_t ip[2], *mip;
+  int windowsize, this_windowsize;
+  mp_limb_t expbits;
+  mp_ptr pp, this_pp;
+  long i;
+  int cnd;
+
+  ASSERT (enb > 0);
+  ASSERT (n > 0);
+  /* The code works for bn = 0, but the defined scratch space is 2 limbs
+     greater than we supply, when converting 1 to redc form .  */
+  ASSERT (bn > 0);
+  ASSERT ((mp[0] & 1) != 0);
+
+  windowsize = win_size (enb);
+
+#if WANT_REDC_2
+  if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
+    {
+      mip = ip;
+      binvert_limb (mip[0], mp[0]);
+      mip[0] = -mip[0];
+    }
+  else
+    {
+      mip = ip;
+      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 */
+
+  /* Compute pp[0] table entry */
+  /* scratch: |   n   | 1 |   n+2    |  */
+  /*          | pp[0] | 1 | redcify  |  */
+  this_pp = pp;
+  this_pp[n] = 1;
+  redcify (this_pp, this_pp + n, 1, mp, n, this_pp + n + 1);
+  this_pp += n;
+
+  /* Compute pp[1] table entry.  To avoid excessive scratch usage in the
+     degenerate situation where B >> M, we let redcify use scratch space which
+     will later be used by the pp table (element 2 and up).  */
+  /* scratch: |   n   |   n   |  bn + n + 1  |  */
+  /*          | pp[0] | pp[1] |   redcify    |  */
+  redcify (this_pp, bp, bn, mp, n, this_pp + n);
+
+  /* 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--)
+    {
+      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
+    }
+
+  expbits = getbits (ep, enb, windowsize);
+  ASSERT_ALWAYS (enb >= windowsize);
+  enb -= windowsize;
+
+  mpn_sec_tabselect (rp, pp, n, 1 << windowsize, expbits);
+
+  /* Main exponentiation loop.  */
+  /* scratch: |   n   |   n   | ...  |                    |     3n-4n     |  */
+  /*          | pp[0] | pp[1] | ...  | pp[2^windowsize-1] |  loop scratch |  */
+
+#define INNERLOOP                                                      \
+  while (enb != 0)                                                     \
+    {                                                                  \
+      expbits = getbits (ep, enb, windowsize);                         \
+      this_windowsize = windowsize;                                    \
+      if (enb < windowsize)                                            \
+       {                                                               \
+         this_windowsize -= windowsize - enb;                          \
+         enb = 0;                                                      \
+       }                                                               \
+      else                                                             \
+       enb -= windowsize;                                              \
+                                                                       \
+      do                                                               \
+       {                                                               \
+         mpn_local_sqr (tp, rp, n, tp + 2 * n);                        \
+         MPN_REDUCE (rp, tp, mp, n, mip);                              \
+         this_windowsize--;                                            \
+       }                                                               \
+      while (this_windowsize != 0);                                    \
+                                                                       \
+      mpn_sec_tabselect (tp + 2*n, pp, n, 1 << windowsize, expbits);   \
+      mpn_mul_basecase (tp, rp, n, tp + 2*n, n);                       \
+                                                                       \
+      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);
+}
+
+mp_size_t
+mpn_sec_powm_itch (mp_size_t bn, mp_bitcnt_t enb, mp_size_t n)
+{
+  int windowsize;
+  mp_size_t redcify_itch, itch;
+
+  /* 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
+     mpn_sqr_basecase.  We assume 4n always for now.) */
+
+  windowsize = win_size (enb);
+
+  /* The 2n term is due to pp[0] and pp[1] at the time of the 2nd redcify call,
+     the (bn + n) term is due to redcify's own usage, and the rest is due to
+     mpn_sec_div_r's usage when called from redcify.  */
+  redcify_itch = (2 * n) + (bn + n) + ((bn + n) + 2 * n + 2);
+
+  /* The n * 2^windowsize term is due to the power table, the 4n term is due to
+     scratch needs of squaring/multiplication in the exponentiation loop.  */
+  itch = (n << windowsize) + (4 * n);
+
+  return MAX (itch, redcify_itch);
+}
diff --git a/mpn/generic/sec_sqr.c b/mpn/generic/sec_sqr.c
new file mode 100644 (file)
index 0000000..736924c
--- /dev/null
@@ -0,0 +1,48 @@
+/* mpn_sec_sqr.
+
+   Contributed to the GNU project by Torbjörn Granlund.
+
+Copyright 2013 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.h"
+#include "gmp-impl.h"
+
+void
+mpn_sec_sqr (mp_ptr rp,
+            mp_srcptr ap, mp_size_t an,
+            mp_ptr tp)
+{
+  mpn_sqr_basecase (rp, ap, an);
+}
+
+mp_size_t
+mpn_sec_sqr_itch (mp_size_t an)
+{
+  return 0;
+}
diff --git a/mpn/generic/sec_tabselect.c b/mpn/generic/sec_tabselect.c
new file mode 100644 (file)
index 0000000..a79c73a
--- /dev/null
@@ -0,0 +1,55 @@
+/* mpn_sec_tabselect.
+
+Copyright 2007-2009, 2011, 2013 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.h"
+#include "gmp-impl.h"
+
+
+/* Select entry `which' from table `tab', which has nents entries, each `n'
+   limbs.  Store the selected entry at rp.  Reads entire table to avoid
+   side-channel information leaks.  O(n*nents).  */
+void
+mpn_sec_tabselect (volatile mp_limb_t *rp, volatile const mp_limb_t *tab,
+                  mp_size_t n, mp_size_t nents, mp_size_t which)
+{
+  mp_size_t k, i;
+  mp_limb_t mask;
+  volatile mp_limb_t *tp;
+
+  for (k = 0; k < nents; k++)
+    {
+      mask = -(mp_limb_t) (which == k);
+      tp = tab + n * k;
+      for (i = 0; i < n; i++)
+       {
+         rp[i] = (rp[i] & ~mask) | (tp[i] & mask);
+       }
+    }
+}
index fd3c5957ce1e59d0f638e423679d0599ff2190e9..71034e34bf980c0a12df95615f9f845bdd01beef 100644 (file)
@@ -9,23 +9,34 @@
    FACT, IT IS ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE
    GNU MP RELEASE.
 
-Copyright 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002, 2004, 2006, 2007,
-2008, 2012, 2013 Free Software Foundation, Inc.
+Copyright 1991-1994, 1996, 2000-2002, 2004, 2006-2008, 2012, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /* TODO:
index 27bb19c6ad5a54f047a51d4c4c2edcc74f56be9e..16633569ec2c2835b0996d8f88f5108ade365b50 100644 (file)
@@ -4,23 +4,34 @@
    CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
    FUTURE GNU MP RELEASES.
 
-Copyright 1991, 1993, 1994, 1995, 2001, 2002, 2011, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993-1995, 2001, 2002, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 504dbfb2d6ec083fdcb9ef321347f976639164a6..3743761f784ce1d32b7eab7be78e7821e318cb32 100644 (file)
@@ -1,22 +1,33 @@
 /* mpn_sqr -- square natural numbers.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-2005, 2008, 2009 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996-2003, 2005, 2008, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 660ab4c77a8a49210f99005bea4f9a8a0e44e14c..fc6a043a94669ce5b40bb489c3be0c0bd847119f 100644 (file)
@@ -5,23 +5,34 @@
    SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
 
 
-Copyright 1991, 1992, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2003, 2004,
-2005, 2008, 2010, 2011 Free Software Foundation, Inc.
+Copyright 1991-1994, 1996, 1997, 2000-2005, 2008, 2010, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 824cb1108910e1b67f8810c3e8f1170ff24f439b..fd0868b90b70704dc2a4acccc3523a1824cb5f71 100644 (file)
@@ -1,6 +1,6 @@
 /* sqrmod_bnm1.c -- squaring mod B^n-1.
 
-   Contributed to the GNU project by Niels Möller, Torbjorn Granlund and
+   Contributed to the GNU project by Niels Möller, Torbjorn Granlund and
    Marco Bodrato.
 
    THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES.  IT IS ONLY
@@ -12,17 +12,28 @@ Copyright 2009, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
@@ -221,7 +232,7 @@ mpn_sqrmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an, mp_ptr tp)
         the rsh1add was a simple rshift: the top bit is 0. cy=1 => hi=0. */
 #endif
 #if GMP_NAIL_BITS == 0
-      add_ssaaaa(cy, rp[n-1], cy, rp[n-1], 0, hi);
+      add_ssaaaa(cy, rp[n-1], cy, rp[n-1], CNST_LIMB(0), hi);
 #else
       cy += (hi & rp[n-1]) >> (GMP_NUMB_BITS-1);
       rp[n-1] ^= hi;
index 57041c9058bc61361713e9b421901b8f9c6c74da..7d0f1200017f6df3893f3d673d8efa901cab27b6 100644 (file)
@@ -8,23 +8,34 @@
    INTERFACES.  IN FACT, IT IS ALMOST GUARANTEED THAT THEY WILL CHANGE OR
    DISAPPEAR IN A FUTURE GMP RELEASE.
 
-Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2008, 2010, 2012 Free Software
-Foundation, Inc.
+Copyright 1999-2002, 2004, 2005, 2008, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /* See "Karatsuba Square Root", reference in gmp.texi.  */
index ada3e91b838bac5c87a8fe3444332928d19d87a1..3fbcbbe98b4f3f14b96d815bf32418df68990c87 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpn_sub 1
 
index 4ed2eabccbed5b0e8c57cf6e2534e2aad9ae79a7..db2e6f948f5d0761dc34281cacfa4fc7f1ff61d7 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpn_sub_1 1
 
index ea901bf611a980444d9e2e3f742369ff804c03cc..340313a323a4dfe14b2ca5b1b79727ab073f4968 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 34c6198546f9666a7c9140672018e51beca92e15..63ea2451b491aee9e48de696f213603679e9e880 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 72371ec3a8f7efcdf23a430d1ed24c45766268d2..a80e05d0d96ea3cfb305966cc6d70beeb2438b45 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 3c2ed57f90ddfcbc6ea60051b29e0fd1da9190ae..29de2d2d89128d1093cc9e73c51737b908ac7b74 100644 (file)
@@ -1,22 +1,32 @@
 /* mpn_sub_n -- Subtract equal length limb vectors.
 
-Copyright 1992, 1993, 1994, 1996, 2000, 2002, 2009 Free Software Foundation,
-Inc.
+Copyright 1992-1994, 1996, 2000, 2002, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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/mpn/generic/subcnd_n.c b/mpn/generic/subcnd_n.c
deleted file mode 100644 (file)
index 89b7190..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/* mpn_subcnd_n -- Compute R = U - V if CND != 0 or R = U if CND == 0.
-   Both cases should take the same time and perform the exact same memory
-   accesses, since this function is intended to be used where side-channel
-   attack resilience is relevant.
-
-   THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE.  IT IS ONLY
-   SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
-
-Copyright 1992, 1993, 1994, 1996, 2000, 2002, 2008, 2009, 2011 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 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.
-
-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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-
-mp_limb_t
-mpn_subcnd_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t cnd)
-{
-  mp_limb_t ul, vl, sl, rl, cy, cy1, cy2, mask;
-
-  ASSERT (n >= 1);
-  ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
-  ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
-
-  mask = -(mp_limb_t) (cnd != 0);
-  cy = 0;
-  do
-    {
-      ul = *up++;
-      vl = *vp++ & mask;
-#if GMP_NAIL_BITS == 0
-      sl = ul - vl;
-      cy1 = sl > ul;
-      rl = sl - cy;
-      cy2 = rl > sl;
-      cy = cy1 | cy2;
-      *rp++ = rl;
-#else
-      rl = ul - vl;
-      rl -= cy;
-      cy = rl >> (GMP_LIMB_BITS - 1);
-      *rp++ = rl & GMP_NUMB_MASK;
-#endif
-    }
-  while (--n != 0);
-
-  return cy;
-}
index 3e8e74302d56ce467825a2f8b1bb2e208c222d6d..fbc3501389d0ae92aeaa4d2c0d3c266890f034d8 100644 (file)
@@ -3,23 +3,33 @@
    vector pointed to by RP.  Return the most significant limb of the
    product, adjusted for carry-out from the subtraction.
 
-Copyright 1992, 1993, 1994, 1996, 2000, 2002, 2004 Free Software Foundation,
-Inc.
+Copyright 1992-1994, 1996, 2000, 2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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/mpn/generic/tabselect.c b/mpn/generic/tabselect.c
deleted file mode 100644 (file)
index 02e52fd..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/* mpn_tabselect.
-
-   THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE.  IT IS ONLY
-   SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
-
-Copyright 2007, 2008, 2009, 2011 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 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.
-
-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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-
-
-/* Select entry `which' from table `tab', which has nents entries, each `n'
-   limbs.  Store the selected entry at rp.  Reads entire table to avoid
-   side-channel information leaks.  O(n*nents).
-   FIXME: Move to its own file.  */
-void
-mpn_tabselect (volatile mp_limb_t *rp, volatile mp_limb_t *tab, mp_size_t n,
-              mp_size_t nents, mp_size_t which)
-{
-  mp_size_t k, i;
-  mp_limb_t mask;
-  volatile mp_limb_t *tp;
-
-  for (k = 0; k < nents; k++)
-    {
-      mask = -(mp_limb_t) (which == k);
-      tp = tab + n * k;
-      for (i = 0; i < n; i++)
-       {
-         rp[i] = (rp[i] & ~mask) | (tp[i] & mask);
-       }
-    }
-}
index 62d28a0a7e9babeed0b06e53da9241355c6b4f86..be213b04673fd51e37b8b02c0e550cea9f4a50b3 100644 (file)
    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, 2001, 2002, 2005, 2009 Free Software Foundation, Inc.
+Copyright 1997, 2000-2002, 2005, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 36328d7d01a9559710d8a6ac06e34396e1f01194..36ac29b72d4b20ba98a38151561dc4590f5af61c 100644 (file)
@@ -7,22 +7,33 @@
    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, 2008, 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 2006-2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 60ec5e4fba4d92b405fe6f3283ba9afcd283dd61..2f2fdaee6f275a168b2269f70e4e3673541c7515 100644 (file)
@@ -6,22 +6,33 @@
    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, 2008, 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 2006-2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 77a4ca44b91c39f4ef2efc31f18b676d6cc4300c..0b05669cc4e00a35291c9fd83ad2999b5a3fba8f 100644 (file)
@@ -2,7 +2,7 @@
    times as large as bn.  Or more accurately, bn < an < 3bn.
 
    Contributed to the GNU project by Torbjorn Granlund.
-   Improvements by Marco Bodrato and Niels Möller.
+   Improvements by Marco Bodrato and Niels Möller.
 
    The idea of applying toom to unbalanced multiplication is due to Marco
    Bodrato and Alberto Zanoni.
    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, 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2006-2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 8efa57d8ea2f220101dc98af10db4367e90804d7..655355c39a35267e473b83326d7e709c9122b763 100644 (file)
@@ -8,22 +8,33 @@
    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, 2008, 2010, 2012 Free Software Foundation, Inc.
+Copyright 2006-2008, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
@@ -31,11 +42,11 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 /* Evaluate in: -1, 0, +1, +2, +inf
 
-  <-s--><--n--><--n--><--n-->
-   ____ ______ ______ ______
-  |_a3_|___a2_|___a1_|___a0_|
-   |b3_|___b2_|___b1_|___b0_|
-   <-t-><--n--><--n--><--n-->
+  <-s--><--n--><--n-->
+   ____ ______ ______
+  |_a2_|___a1_|___a0_|
+   |b2_|___b1_|___b0_|
+   <-t-><--n--><--n-->
 
   v0  =  a0         * b0          #   A(0)*B(0)
   v1  = (a0+ a1+ a2)*(b0+ b1+ b2) #   A(1)*B(1)      ah  <= 2  bh <= 2
index 3d21851728551de1e4e1eee804c2e99f7d464817..6117c67ca6809ed22c6ab134501d1852b942d61d 100644 (file)
@@ -7,22 +7,33 @@
    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, 2008, 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 2006-2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 138984ee9e781dfd280fd5355eb2adaa785c25d3..9b1e7d491bf326e34062edd8f71374d5a0e769f2 100644 (file)
    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, 2008, 2012 Free Software Foundation, Inc.
+Copyright 2006-2008, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index c77b00f95d42c624d232b328147fbe4e17a69acb..0251a6d7ed33e330d805fb60b824b2fedb074cff 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
@@ -219,7 +230,7 @@ mpn_toom42_mulmid (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n,
       /* FIXME: should probably define an interface "mpn_mulmid_diag_1"
          that can handle the sum below. Currently we're relying on
          mulmid_basecase being pretty fast for a diagonal sum like this,
-        which is true at least for the K8 asm verion, but surely false
+        which is true at least for the K8 asm version, but surely false
         for the generic version. */
       mpn_mulmid_basecase (e, ap + n - 1, n - 1, bp, n - 1);
       mpn_add_n (rp + n - 1, rp + n - 1, e, 3);
index 6723e29965c5e7fca0849569626fba92059fef55..59d45576b8b7bd118f603b09d082dbc3542a6538 100644 (file)
@@ -15,17 +15,28 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index c77e3592cb90ff65ddf84376942332ca34edf08c..5abf2d14a99d17542340f101fce19ca0eb588564 100644 (file)
@@ -7,22 +7,33 @@
    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, 2008, 2013 Free Software Foundation, Inc.
+Copyright 2006-2008, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index a97202d48577dabf7e561de51ff235f1751adfd9..b4154ba83fbe2afb12430e07600c6d91ea7943d4 100644 (file)
@@ -6,22 +6,33 @@
    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, 2008, 2009, 2010, 2013 Free Software Foundation, Inc.
+Copyright 2006-2010, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 24c4fdd88f32cac48de0f742c14fe2294253e3b6..e15b5833aa05bc37cef522a29d8025c4803172b8 100644 (file)
@@ -15,17 +15,28 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index d0a9ab439062681a9aafdb81ac8d37d4ab165ae8..41274d48e01af884dae472d817c44b058802e4f3 100644 (file)
    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, 2008, 2012 Free Software Foundation, Inc.
+Copyright 2006-2008, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index afda6c2763064d3e478c6d16ab048ceb65b1afd2..939bb53ab68682f1da63e4526446425fc98789ff 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2009, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index bf55c9211ca53397260b97ecbcf5d94f13a5a80f..3759e3cb3ca52d349bc0df0519fa8a2796bf001d 100644 (file)
    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, 2008, 2012 Free Software Foundation, Inc.
+Copyright 2006-2008, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 9c21457e9b089d2f8b28209f32840203eb5720c1..57c5d3e3dd8a885bcbbae3e6b1826cb479c81a5d 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2009, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 9fd3a56d6a9fcbfb70808b8030b101a107bd5c9a..e5ab7dcd1d2f84fbffd40e9d7b163f8457708d08 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 7090e41d8518b42b9189d3ca1fd508e6c784ce7b..420895be8f9c2c59a3a51b41da88c2b85c303e13 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2009, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index d2208aa2c4b990f948f27f2805fe6cd58c333576..0c93678815946275f5edcdf3eabeee373a50d4ab 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2009, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 2d8bddc773fdb54ea521e6d719fb2e19e6f2800f..8f593903f59e79dc809a9429e01bea422252a3c2 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2009, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index c347297504588acecced41fdd750c81f90335cbf..9e62bcba1c9605ac2fe12cc97d5afd8864070ba8 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2009, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 67395068d6c3cc6c77a84f75726d2b1da9085c85..50411bd3ca6756b65f12cbe54568e2a1e79c9f9d 100644 (file)
@@ -1,6 +1,6 @@
 /* mpn_toom_eval_dgr3_pm1 -- Evaluate a degree 3 polynomial in +1 and -1
 
-   Contributed to the GNU project by Niels Möller
+   Contributed to the GNU project by Niels Möller
 
    THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE.  IT IS ONLY
    SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES.  IN FACT, IT IS ALMOST
@@ -11,17 +11,28 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 0148600c962824f97dd37d678aa1f008547b46be..3ba6d15f3ddccc74b22d97141ccb9ef76a4d840f 100644 (file)
@@ -1,6 +1,6 @@
 /* mpn_toom_eval_dgr3_pm2 -- Evaluate a degree 3 polynomial in +2 and -2
 
-   Contributed to the GNU project by Niels Möller
+   Contributed to the GNU project by Niels Möller
 
    THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE.  IT IS ONLY
    SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES.  IN FACT, IT IS ALMOST
@@ -11,17 +11,28 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 1c63efda585a32dc1981d38009b2a0069b376b91..2334b0aff4a42b127e1236907bd125dbe292b7ac 100644 (file)
@@ -1,6 +1,6 @@
 /* mpn_toom_eval_pm1 -- Evaluate a polynomial in +1 and -1
 
-   Contributed to the GNU project by Niels Möller
+   Contributed to the GNU project by Niels Möller
 
    THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE.  IT IS ONLY
    SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES.  IN FACT, IT IS ALMOST
@@ -11,17 +11,28 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 7f410d56e1668f2c82ee1b6c0bcfefbecfb7624b..67afcc638efb9ed25211026c603f8cd1d929bf62 100644 (file)
@@ -1,6 +1,6 @@
 /* mpn_toom_eval_pm2 -- Evaluate a polynomial in +2 and -2
 
-   Contributed to the GNU project by Niels Möller and Marco Bodrato
+   Contributed to the GNU project by Niels Möller and Marco Bodrato
 
    THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE.  IT IS ONLY
    SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES.  IN FACT, IT IS ALMOST
@@ -11,17 +11,28 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 26c1edb03a3bbcd3cd2c770bde8f59eecd113b44..b178fcac244212726e9f239e6915bfce4d987365 100644 (file)
@@ -1,6 +1,6 @@
 /* mpn_toom_eval_pm2exp -- Evaluate a polynomial in +2^k and -2^k
 
-   Contributed to the GNU project by Niels Möller
+   Contributed to the GNU project by Niels Möller
 
    THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE.  IT IS ONLY
    SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES.  IN FACT, IT IS ALMOST
@@ -11,17 +11,28 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index ecbe9a7cf6474f397d3e4ebbb71cde79a31674a5..3cac46bd905a9fb0b060a1ddecec79a399c95a7f 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index e4a765bed6d2db55bfd39a8b22f66c6665730a0f..180b0329a36c2998e61cba07bcc8e12f557f4ff8 100644 (file)
@@ -1,4 +1,4 @@
-/* Interpolaton for the algorithm Toom-Cook 6.5-way.
+/* Interpolation for the algorithm Toom-Cook 6.5-way.
 
    Contributed to the GNU project by Marco Bodrato.
 
@@ -11,17 +11,28 @@ Copyright 2009, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 445479cd4d321cd6bffba4ea06d70e34ff67cedb..5afe6641f67365ebd076cd9fd1bf57ed73ae72e5 100644 (file)
@@ -1,4 +1,4 @@
-/* Interpolaton for the algorithm Toom-Cook 8.5-way.
+/* Interpolation for the algorithm Toom-Cook 8.5-way.
 
    Contributed to the GNU project by Marco Bodrato.
 
@@ -11,17 +11,28 @@ Copyright 2009, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 8416b641c6479a385948bf1efb0ca5225a51572c..9fa5f0b7a6044c67f7f5eba0ee6ae32f4aeac283 100644 (file)
@@ -7,23 +7,33 @@
    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 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009 Free Software
-Foundation, Inc.
+Copyright 2000-2003, 2005-2007, 2009 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 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.
+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 Lesser General Public License
+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 a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -141,7 +151,7 @@ mpn_toom_interpolate_5pts (mp_ptr c, mp_ptr v2, mp_ptr vm1,
       1 0 1 0 0; v1
       0 1 0 1 0; vm1
       0 0 0 0 1] v0
-     Some vaues already are in-place (we added vm1 in the correct position)
+     Some values already are in-place (we added vm1 in the correct position)
      | vinf|  v1 |  v0 |
              | vm1 |
      One still is in a separated area
index 542fb2a610fa39afdab0bb9c079a3d73edb76df7..bdb2e95b8920880e0efc46c1aaa850d92cbe8a40 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2009, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 95a21940efd098f620cb1212efa30b330926732c..2a67dba82f3cfedaf7c06bba7273268764b63e38 100644 (file)
@@ -1,6 +1,6 @@
 /* mpn_toom_interpolate_7pts -- Interpolate for toom44, 53, 62.
 
-   Contributed to the GNU project by Niels Möller.
+   Contributed to the GNU project by Niels Möller.
    Improvements by Marco Bodrato.
 
    THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE.  IT IS ONLY
@@ -12,17 +12,28 @@ Copyright 2006, 2007, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -33,7 +44,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
   ((((GMP_NUMB_MAX / 9) << (6 - GMP_NUMB_BITS % 6)) * 8 & GMP_NUMB_MAX) | 0x39)
 
 #define BINVERT_15 \
-  ((((GMP_NUMB_MAX >> (GMP_NUMB_BITS % 4)) / 15) * 14 * 16 & GMP_NUMB_MAX) + 15))
+  ((((GMP_NUMB_MAX >> (GMP_NUMB_BITS % 4)) / 15) * 14 * 16 & GMP_NUMB_MAX) + 15)
 
 /* For the various mpn_divexact_byN here, fall back to using either
    mpn_pi1_bdiv_q_1 or mpn_divexact_1.  The former has less overhead and is
index 8e9825a6e1800cb88788082f7d7261be31cca22e..9e8808334ebd0c1e5bc6f6151bd2758c8956989d 100644 (file)
@@ -11,17 +11,28 @@ Copyright 2009, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index e61bc69fd53c1e44553049ec4b9e811936130d6a..cad159c3a0923632501f8305e74c464cd40c3b35 100644 (file)
@@ -6,22 +6,33 @@
    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, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /*
    This function finds the first (smallest) factor represented in
@@ -58,9 +69,23 @@ struct gmp_primes_ptab {
   unsigned int np :8;  /* number of primes related to this entry */
 };
 
+
+static const struct gmp_primes_dtab gmp_primes_dtab[] =
+{
+#define WANT_dtab
 #define P(p,inv,lim) {inv,lim}
+#include "trialdivtab.h"
+#undef WANT_dtab
+#undef P
+  {0,0}
+};
 
+static const struct gmp_primes_ptab gmp_primes_ptab[] =
+{
+#define WANT_ptab
 #include "trialdivtab.h"
+#undef WANT_ptab
+};
 
 #define PTAB_LINES (sizeof (gmp_primes_ptab) / sizeof (gmp_primes_ptab[0]))
 
@@ -70,8 +95,8 @@ mp_limb_t
 mpn_trialdiv (mp_srcptr tp, mp_size_t tn, mp_size_t nprimes, int *where)
 {
   mp_limb_t ppp;
-  mp_limb_t *cps;
-  struct gmp_primes_dtab *dp;
+  const mp_limb_t *cps;
+  const struct gmp_primes_dtab *dp;
   long i, j, idx, np;
   mp_limb_t r, q;
 
index f1353c6bdd69dcd126aa4229bc7f894c66da2137..7136429f0f8b67699240c5235e7bd51898502ddc 100644 (file)
@@ -14,17 +14,28 @@ Copyright 1992, 1994, 1996, 2000, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 4f12b00c2c5a2154fef15287070dd3cbbe51c912..e6e7fd3101e74a1a45a43ecc0d1916035579acf4 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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/mpn/i960/README b/mpn/i960/README
deleted file mode 100644 (file)
index d68a0a8..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-This directory contains mpn functions for Intel i960 processors.
-
-RELEVANT OPTIMIZATION ISSUES
-
-The code in this directory is not well optimized.
-
-STATUS
-
-The code in this directory has not been tested.
diff --git a/mpn/i960/add_n.s b/mpn/i960/add_n.s
deleted file mode 100644 (file)
index 24abc6b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# I960 __gmpn_add_n -- Add two limb vectors of the same length > 0 and store
-# sum in a third limb vector.
-
-# Copyright 1995, 2000 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 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.
-
-# 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 Lesser General Public
-# License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-.text
-       .align 4
-       .globl ___gmpn_add_n
-___gmpn_add_n:
-       mov     0,g6            # clear carry-save register
-       cmpo    1,0             # clear cy
-
-Loop:  subo    1,g3,g3         # update loop counter
-       ld      (g1),g5         # load from s1_ptr
-       addo    4,g1,g1         # s1_ptr++
-       ld      (g2),g4         # load from s2_ptr
-       addo    4,g2,g2         # s2_ptr++
-       cmpo    g6,1            # restore cy from g6, relies on cy being 0
-       addc    g4,g5,g4        # main add
-       subc    0,0,g6          # save cy in g6
-       st      g4,(g0)         # store result to res_ptr
-       addo    4,g0,g0         # res_ptr++
-       cmpobne 0,g3,Loop       # when branch is taken, clears C bit
-
-       mov     g6,g0
-       ret
diff --git a/mpn/i960/addmul_1.s b/mpn/i960/addmul_1.s
deleted file mode 100644 (file)
index 984f540..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# I960 __gmpn_addmul_1 -- Multiply a limb vector with a limb and add
-# the result to a second limb vector.
-
-# Copyright 1995, 2000 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 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.
-
-# 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 Lesser General Public
-# License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-.text
-       .align  4
-       .globl  ___gmpn_mul_1
-___gmpn_mul_1:
-       subo    g2,0,g2
-       shlo    2,g2,g4
-       subo    g4,g1,g1
-       subo    g4,g0,g13
-       mov     0,g0
-
-       cmpo    1,0             # clear C bit on AC.cc
-
-Loop:  ld      (g1)[g2*4],g5
-       emul    g3,g5,g6
-       ld      (g13)[g2*4],g5
-
-       addc    g0,g6,g6        # relies on that C bit is clear
-       addc    0,g7,g7
-       addc    g5,g6,g6        # relies on that C bit is clear
-       st      g6,(g13)[g2*4]
-       addc    0,g7,g0
-
-       addo    g2,1,g2
-       cmpobne 0,g2,Loop       # when branch is taken, clears C bit
-
-       ret
diff --git a/mpn/i960/mul_1.s b/mpn/i960/mul_1.s
deleted file mode 100644 (file)
index 7912aa1..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-# I960 __gmpn_mul_1 -- Multiply a limb vector with a limb and store
-# the result in a second limb vector.
-
-# Copyright 1995, 2000 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 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.
-
-# 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 Lesser General Public
-# License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-.text
-       .align  4
-       .globl  ___gmpn_mul_1
-___gmpn_mul_1:
-       subo    g2,0,g2
-       shlo    2,g2,g4
-       subo    g4,g1,g1
-       subo    g4,g0,g13
-       mov     0,g0
-
-       cmpo    1,0             # clear C bit on AC.cc
-
-Loop:  ld      (g1)[g2*4],g5
-       emul    g3,g5,g6
-
-       addc    g0,g6,g6        # relies on that C bit is clear
-       st      g6,(g13)[g2*4]
-       addc    0,g7,g0
-
-       addo    g2,1,g2
-       cmpobne 0,g2,Loop       # when branch is taken, clears C bit
-
-       ret
diff --git a/mpn/i960/sub_n.s b/mpn/i960/sub_n.s
deleted file mode 100644 (file)
index 87adcbf..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# I960 __gmpn_sub_n -- Subtract two limb vectors of the same length > 0 and
-# store difference in a third limb vector.
-
-# Copyright 1995, 2000 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 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.
-
-# 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 Lesser General Public
-# License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-.text
-       .align 4
-       .globl ___gmpn_sub_n
-___gmpn_sub_n:
-       mov     1,g6            # set carry-save register
-       cmpo    1,0             # clear cy
-
-Loop:  subo    1,g3,g3         # update loop counter
-       ld      (g1),g5         # load from s1_ptr
-       addo    4,g1,g1         # s1_ptr++
-       ld      (g2),g4         # load from s2_ptr
-       addo    4,g2,g2         # s2_ptr++
-       cmpo    g6,1            # restore cy from g6, relies on cy being 0
-       subc    g4,g5,g4        # main subtract
-       subc    0,0,g6          # save cy in g6
-       st      g4,(g0)         # store result to res_ptr
-       addo    4,g0,g0         # res_ptr++
-       cmpobne 0,g3,Loop       # when branch is taken, cy will be 0
-
-       mov     g6,g0
-       ret
index 631a58d411e8ad1638a9811fdf7e7939f94b9248..45c2d6337fe40d6e4159956d16e8128b0633e375 100644 (file)
@@ -1,19 +1,30 @@
-Copyright 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+Copyright 2000-2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
@@ -155,7 +166,7 @@ ldfp8 with all alignment headache that implies.
 ================================================================
 mpn_addmul_N
 
-For best speed, we need to give up using mpn_addmul_1 as the main multiply
+For best speed, we need to give up using mpn_addmul_2 as the main multiply
 building block, and instead take multiple v limbs per loop.  For the Itanium
 1, we need to take about 8 limbs at a time for full speed.  For the Itanium
 2, something like mpn_addmul_4 should be enough.
index 58dd45d57514da5f758f7ccae1a05a0130837627..34a506568f59b6ee5740d0d118569ce367351dff 100644 (file)
@@ -5,19 +5,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -53,6 +64,7 @@ PROLOGUE(mpn_add_n_sub_n)
 ifdef(`HAVE_ABI_32',`
        addp4   sp = 0, sp              C                               M I
        addp4   dp = 0, dp              C                               M I
+       nop.i   0
        addp4   up = 0, up              C                               M I
        addp4   vp = 0, vp              C                               M I
        zxt4    n = n                   C                               I
index 27c229de888b61805b3e75f93b267c4765f794aa..ffa3297763cdc374d61d99ea11018e2925bd5834 100644 (file)
@@ -3,23 +3,33 @@ dnl  result to a second limb vector.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2000-2005, 2007 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 5d06fa0da3d0291814c288809628e03bb4096a52..f5bc46b75df4e37250c8413ddaba6e4c958cd7b0 100644 (file)
@@ -6,19 +6,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund.
 dnl  Copyright 2004, 2005, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d75fef89a3caa370b3e5534cee61f6d4a70ff19c..81be606190328f4b4e20a48dd29d0d9e447ec0e8 100644 (file)
@@ -2,22 +2,33 @@ dnl  IA-64 mpn_add_n/mpn_sub_n -- mpn addition and subtraction.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2003, 2004, 2005, 2010, 2011 Free Software Foundation, Inc.
+dnl  Copyright 2003-2005, 2010, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -30,7 +41,7 @@ C  * Consider using special code for small n, using something like
 C    "switch (8 * (n >= 8) + (n mod 8))" to enter it and feed-in code.
 C  * The non-nc code was trimmed cycle for cycle to its current state.  It is
 C    probably hard to save more that an odd cycle there.  The nc code is much
-C    rawer (since tune/speed doesn't have any applicable direct measurements).
+C    cruder (since tune/speed doesn't have any applicable direct measurements).
 C  * Without the nc entry points, this becomes around 1800 bytes of object
 C    code; the nc code adds over 1000 bytes.  We should perhaps sacrifice a
 C    few cycles for the non-nc code and let it fall into the nc code.
@@ -81,7 +92,9 @@ PROLOGUE(func_nc)
 ifdef(`HAVE_ABI_32',`
        addp4   rp = 0, rp              C                       M I
        addp4   up = 0, up              C                       M I
+       nop.i   0
        addp4   vp = 0, vp              C                       M I
+       nop.m   0
        zxt4    n = n                   C                       I
        ;;
 ')
@@ -106,8 +119,7 @@ ifdef(`HAVE_ABI_32',`
    (p7)        br.dptk .Lc010                  C                       B
    (p8)        br.dptk .Lc011                  C                       B
        ;;
-}
-{.mmi; cmp.eq  p9, p0 = 4, r14         C                       M I
+}{.mmi;        cmp.eq  p9, p0 = 4, r14         C                       M I
        cmp.eq  p10, p0 = 5, r14        C                       M I
        cmp.eq  p11, p0 = 6, r14        C                       M I
 }{.bbb
@@ -335,8 +347,8 @@ ifdef(`HAVE_ABI_32',`
        nop     0
        ;;
 .mmi;  ld8     v0 = [vp], 8            C                       M01
-       cmp.CND p6, p0 = w0, r10        C                       M I
        ld8     u0 = [up], 8            C                       M01
+       cmp.CND p6, p0 = w0, r10        C                       M I
 .mbb;  ADDSUB  w1 = u1, v1             C                       M I
   (p15)        br      L(c5)                   C                       B
        br      L(end)                  C                       B
@@ -406,7 +418,6 @@ ifdef(`HAVE_ABI_32',`
 
 EPILOGUE()
 
-ASM_START()
 PROLOGUE(func)
        .prologue
        .save   ar.lc, r2
@@ -414,7 +425,9 @@ PROLOGUE(func)
 ifdef(`HAVE_ABI_32',`
        addp4   rp = 0, rp              C                       M I
        addp4   up = 0, up              C                       M I
+       nop.i   0
        addp4   vp = 0, vp              C                       M I
+       nop.m   0
        zxt4    n = n                   C                       I
        ;;
 ')
@@ -612,7 +625,7 @@ L(gt4):
 .mmi;  add     upadv = PFDIST, up
        add     vpadv = PFDIST, vp
        mov     ar.lc = n               C                       I0
-       ld8     v1 = [vp], 8            C                       M01
+.mmi;  ld8     v1 = [vp], 8            C                       M01
        ld8     u1 = [up], 8            C                       M01
        nop     0
        ;;
@@ -644,7 +657,7 @@ L(gt4):
 .mmi;  add     upadv = PFDIST, up
        add     vpadv = PFDIST, vp
        add     rpx = 16, rp            C                       M I
-       ld8     v3 = [vp], 8            C                       M01
+.mmi;  ld8     v3 = [vp], 8            C                       M01
        ld8     u3 = [up], 8            C                       M01
        nop     0
        ;;
diff --git a/mpn/ia64/aorslsh1_n.asm b/mpn/ia64/aorslsh1_n.asm
deleted file mode 100644 (file)
index 01eff96..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-dnl  IA-64 mpn_addlsh1_n/mpn_sublsh1_n -- rp[] = up[] +- (vp[] << 1).
-
-dnl  Contributed to the GNU project by Torbjorn Granlund.
-
-dnl  Copyright 2003, 2004, 2005, 2010 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 Itanium:      3.0
-C Itanium 2:    1.5
-
-
-define(LSH,            1)
-define(RSH,            63)
-
-ifdef(`OPERATION_addlsh1_n',`
-  define(ADDSUB,       add)
-  define(ADDP,         1)
-  define(CND,         ltu)
-  define(INCR,        1)
-  define(LIM,         -1)
-  define(func, mpn_addlsh1_n)
-')
-ifdef(`OPERATION_sublsh1_n',`
-  define(ADDSUB,       sub)
-  define(CND,         gtu)
-  define(INCR,        -1)
-  define(LIM,         0)
-  define(func, mpn_sublsh1_n)
-')
-
-
-MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_n)
-
-include_mpn(`ia64/aorslshC_n.asm')
diff --git a/mpn/ia64/aorslsh2_n.asm b/mpn/ia64/aorslsh2_n.asm
deleted file mode 100644 (file)
index 6c7c732..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-dnl  IA-64 mpn_addlsh1_n/mpn_sublsh1_n -- rp[] = up[] +- (vp[] << 1).
-
-dnl  Contributed to the GNU project by Torbjorn Granlund.
-
-dnl  Copyright 2003, 2004, 2005, 2010 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 Itanium:      3.0
-C Itanium 2:    1.5
-
-
-define(LSH,            2)
-define(RSH,            62)
-
-ifdef(`OPERATION_addlsh2_n',`
-  define(ADDSUB,       add)
-  define(ADDP,         1)
-  define(CND,         ltu)
-  define(INCR,        1)
-  define(LIM,         -1)
-  define(func, mpn_addlsh2_n)
-')
-ifdef(`OPERATION_sublsh2_n',`
-  define(ADDSUB,       sub)
-  define(CND,         gtu)
-  define(INCR,        -1)
-  define(LIM,         0)
-  define(func, mpn_sublsh2_n)
-')
-
-
-MULFUNC_PROLOGUE(mpn_addlsh2_n mpn_sublsh2_n)
-
-include_mpn(`ia64/aorslshC_n.asm')
diff --git a/mpn/ia64/aorslshC_n.asm b/mpn/ia64/aorslshC_n.asm
deleted file mode 100644 (file)
index c304100..0000000
+++ /dev/null
@@ -1,360 +0,0 @@
-dnl  IA-64 mpn_addlsh1_n/mpn_sublsh1_n -- rp[] = up[] +- (vp[] << 1).
-
-dnl  Contributed to the GNU project by Torbjorn Granlund.
-
-dnl  Copyright 2003, 2004, 2005, 2010 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/.
-
-C           cycles/limb
-C Itanium:      ?
-C Itanium 2:    1.5
-
-C TODO
-C  * Use shladd in feed-in code (for mpn_addlshC_n).
-
-C INPUT PARAMETERS
-define(`rp', `r32')
-define(`up', `r33')
-define(`vp', `r34')
-define(`n',  `r35')
-
-define(cmpeqor, `cmp.eq.or')
-define(PFDIST, 500)
-
-define(`u0',`r14') define(`u1',`r15') define(`u2',`r16') define(`u3',`r17')
-define(`v0',`r18') define(`v1',`r19') define(`v2',`r20') define(`v3',`r21')
-define(`w0',`r22') define(`w1',`r23') define(`w2',`r24') define(`w3',`r25')
-define(`s0',`r26') define(`s1',`r27') define(`s2',`r28') define(`s3',`r29')
-define(`x0',`r30') define(`x1',`r31') define(`x2',`r30') define(`x3',`r31')
-
-
-ASM_START()
-PROLOGUE(func)
-       .prologue
-       .save   ar.lc, r2
-       .body
-ifdef(`HAVE_ABI_32',`
-       addp4   rp = 0, rp              C                       M I
-       addp4   up = 0, up              C                       M I
-       addp4   vp = 0, vp              C                       M I
-       zxt4    n = n                   C                       I
-       ;;
-')
- {.mmi;        ld8     r11 = [vp], 8           C                       M01
-       ld8     r10 = [up], 8           C                       M01
-       mov.i   r2 = ar.lc              C                       I0
-}{.mmi;        and     r14 = 3, n              C                       M I
-       cmp.lt  p15, p0 = 4, n          C                       M I
-       add     n = -5, n               C                       M I
-       ;;
-}{.mmi;        cmp.eq  p6, p0 = 1, r14         C                       M I
-       cmp.eq  p7, p0 = 2, r14         C                       M I
-       cmp.eq  p8, p0 = 3, r14         C                       M I
-}{.bbb
-  (p6) br.dptk .Lb01                   C                       B
-  (p7) br.dptk .Lb10                   C                       B
-  (p8) br.dptk .Lb11                   C                       B
-}
-
-.Lb00: ld8     v0 = [vp], 8            C                       M01
-       ld8     u0 = [up], 8            C                       M01
-       shr.u   n = n, 2                C                       I0
-       ;;
-.mmi;  ld8     v1 = [vp], 8            C                       M01
-       ld8     u1 = [up], 8            C                       M01
-       shl     x3 = r11, LSH           C                       I0
-       ;;
-.mmi;  ld8     v2 = [vp], 8            C                       M01
-       ld8     u2 = [up], 8            C                       M01
-       shrp    x0 = v0, r11, RSH       C                       I0
-.mmb;  ADDSUB  w3 = r10, x3            C                       M I
-       nop     0
-  (p15)        br.dpnt .grt4                   C                       B
-       ;;
-.mii;  cmp.CND p7, p0 = w3, r10        C                       M I
-       shrp    x1 = v1, v0, RSH        C                       I0
-       ADDSUB  w0 = u0, x0             C                       M I
-       ;;
-.mii;  cmp.CND p8, p0 = w0, u0         C                       M I
-       shrp    x2 = v2, v1, RSH        C                       I0
-       ADDSUB  w1 = u1, x1             C                       M I
-.mmb;  nop     0
-       nop     0
-       br      .Lcj4                   C                       B
-
-ALIGN(32)
-.grt4: ld8     v3 = [vp], 8            C                       M01
-       shrp    x0 = v0, r11, RSH       C                       I0
-       cmp.CND p8, p0 = w3, r10        C                       M I
-       ;;
-.mmi;  ld8     u3 = [up], 8            C                       M01
-       add     r11 = PFDIST, vp
-       shrp    x1 = v1, v0, RSH        C                       I0
-.mmi;  ld8     v0 = [vp], 8            C                       M01
-       ADDSUB  w0 = u0, x0             C                       M I
-       nop     0
-       ;;
-.mmi;  cmp.CND p6, p0 = w0, u0         C                       M I
-       add     r10 = PFDIST, up
-       mov.i   ar.lc = n               C                       I0
-.mmb;  ADDSUB  w1 = u1, x1             C                       M I
-       ld8     u0 = [up], 8            C                       M01
-       br      .LL00                   C                       B
-
-
-       ALIGN(32)
-.Lb01:
-ifdef(`ADDP',
-`      shladd  w2 = r11, LSH, r10      C                       M I
-       shr.u   r8 = r11, RSH           C retval                I0
-  (p15)        br.dpnt .grt1                   C                       B
-       ;;
-',`
-       shl     x2 = r11, LSH           C                       I0
-  (p15)        br.dpnt .grt1                   C                       B
-       ;;
-       ADDSUB  w2 = r10, x2            C                       M I
-       shr.u   r8 = r11, RSH           C retval                I0
-       ;;
-')
-       cmp.CND p6, p0 = w2, r10        C                       M I
-       br              .Lcj1
-
-.grt1: ld8     v3 = [vp], 8            C                       M01
-       ld8     u3 = [up], 8            C                       M01
-       shr.u   n = n, 2                C                       I0
-       ;;
-       ld8     v0 = [vp], 8            C                       M01
-       ld8     u0 = [up], 8            C                       M01
-       mov.i   ar.lc = n               C FIXME swap with next  I0
-ifdef(`ADDP',
-`',`
-       ADDSUB  w2 = r10, x2
-')
-       ;;
-.mmi;  ld8     v1 = [vp], 8            C                       M01
-       ld8     u1 = [up], 8            C                       M01
-       shrp    x3 = v3, r11, RSH       C                       I0
-       ;;
-.mmi;  ld8     v2 = [vp], 8            C                       M01
-       ld8     u2 = [up], 8            C                       M01
-       shrp    x0 = v0, v3, RSH        C                       I0
-.mmb;  cmp.CND p6, p0 = w2, r10        C                       M I
-       ADDSUB  w3 = u3, x3             C                       M I
-       br.cloop.dptk   .grt5           C                       B
-       ;;
-.mmi;  cmp.CND p7, p0 = w3, u3         C                       M I
-       ADDSUB  w0 = u0, x0             C                       M I
-       shrp    x1 = v1, v0, RSH        C                       I0
-.mmb;  nop     0
-       nop     0
-       br      .Lcj5                   C                       B
-.grt5:
-.mmi;  add     r10 = PFDIST, up
-       add     r11 = PFDIST, vp
-       shrp    x0 = v0, v3, RSH        C                       I0
-.mmb;  ld8     v3 = [vp], 8            C                       M01
-       cmp.CND p8, p0 = w3, u3         C                       M I
-       br      .LL01                   C                       B
-
-       ALIGN(32)
-.Lb10: ld8     v2 = [vp], 8            C                       M01
-       ld8     u2 = [up], 8            C                       M01
-       shl     x1 = r11, LSH           C                       I0
-.mmb;  nop     0
-       nop     0
-  (p15)        br.dpnt .grt2                   C                       B
-       ;;
-.mmi;  ADDSUB  w1 = r10, x1            C                       M I
-       nop     0
-       shrp    x2 = v2, r11, RSH       C                       I0
-       ;;
-.mmi;  cmp.CND p9, p0 = w1, r10        C                       M I
-       ADDSUB  w2 = u2, x2             C                       M I
-       shr.u   r8 = v2, RSH            C retval                I0
-       ;;
-.mmb;  cmp.CND p6, p0 = w2, u2         C                       M I
-       nop     0
-       br      .Lcj2                   C                       B
-
-.grt2: ld8     v3 = [vp], 8            C                       M01
-       ld8     u3 = [up], 8            C                       M01
-       shr.u   n = n, 2                C                       I0
-       ;;
-.mmi;  ld8     v0 = [vp], 8            C                       M01
-       ld8     u0 = [up], 8            C                       M01
-       mov.i   ar.lc = n               C                       I0
-.mmi;  ADDSUB  w1 = r10, x1            C                       M I
-       nop     0
-       nop     0
-       ;;
-.mii;  ld8     v1 = [vp], 8            C                       M01
-       shrp    x2 = v2, r11, RSH       C                       I0
-       cmp.CND p8, p0 = w1, r10        C                       M I
-       ;;
-.mmi;  add     r10 = PFDIST, up
-       ld8     u1 = [up], 8            C                       M01
-       shrp    x3 = v3, v2, RSH        C                       I0
-.mmi;  add     r11 = PFDIST, vp
-       ld8     v2 = [vp], 8            C                       M01
-       ADDSUB  w2 = u2, x2             C                       M I
-       ;;
-.mmi;  cmp.CND p6, p0 = w2, u2         C                       M I
-       ld8     u2 = [up], 8            C                       M01
-       shrp    x0 = v0, v3, RSH        C                       I0
-.mbb;  ADDSUB  w3 = u3, x3             C                       M I
-       br.cloop.dpnt   L(top)          C                       B
-       br      L(end)                  C                       B
-
-.Lb11: ld8     v1 = [vp], 8            C                       M01
-       ld8     u1 = [up], 8            C                       M01
-       shl     x0 = r11, LSH           C                       I0
-       ;;
-.mmi;  ld8     v2 = [vp], 8            C                       M01
-       ld8     u2 = [up], 8            C                       M01
-       shr.u   n = n, 2                C                       I0
-.mmb;  nop     0
-       nop     0
-  (p15)        br.dpnt .grt3                   C                       B
-       ;;
-.mii;  nop     0
-       shrp    x1 = v1, r11, RSH       C                       I0
-       ADDSUB  w0 = r10, x0            C                       M I
-       ;;
-.mii;  cmp.CND p8, p0 = w0, r10        C                       M I
-       shrp    x2 = v2, v1, RSH        C                       I0
-       ADDSUB  w1 = u1, x1             C                       M I
-       ;;
-.mmb;  cmp.CND p9, p0 = w1, u1         C                       M I
-       ADDSUB  w2 = u2, x2             C                       M I
-       br      .Lcj3                   C                       B
-.grt3:
-.mmi;  ld8     v3 = [vp], 8            C                       M01
-       ld8     u3 = [up], 8            C                       M01
-       shrp    x1 = v1, r11, RSH       C                       I0
-.mmi;  ADDSUB  w0 = r10, x0            C                       M I
-       nop     0
-       nop     0
-       ;;
-.mmi;  ld8     v0 = [vp], 8            C                       M01
-       cmp.CND p6, p0 = w0, r10        C                       M I
-       mov.i   ar.lc = n               C                       I0
-.mmi;  ld8     u0 = [up], 8            C                       M01
-       ADDSUB  w1 = u1, x1             C                       M I
-       nop       0
-       ;;
-.mmi;  add     r10 = PFDIST, up
-       add     r11 = PFDIST, vp
-       shrp    x2 = v2, v1, RSH        C                       I0
-.mmb;  ld8     v1 = [vp], 8            C                       M01
-       cmp.CND p8, p0 = w1, u1         C                       M I
-       br      .LL11                   C                       B
-
-
-C *** MAIN LOOP START ***
-       ALIGN(32)
-L(top):        st8     [rp] = w1, 8            C                       M23
-       lfetch  [r10], 32
-   (p8)        cmpeqor p6, p0 = LIM, w2        C                       M I
-   (p8)        add     w2 = INCR, w2           C                       M I
-       ld8     v3 = [vp], 8            C                       M01
-       cmp.CND p8, p0 = w3, u3         C                       M I
-       ;;
-.LL01: ld8     u3 = [up], 8            C                       M01
-       shrp    x1 = v1, v0, RSH        C                       I0
-   (p6)        cmpeqor p8, p0 = LIM, w3        C                       M I
-   (p6)        add     w3 = INCR, w3           C                       M I
-       ld8     v0 = [vp], 8            C                       M01
-       ADDSUB  w0 = u0, x0             C                       M I
-       ;;
-       st8     [rp] = w2, 8            C                       M23
-       cmp.CND p6, p0 = w0, u0         C                       M I
-       nop.b   0
-       ld8     u0 = [up], 8            C                       M01
-       lfetch  [r11], 32
-       ADDSUB  w1 = u1, x1             C                       M I
-       ;;
-.LL00: st8     [rp] = w3, 8            C                       M23
-       shrp    x2 = v2, v1, RSH        C                       I0
-   (p8)        cmpeqor p6, p0 = LIM, w0        C                       M I
-   (p8)        add     w0 = INCR, w0           C                       M I
-       ld8     v1 = [vp], 8            C                       M01
-       cmp.CND p8, p0 = w1, u1         C                       M I
-       ;;
-.LL11: ld8     u1 = [up], 8            C                       M01
-       shrp    x3 = v3, v2, RSH        C                       I0
-   (p6)        cmpeqor p8, p0 = LIM, w1        C                       M I
-   (p6)        add     w1 = INCR, w1           C                       M I
-       ld8     v2 = [vp], 8            C                       M01
-       ADDSUB  w2 = u2, x2             C                       M I
-       ;;
-.mmi;  st8     [rp] = w0, 8            C                       M23
-       cmp.CND p6, p0 = w2, u2         C                       M I
-       shrp    x0 = v0, v3, RSH        C                       I0
-       ld8     u2 = [up], 8            C                       M01
-       ADDSUB  w3 = u3, x3             C                       M I
-       br.cloop.dptk   L(top)          C                       B
-       ;;
-C *** MAIN LOOP END ***
-
-L(end):
-.mmi;  st8     [rp] = w1, 8            C                       M23
-   (p8)        cmpeqor p6, p0 = LIM, w2        C                       M I
-       shrp    x1 = v1, v0, RSH        C                       I0
-.mmi;
-   (p8)        add     w2 = INCR, w2           C                       M I
-       cmp.CND p7, p0 = w3, u3         C                       M I
-       ADDSUB  w0 = u0, x0             C                       M I
-       ;;
-.Lcj5:
-.mmi;  st8     [rp] = w2, 8            C                       M23
-   (p6)        cmpeqor p7, p0 = LIM, w3        C                       M I
-       shrp    x2 = v2, v1, RSH        C                       I0
-.mmi;
-   (p6)        add     w3 = INCR, w3           C                       M I
-       cmp.CND p8, p0 = w0, u0         C                       M I
-       ADDSUB  w1 = u1, x1             C                       M I
-       ;;
-.Lcj4:
-.mmi;  st8     [rp] = w3, 8            C                       M23
-   (p7)        cmpeqor p8, p0 = LIM, w0        C                       M I
-       mov.i   ar.lc = r2              C                       I0
-.mmi;
-   (p7)        add     w0 = INCR, w0           C                       M I
-       cmp.CND p9, p0 = w1, u1         C                       M I
-       ADDSUB  w2 = u2, x2             C                       M I
-       ;;
-.Lcj3:
-.mmi;  st8     [rp] = w0, 8            C                       M23
-   (p8)        cmpeqor p9, p0 = LIM, w1        C                       M I
-       shr.u   r8 = v2, RSH            C                       I0
-.mmi;
-   (p8)        add     w1 = INCR, w1           C                       M I
-       cmp.CND p6, p0 = w2, u2         C                       M I
-       nop     0
-       ;;
-.Lcj2:
-.mmi;  st8     [rp] = w1, 8            C                       M23
-   (p9)        cmpeqor p6, p0 = LIM, w2        C                       M I
-   (p9)        add     w2 = INCR, w2           C                       M I
-       ;;
-.Lcj1:
-.mmb;  st8     [rp] = w2               C                       M23
-   (p6)        add     r8 = 1, r8              C                       M I
-       br.ret.sptk.many b0             C                       B
-EPILOGUE()
-ASM_END()
diff --git a/mpn/ia64/aorsorrlsh1_n.asm b/mpn/ia64/aorsorrlsh1_n.asm
new file mode 100644 (file)
index 0000000..9b58b9e
--- /dev/null
@@ -0,0 +1,48 @@
+dnl  IA-64 mpn_addlsh1_n, mpn_sublsh1_n, mpn_rsblsh1_n
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2003-2005, 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 Itanium:      3.0
+C Itanium 2:    1.5
+
+
+define(LSH,            1)
+
+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(`ia64/aorsorrlshC_n.asm')
diff --git a/mpn/ia64/aorsorrlsh2_n.asm b/mpn/ia64/aorsorrlsh2_n.asm
new file mode 100644 (file)
index 0000000..39b384a
--- /dev/null
@@ -0,0 +1,48 @@
+dnl  IA-64 mpn_addlsh2_n, mpn_sublsh2_n, mpn_rsblsh2_n
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2003-2005, 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 Itanium:      3.0
+C Itanium 2:    1.5
+
+
+define(LSH,            2)
+
+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(`ia64/aorsorrlshC_n.asm')
diff --git a/mpn/ia64/aorsorrlshC_n.asm b/mpn/ia64/aorsorrlshC_n.asm
new file mode 100644 (file)
index 0000000..d327838
--- /dev/null
@@ -0,0 +1,397 @@
+dnl  IA-64 mpn_addlshC_n, mpn_sublshC_n, mpn_rsblshC_n.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2003-2005, 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/.
+
+C           cycles/limb
+C Itanium:      ?
+C Itanium 2:    1.5
+
+C TODO
+C  * Use shladd in feed-in code (for mpn_addlshC_n).
+C  * Rewrite loop to schedule loads closer to use, since we do prefetch.
+
+C INPUT PARAMETERS
+define(`rp', `r32')
+define(`up', `r33')
+define(`vp', `r34')
+define(`n',  `r35')
+
+ifdef(`DO_add', `
+  define(`ADDSUB',     `add    $1 = $2, $3')
+  define(`CMP',        `cmp.ltu        $1,p0 = $2, $3')
+  define(`INCR',       1)
+  define(`LIM',        -1)
+  define(`func',        mpn_addlsh`'LSH`'_n)')
+ifdef(`DO_sub', `
+  define(`ADDSUB',     `sub    $1 = $2, $3')
+  define(`CMP',        `cmp.gtu        $1,p0 = $2, $3')
+  define(`INCR',       -1)
+  define(`LIM',        0)
+  define(`func',        mpn_sublsh`'LSH`'_n)')
+ifdef(`DO_rsb', `
+  define(`ADDSUB',     `sub    $1 = $3, $2')
+  define(`CMP',        `cmp.gtu        $1,p0 = $2, $4')
+  define(`INCR',       -1)
+  define(`LIM',        0)
+  define(`func',        mpn_rsblsh`'LSH`'_n)')
+
+define(cmpeqor, `cmp.eq.or')
+define(PFDIST, 500)
+
+define(`u0',`r14') define(`u1',`r15') define(`u2',`r16') define(`u3',`r17')
+define(`v0',`r18') define(`v1',`r19') define(`v2',`r20') define(`v3',`r21')
+define(`w0',`r22') define(`w1',`r23') define(`w2',`r24') define(`w3',`r25')
+define(`s0',`r26') define(`s1',`r27') define(`s2',`r28') define(`s3',`r29')
+define(`x0',`r30') define(`x1',`r31') define(`x2',`r3')  define(`x3',`r9')
+
+C r3 r8 r9 r10 r11
+
+ASM_START()
+PROLOGUE(func)
+       .prologue
+       .save   ar.lc, r2
+       .body
+ifdef(`HAVE_ABI_32',`
+       addp4   rp = 0, rp              C                       M I
+       addp4   up = 0, up              C                       M I
+       nop.i   0
+       addp4   vp = 0, vp              C                       M I
+       nop.m   0
+       zxt4    n = n                   C                       I
+       ;;
+')
+ {.mmi;        ld8     r11 = [vp], 8           C                       M01
+       ld8     r10 = [up], 8           C                       M01
+       mov.i   r2 = ar.lc              C                       I0
+}{.mmi;        and     r14 = 3, n              C                       M I
+       cmp.lt  p15, p0 = 4, n          C                       M I
+       add     n = -5, n               C                       M I
+       ;;
+}{.mmi;        cmp.eq  p6, p0 = 1, r14         C                       M I
+       cmp.eq  p7, p0 = 2, r14         C                       M I
+       cmp.eq  p8, p0 = 3, r14         C                       M I
+}{.bbb
+  (p6) br.dptk .Lb01                   C                       B
+  (p7) br.dptk .Lb10                   C                       B
+  (p8) br.dptk .Lb11                   C                       B
+}
+
+.Lb00: ld8     v0 = [vp], 8            C                       M01
+       ld8     u0 = [up], 8            C                       M01
+       shr.u   n = n, 2                C                       I0
+       ;;
+.mmi;  ld8     v1 = [vp], 8            C                       M01
+       ld8     u1 = [up], 8            C                       M01
+       shl     x3 = r11, LSH           C                       I0
+       ;;
+.mmi;  ld8     v2 = [vp], 8            C                       M01
+       ld8     u2 = [up], 8            C                       M01
+       shrp    x0 = v0, r11, 64-LSH    C                       I0
+.mmb;  ADDSUB( w3, r10, x3)            C                       M I
+       nop     0
+  (p15)        br.dpnt .grt4                   C                       B
+       ;;
+.mii;  CMP(    p7, w3, r10, x3)        C                       M II0
+       shrp    x1 = v1, v0, 64-LSH     C                       I0
+       ADDSUB( w0, u0, x0)             C                       M I
+       ;;
+.mii;  CMP(    p8, w0, u0, x0)         C                       M I
+       shrp    x2 = v2, v1, 64-LSH     C                       I0
+       ADDSUB( w1, u1, x1)             C                       M I
+.mmb;  nop     0
+       nop     0
+       br      .Lcj4                   C                       B
+
+ALIGN(32)
+.grt4: ld8     v3 = [vp], 8            C                       M01
+       shrp    x0 = v0, r11, 64-LSH    C                       I0
+       CMP(    p8, w3, r10, x3)        C                       M I
+       ;;
+.mmi;  ld8     u3 = [up], 8            C                       M01
+       add     r11 = PFDIST, vp
+       shrp    x1 = v1, v0, 64-LSH     C                       I0
+.mmi;  ld8     v0 = [vp], 8            C                       M01
+       ADDSUB( w0, u0, x0)             C                       M I
+       nop     0
+       ;;
+.mmi;  CMP(    p6, w0, u0, x0)         C                       M I
+       add     r10 = PFDIST, up
+       mov.i   ar.lc = n               C                       I0
+.mmb;  ADDSUB( w1, u1, x1)             C                       M I
+       ld8     u0 = [up], 8            C                       M01
+       br      .LL00                   C                       B
+
+
+       ALIGN(32)
+.Lb01:
+ifdef(`DO_add',
+`      shladd  w2 = r11, LSH, r10      C                       M I
+       shr.u   r8 = r11, 64-LSH        C retval                I0
+  (p15)        br.dpnt .grt1                   C                       B
+       ;;
+',`
+       shl     x2 = r11, LSH           C                       I0
+  (p15)        br.dpnt .grt1                   C                       B
+       ;;
+       ADDSUB( w2, r10, x2)            C                       M I
+       shr.u   r8 = r11, 64-LSH        C retval                I0
+       ;;
+')
+       CMP(    p6, w2, r10, x2)        C                       M I
+       br              .Lcj1
+
+.grt1: ld8     v3 = [vp], 8            C                       M01
+       ld8     u3 = [up], 8            C                       M01
+       shr.u   n = n, 2                C                       I0
+       ;;
+       ld8     v0 = [vp], 8            C                       M01
+       ld8     u0 = [up], 8            C                       M01
+       mov.i   ar.lc = n               C FIXME swap with next  I0
+ifdef(`DO_add',
+`',`
+       ADDSUB( w2, r10, x2)
+')
+       ;;
+.mmi;  ld8     v1 = [vp], 8            C                       M01
+       ld8     u1 = [up], 8            C                       M01
+       shrp    x3 = v3, r11, 64-LSH    C                       I0
+       ;;
+.mmi;  ld8     v2 = [vp], 8            C                       M01
+       ld8     u2 = [up], 8            C                       M01
+       shrp    x0 = v0, v3, 64-LSH     C                       I0
+.mmb;  CMP(    p6, w2, r10, x2)        C                       M I
+       ADDSUB( w3, u3, x3)             C                       M I
+       br.cloop.dptk   .grt5           C                       B
+       ;;
+.mmi;  CMP(    p7, w3, u3, x3)         C                       M I
+       ADDSUB( w0, u0, x0)             C                       M I
+       shrp    x1 = v1, v0, 64-LSH     C                       I0
+.mmb;  nop     0
+       nop     0
+       br      .Lcj5                   C                       B
+.grt5:
+.mmi;  add     r10 = PFDIST, up
+       add     r11 = PFDIST, vp
+       shrp    x0 = v0, v3, 64-LSH     C                       I0
+.mmb;  ld8     v3 = [vp], 8            C                       M01
+       CMP(    p8, w3, u3, x3)         C                       M I
+       br      .LL01                   C                       B
+
+       ALIGN(32)
+.Lb10: ld8     v2 = [vp], 8            C                       M01
+       ld8     u2 = [up], 8            C                       M01
+       shl     x1 = r11, LSH           C                       I0
+.mmb;  nop     0
+       nop     0
+  (p15)        br.dpnt .grt2                   C                       B
+       ;;
+.mmi;  ADDSUB( w1, r10, x1)            C                       M I
+       nop     0
+       shrp    x2 = v2, r11, 64-LSH    C                       I0
+       ;;
+.mmi;  CMP(    p9, w1, r10, x1)        C                       M I
+       ADDSUB( w2, u2, x2)             C                       M I
+       shr.u   r8 = v2, 64-LSH         C retval                I0
+       ;;
+.mmb;  CMP(    p6, w2, u2, x2)         C                       M I
+       nop     0
+       br      .Lcj2                   C                       B
+
+.grt2: ld8     v3 = [vp], 8            C                       M01
+       ld8     u3 = [up], 8            C                       M01
+       shr.u   n = n, 2                C                       I0
+       ;;
+.mmi;  ld8     v0 = [vp], 8            C                       M01
+       ld8     u0 = [up], 8            C                       M01
+       mov.i   ar.lc = n               C                       I0
+.mmi;  ADDSUB( w1, r10, x1)            C                       M I
+       nop     0
+       nop     0
+       ;;
+.mii;  ld8     v1 = [vp], 8            C                       M01
+       shrp    x2 = v2, r11, 64-LSH    C                       I0
+       CMP(    p8, w1, r10, x1)        C                       M I
+       ;;
+.mmi;  add     r10 = PFDIST, up
+       ld8     u1 = [up], 8            C                       M01
+       shrp    x3 = v3, v2, 64-LSH     C                       I0
+.mmi;  add     r11 = PFDIST, vp
+       ld8     v2 = [vp], 8            C                       M01
+       ADDSUB( w2, u2, x2)             C                       M I
+       ;;
+.mmi;  CMP(    p6, w2, u2, x2)         C                       M I
+       ld8     u2 = [up], 8            C                       M01
+       shrp    x0 = v0, v3, 64-LSH     C                       I0
+.mbb;  ADDSUB( w3, u3, x3)             C                       M I
+       br.cloop.dpnt   L(top)          C                       B
+       br      L(end)                  C                       B
+
+.Lb11: ld8     v1 = [vp], 8            C                       M01
+       ld8     u1 = [up], 8            C                       M01
+       shl     x0 = r11, LSH           C                       I0
+       ;;
+.mmi;  ld8     v2 = [vp], 8            C                       M01
+       ld8     u2 = [up], 8            C                       M01
+       shr.u   n = n, 2                C                       I0
+.mmb;  nop     0
+       nop     0
+  (p15)        br.dpnt .grt3                   C                       B
+       ;;
+.mii;  nop     0
+       shrp    x1 = v1, r11, 64-LSH    C                       I0
+       ADDSUB( w0, r10, x0)            C                       M I
+       ;;
+.mii;  CMP(    p8, w0, r10, x0)        C                       M I
+       shrp    x2 = v2, v1, 64-LSH     C                       I0
+       ADDSUB( w1, u1, x1)             C                       M I
+       ;;
+.mmb;  CMP(    p9, w1, u1, x1)         C                       M I
+       ADDSUB( w2, u2, x2)             C                       M I
+       br      .Lcj3                   C                       B
+.grt3:
+.mmi;  ld8     v3 = [vp], 8            C                       M01
+       ld8     u3 = [up], 8            C                       M01
+       shrp    x1 = v1, r11, 64-LSH    C                       I0
+.mmi;  ADDSUB( w0, r10, x0)            C                       M I
+       nop     0
+       nop     0
+       ;;
+.mmi;  ld8     v0 = [vp], 8            C                       M01
+       CMP(    p6, w0, r10, x0)        C                       M I
+       mov.i   ar.lc = n               C                       I0
+.mmi;  ld8     u0 = [up], 8            C                       M01
+       ADDSUB( w1, u1, x1)             C                       M I
+       nop     0
+       ;;
+.mmi;  add     r10 = PFDIST, up
+       add     r11 = PFDIST, vp
+       shrp    x2 = v2, v1, 64-LSH     C                       I0
+.mmb;  ld8     v1 = [vp], 8            C                       M01
+       CMP(    p8, w1, u1, x1)         C                       M I
+       br      .LL11                   C                       B
+
+
+C *** MAIN LOOP START ***
+       ALIGN(32)
+L(top):        st8     [rp] = w1, 8            C                       M23
+       lfetch  [r10], 32
+   (p8)        cmpeqor p6, p0 = LIM, w2        C                       M I
+   (p8)        add     w2 = INCR, w2           C                       M I
+       ld8     v3 = [vp], 8            C                       M01
+       CMP(    p8, w3, u3, x3)         C                       M I
+       ;;
+.LL01: ld8     u3 = [up], 8            C                       M01
+       shrp    x1 = v1, v0, 64-LSH     C                       I0
+   (p6)        cmpeqor p8, p0 = LIM, w3        C                       M I
+   (p6)        add     w3 = INCR, w3           C                       M I
+       ld8     v0 = [vp], 8            C                       M01
+       ADDSUB( w0, u0, x0)             C                       M I
+       ;;
+       st8     [rp] = w2, 8            C                       M23
+       CMP(    p6, w0, u0, x0)         C                       M I
+       nop.b   0
+       ld8     u0 = [up], 8            C                       M01
+       lfetch  [r11], 32
+       ADDSUB( w1, u1, x1)             C                       M I
+       ;;
+.LL00: st8     [rp] = w3, 8            C                       M23
+       shrp    x2 = v2, v1, 64-LSH     C                       I0
+   (p8)        cmpeqor p6, p0 = LIM, w0        C                       M I
+   (p8)        add     w0 = INCR, w0           C                       M I
+       ld8     v1 = [vp], 8            C                       M01
+       CMP(    p8, w1, u1, x1)         C                       M I
+       ;;
+.LL11: ld8     u1 = [up], 8            C                       M01
+       shrp    x3 = v3, v2, 64-LSH     C                       I0
+   (p6)        cmpeqor p8, p0 = LIM, w1        C                       M I
+   (p6)        add     w1 = INCR, w1           C                       M I
+       ld8     v2 = [vp], 8            C                       M01
+       ADDSUB( w2, u2, x2)             C                       M I
+       ;;
+.mmi;  st8     [rp] = w0, 8            C                       M23
+       CMP(    p6, w2, u2, x2)         C                       M I
+       shrp    x0 = v0, v3, 64-LSH     C                       I0
+       ld8     u2 = [up], 8            C                       M01
+       ADDSUB( w3, u3, x3)             C                       M I
+       br.cloop.dptk   L(top)          C                       B
+       ;;
+C *** MAIN LOOP END ***
+
+L(end):
+.mmi;  st8     [rp] = w1, 8            C                       M23
+   (p8)        cmpeqor p6, p0 = LIM, w2        C                       M I
+       shrp    x1 = v1, v0, 64-LSH     C                       I0
+.mmi;
+   (p8)        add     w2 = INCR, w2           C                       M I
+       CMP(    p7, w3, u3, x3)         C                       M I
+       ADDSUB( w0, u0, x0)             C                       M I
+       ;;
+.Lcj5:
+.mmi;  st8     [rp] = w2, 8            C                       M23
+   (p6)        cmpeqor p7, p0 = LIM, w3        C                       M I
+       shrp    x2 = v2, v1, 64-LSH     C                       I0
+.mmi;
+   (p6)        add     w3 = INCR, w3           C                       M I
+       CMP(    p8, w0, u0, x0)         C                       M I
+       ADDSUB( w1, u1, x1)             C                       M I
+       ;;
+.Lcj4:
+.mmi;  st8     [rp] = w3, 8            C                       M23
+   (p7)        cmpeqor p8, p0 = LIM, w0        C                       M I
+       mov.i   ar.lc = r2              C                       I0
+.mmi;
+   (p7)        add     w0 = INCR, w0           C                       M I
+       CMP(    p9, w1, u1, x1)         C                       M I
+       ADDSUB( w2, u2, x2)             C                       M I
+       ;;
+.Lcj3:
+.mmi;  st8     [rp] = w0, 8            C                       M23
+   (p8)        cmpeqor p9, p0 = LIM, w1        C                       M I
+       shr.u   r8 = v2, 64-LSH         C                       I0
+.mmi;
+   (p8)        add     w1 = INCR, w1           C                       M I
+       CMP(    p6, w2, u2, x2)         C                       M I
+       nop     0
+       ;;
+.Lcj2:
+.mmi;  st8     [rp] = w1, 8            C                       M23
+   (p9)        cmpeqor p6, p0 = LIM, w2        C                       M I
+   (p9)        add     w2 = INCR, w2           C                       M I
+       ;;
+.Lcj1:
+.mmb;  st8     [rp] = w2               C                       M23
+ifdef(`DO_rsb',`
+   (p6)        add     r8 = -1, r8             C                       M I
+',`
+   (p6)        add     r8 = 1, r8              C                       M I
+')     br.ret.sptk.many b0             C                       B
+EPILOGUE()
+ASM_END()
index 6cd98e7da759a55129e6d65d020e0e7a65ef41be..47e4553cda5dd7a42d63fdf4b899603ab9145ec6 100644 (file)
@@ -5,19 +5,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund.
 dnl  Copyright 2008, 2009 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/ia64/cnd_aors_n.asm b/mpn/ia64/cnd_aors_n.asm
new file mode 100644 (file)
index 0000000..dc4a937
--- /dev/null
@@ -0,0 +1,259 @@
+dnl  IA-64 mpn_cnd_add_n/mpn_cnd_sub_n.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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 Itanium:      ?
+C Itanium 2:    1.5
+
+C INPUT PARAMETERS
+define(`cnd', `r32')
+define(`rp',  `r33')
+define(`up',  `r34')
+define(`vp',  `r35')
+define(`n',   `r36')
+
+ifdef(`OPERATION_cnd_add_n',`
+  define(ADDSUB,       add)
+  define(CND,          ltu)
+  define(INCR,         1)
+  define(LIM,          -1)
+  define(func,    mpn_cnd_add_n)
+')
+ifdef(`OPERATION_cnd_sub_n',`
+  define(ADDSUB,       sub)
+  define(CND,          gtu)
+  define(INCR,         -1)
+  define(LIM,          0)
+  define(func,    mpn_cnd_sub_n)
+')
+
+define(cmpeqor, `cmp.eq.or')
+define(PFDIST, 160)
+
+C Some useful aliases for registers we use
+define(`u0',`r14') define(`u1',`r15') define(`u2',`r16') define(`u3',`r17')
+define(`x0',`r20') define(`x1',`r21') define(`x2',`r22') define(`x3',`r23')
+define(`v0',`r24') define(`v1',`r25') define(`v2',`r26') define(`v3',`r27')
+define(`w0',`r28') define(`w1',`r29') define(`w2',`r30') define(`w3',`r31')
+define(`up1',`up') define(`up2',`r8') define(`upadv',`r1')
+define(`vp1',`vp') define(`vp2',`r9') define(`vpadv',`r11')
+define(`rp1',`rp') define(`rp2',`r10')
+
+MULFUNC_PROLOGUE(mpn_cnd_add_n mpn_cnd_sub_n)
+
+ASM_START()
+PROLOGUE(func)
+       .prologue
+       .save   ar.lc, r2
+       .body
+ifdef(`HAVE_ABI_32',`
+       addp4   rp = 0, rp              C                               M I
+       addp4   up = 0, up              C                               M I
+       nop.i   0
+       addp4   vp = 0, vp              C                               M I
+       nop.m   0
+       zxt4    n = n                   C                               I
+       ;;
+')
+.mmi;  and     r3 = 3, n               C                               M I
+       add     n = -1, n               C                               M I
+       mov     r2 = ar.lc              C                               I0
+.mmi;  cmp.ne  p6, p7 = 0, cnd         C                               M I
+       add     vp2 = 8, vp             C                               M I
+       add     up2 = 8, up             C                               M I
+       ;;
+.mmi;  add     upadv = PFDIST, up      C                               M I
+       add     vpadv = PFDIST, vp      C                               M I
+       shr.u   n = n, 2                C                               I0
+       .pred.rel "mutex", p6, p7
+.mmi;  add     rp2 = 8, rp             C                               M I
+   (p6)        mov     cnd = -1                C                               M I
+   (p7)        mov     cnd = 0                 C                               M I
+       ;;
+       cmp.eq  p9, p0 = 1, r3          C                               M I
+       cmp.eq  p7, p0 = 2, r3          C                               M I
+       cmp.eq  p8, p0 = 3, r3          C                               M I
+   (p9)        br      L(b1)                   C                               B
+   (p7)        br      L(b2)                   C                               B
+   (p8)        br      L(b3)                   C                               B
+       ;;
+L(b0):
+.mmi;  ld8     v2 = [vp1], 16          C                               M01
+       ld8     v3 = [vp2], 16          C                               M01
+       mov     ar.lc = n               C                               I0
+       ;;
+       ld8     u2 = [up1], 16          C                               M01
+       ld8     u3 = [up2], 16          C                               M01
+       and     x2 = v2, cnd            C                               M I
+       and     x3 = v3, cnd            C                               M I
+       ;;
+       ADDSUB  w2 = u2, x2             C                               M I
+       ADDSUB  w3 = u3, x3             C                               M I
+       ;;
+       ld8     v0 = [vp1], 16          C                               M01
+       ld8     v1 = [vp2], 16          C                               M01
+       cmp.CND p8, p0 = w2, u2         C                               M I
+       cmp.CND p9, p0 = w3, u3         C                               M I
+       br      L(lo0)
+
+L(b1): ld8     v1 = [vp1], 8           C                               M01
+       add     vp2 = 8, vp2            C                               M I
+       add     rp2 = 8, rp2            C                               M I
+       ;;
+       ld8     u1 = [up1], 8           C                               M01
+       add     up2 = 8, up2            C                               M I
+       and     x1 = v1, cnd            C                               M I
+       ;;
+       ADDSUB  w1 = u1, x1             C                               M I
+       cmp.ne  p10, p0 = 0, n
+       add     n = -1, n
+       ;;
+       cmp.CND p7, p0 = w1, u1         C                               M I
+       st8     [rp1] = w1, 8           C                               M23
+  (p10)        br      L(b0)
+       ;;
+       mov     r8 = 0                  C                               M I
+       br      L(e1)
+
+L(b3): ld8     v3 = [vp1], 8           C                               M01
+       add     vp2 = 8, vp2            C                               M I
+       add     rp2 = 8, rp2            C                               M I
+       ;;
+       ld8     u3 = [up1], 8           C                               M01
+       add     up2 = 8, up2            C                               M I
+       and     x3 = v3, cnd            C                               M I
+       ;;
+       ADDSUB  w3 = u3, x3             C                               M I
+       ;;
+       cmp.CND p9, p0 = w3, u3         C                               M I
+       st8     [rp1] = w3, 8           C                               M23
+       C fall through
+
+L(b2):
+.mmi;  ld8     v0 = [vp1], 16          C                               M01
+       ld8     v1 = [vp2], 16          C                               M01
+       mov     ar.lc = n               C                               I0
+       ;;
+       ld8     u0 = [up1], 16          C                               M01
+       ld8     u1 = [up2], 16          C                               M01
+       and     x0 = v0, cnd            C                               M I
+       and     x1 = v1, cnd            C                               M I
+       ;;
+       ADDSUB  w0 = u0, x0             C                               M I
+       ADDSUB  w1 = u1, x1             C                               M I
+       br.cloop.dptk   L(gt2)          C                               B
+       ;;
+       cmp.CND p6, p0 = w0, u0         C                               M I
+       br              L(e2)           C                               B
+L(gt2):
+       ld8     v2 = [vp1], 16          C                               M01
+       ld8     v3 = [vp2], 16          C                               M01
+       cmp.CND p6, p0 = w0, u0         C                               M I
+       cmp.CND p7, p0 = w1, u1         C                               M I
+       br              L(lo2)          C                               B
+
+
+C *** MAIN LOOP START ***
+C      ALIGN(32)
+L(top):
+.mmi;  ld8     v2 = [vp1], 16          C                               M01
+       ld8     v3 = [vp2], 16          C                               M01
+       cmp.CND p6, p0 = w0, u0         C                               M I
+.mmi;  st8     [rp1] = w2, 16          C                               M23
+       st8     [rp2] = w3, 16          C                               M23
+       cmp.CND p7, p0 = w1, u1         C                               M I
+       ;;
+L(lo2):
+.mmi;  ld8     u2 = [up1], 16          C                               M01
+       ld8     u3 = [up2], 16          C                               M01
+   (p9)        cmpeqor p6, p0 = LIM, w0        C                               M I
+.mmi;  and     x2 = v2, cnd            C                               M I
+       and     x3 = v3, cnd            C                               M I
+   (p9)        add     w0 = INCR, w0           C                               M I
+       ;;
+.mmi;  ADDSUB  w2 = u2, x2             C                               M I
+   (p6)        cmpeqor p7, p0 = LIM, w1        C                               M I
+   (p6)        add     w1 = INCR, w1           C                               M I
+.mmi;  ADDSUB  w3 = u3, x3             C                               M I
+       lfetch  [upadv], 32
+       nop     0
+       ;;
+.mmi;  ld8     v0 = [vp1], 16          C                               M01
+       ld8     v1 = [vp2], 16          C                               M01
+       cmp.CND p8, p0 = w2, u2         C                               M I
+.mmi;  st8     [rp1] = w0, 16          C                               M23
+       st8     [rp2] = w1, 16          C                               M23
+       cmp.CND p9, p0 = w3, u3         C                               M I
+       ;;
+L(lo0):
+.mmi;  ld8     u0 = [up1], 16          C                               M01
+       ld8     u1 = [up2], 16          C                               M01
+   (p7)        cmpeqor p8, p0 = LIM, w2        C                               M I
+.mmi;  and     x0 = v0, cnd            C                               M I
+       and     x1 = v1, cnd            C                               M I
+   (p7)        add     w2 = INCR, w2           C                               M I
+       ;;
+.mmi;  ADDSUB  w0 = u0, x0             C                               M I
+   (p8)        cmpeqor p9, p0 = LIM, w3        C                               M I
+   (p8)        add     w3 = INCR, w3           C                               M I
+.mmb;  ADDSUB  w1 = u1, x1             C                               M I
+       lfetch  [vpadv], 32
+       br.cloop.dptk   L(top)          C                               B
+       ;;
+C *** MAIN LOOP END ***
+
+
+L(end):
+.mmi;  st8     [rp1] = w2, 16          C                               M23
+       st8     [rp2] = w3, 16          C                               M23
+       cmp.CND p6, p0 = w0, u0         C                               M I
+       ;;
+L(e2):
+.mmi;  cmp.CND p7, p0 = w1, u1         C                               M I
+   (p9)        cmpeqor p6, p0 = LIM, w0        C                               M I
+   (p9)        add     w0 = INCR, w0           C                               M I
+       ;;
+.mmi;  mov     r8 = 0                  C                               M I
+   (p6)        cmpeqor p7, p0 = LIM, w1        C                               M I
+   (p6)        add     w1 = INCR, w1           C                               M I
+       ;;
+.mmi;  st8     [rp1] = w0, 16          C                               M23
+       st8     [rp2] = w1, 16          C                               M23
+       mov     ar.lc = r2              C                               I0
+L(e1):
+.mmb;  nop     0
+   (p7)        mov     r8 = 1                  C                               M I
+       br.ret.sptk.many b0             C                               B
+EPILOGUE()
+ASM_END()
index 5ceb83866cdcc312cc00b4015a4b58c9df9df5b0..b94a1af3624d143bffd71db6e9a2661ff62ebb5b 100644 (file)
@@ -5,19 +5,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund.
 dnl  Copyright 2001, 2002, 2004 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index b8d26198664fce10b59d9df51e440dc7640374d2..49ed192021a68659a5f51fd3abb206d3399cda84 100644 (file)
@@ -5,19 +5,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund.
 dnl  Copyright 2001, 2002, 2004 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d9cd49c5f81a2131f3addddf401a1965fd945f76..5e4a273530c80723e7ccde4bf316912800761093 100644 (file)
@@ -2,22 +2,33 @@ dnl  IA-64 mpn_divexact_1 -- mpn by limb exact division.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund and Kevin Ryde.
 
-dnl  Copyright 2003, 2004, 2005, 2010 Free Software Foundation, Inc.
+dnl  Copyright 2003-2005, 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -38,7 +49,7 @@ C This code is a bit messy, and not as similar to mode1o.asm as desired.
 
 C The critical path during initialization is for computing the inverse of the
 C divisor.  Since odd divisors are probably common, we conditionally execute
-C the initial count_traling_zeros code and the downshift.
+C the initial count_trailing_zeros code and the downshift.
 
 C Possible improvement: Merge more of the feed-in code into the inverse
 C computation.
index 53b994a4ccdc499aa02f2b9eacb0f84fa8f2a4b7..e8878209db7fc8d28664bb5ee2e668375c092a1c 100644 (file)
@@ -6,19 +6,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund.
 dnl  Copyright 2002, 2004, 2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index b72741cf13cd9d32b74e83b028ce756ab4cf0709..9864311278c9782ac96adb235555ca4c902f7239 100644 (file)
@@ -3,21 +3,30 @@ dnl  IA-64 mpn_divrem_2 -- Divide an mpn number by a normalized 2-limb number.
 dnl  Copyright 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 2.1 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library; see the file COPYING.LIB.  If not, write
-dnl  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-dnl  Boston, MA 02110-1301, USA.
+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')
 
@@ -53,8 +62,9 @@ PROLOGUE(mpn_divrem_2)
 ifdef(`HAVE_ABI_32',
 `      addp4           r32 = 0, r32            C M I
        addp4           r34 = 0, r34            C M I
-       addp4           r36 = 0, r36            C M I
        zxt4            r35 = r35               C I
+       addp4           r36 = 0, r36            C M I
+       nop.m           0
        zxt4            r33 = r33               C I
        ;;
 ')
index 3a173dda07e35beee71e4017901644e3e1d3748a..28e9a63ca3916d615ac2a810e067fbd1cd4b0e8a 100644 (file)
@@ -3,29 +3,40 @@ 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, 2003, 2004, 2005, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2002-2005, 2012, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 
 C           cycles/bitpair (1x1 gcd)
 C Itanium:       ?
-C Itanium 2:     5.8  (trimmable to 5.64 with huge ctz_table)
+C Itanium 2:     5.1
 
 
 C mpn_gcd_1 (mp_srcptr xp, mp_size_t xsize, mp_limb_t y);
@@ -93,6 +104,7 @@ deflit(MAXSHIFT, 7)
 deflit(MASK, eval((m4_lshift(1,MAXSHIFT))-1))
 
        .section        ".rodata"
+       ALIGN(m4_lshift(1,MAXSHIFT))    C align table to allow using dep
 ctz_table:
        .byte   MAXSHIFT
 forloop(i,1,MASK,
@@ -175,27 +187,26 @@ ifdef(`HAVE_ABI_32',
 }              ;;
 
                addl    r22 = @ltoffx(ctz_table#), r1
+               mov     r25 = m4_lshift(MASK, MAXSHIFT)
                ;;
                ld8.mov r22 = [r22], ctz_table#
                br      L(ent)
 
-
                ALIGN(32)
 L(top):                .pred.rel "mutex", p6,p7
-.mmi;          and     r20 = MASK, r19
-       (p7)    mov     y = x
+.mmi;  (p7)    mov     y = x
        (p6)    sub     x = x, y
-.mmi;  (p7)    mov     x = r19
-               nop     0
+               dep     r21 = r19, r22, 0, MAXSHIFT     C concat(table,lowbits)
+.mmi;          and     r20 = MASK, r19
+       (p7)    mov     x = r19
                nop     0
                ;;
 L(mid):
-.mmb;          add     r21 = r22, r20
+.mmb;          ld1     r16 = [r21]
                cmp.eq  p10,p0 = 0, r20
        (p10)   br.spnt.few.clr  L(shift_alot)
                ;;
-.mmi;          ld1     r16 = [r21]
-               ;;
+.mmi;          nop     0
                nop     0
                shr.u   x = x, r16
                ;;
@@ -215,7 +226,9 @@ L(done_y):
                br.ret.sptk.many b0
 
 L(shift_alot):
-               extr.u  r20 = x, MAXSHIFT, MAXSHIFT
+               and     r20 = x, r25
                shr.u   x = x, MAXSHIFT
+               ;;
+               dep     r21 = x, r22, 0, MAXSHIFT
                br      L(mid)
 EPILOGUE()
index 1e0ccb97c3da6aa7d818a95c108ddccad1d9f568..bdbd62d97465bf78619b8f1413378ca412ffe14e 100644 (file)
@@ -1,27 +1,39 @@
 /* gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2009, 2010, 2011 Free Software
-Foundation, Inc.
+Copyright 2000-2005, 2009-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 /* 900MHz Itanium2 (titanic.gmplib.org) */
+/* FFT tuning limit = 25000000 */
+/* Generated by tuneup.c, 2014-03-12, gcc 4.4 */
 
 #define MOD_1_1P_METHOD                      2
 #define MOD_1_NORM_THRESHOLD                 0  /* always */
@@ -32,24 +44,27 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #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_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              12
 #define DIVEXACT_1_THRESHOLD                 0  /* always (native) */
 #define BMOD_1_TO_MOD_1_THRESHOLD        MP_SIZE_T_MAX  /* never */
 
-#define MUL_TOOM22_THRESHOLD                36
+#define MUL_TOOM22_THRESHOLD                40
 #define MUL_TOOM33_THRESHOLD               129
-#define MUL_TOOM44_THRESHOLD               214
+#define MUL_TOOM44_THRESHOLD               212
 #define MUL_TOOM6H_THRESHOLD               318
 #define MUL_TOOM8H_THRESHOLD               430
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD     121
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     138
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD     121
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD     145
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD     203
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD      97
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD     153
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD     129
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD     151
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     208
 
 #define SQR_BASECASE_THRESHOLD              11
-#define SQR_TOOM2_THRESHOLD                 84
+#define SQR_TOOM2_THRESHOLD                 82
 #define SQR_TOOM3_THRESHOLD                131
 #define SQR_TOOM4_THRESHOLD                494
 #define SQR_TOOM6_THRESHOLD                  0  /* always */
@@ -57,131 +72,131 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 #define MULMID_TOOM42_THRESHOLD             98
 
-#define MULMOD_BNM1_THRESHOLD               21
-#define SQRMOD_BNM1_THRESHOLD               25
+#define MULMOD_BNM1_THRESHOLD               23
+#define SQRMOD_BNM1_THRESHOLD               19
 
-#define MUL_FFT_MODF_THRESHOLD             468  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             500  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    476, 5}, {     27, 6}, {     14, 5}, {     29, 6}, \
-    {     33, 7}, {     17, 6}, {     37, 7}, {     19, 6}, \
-    {     39, 7}, {     21, 6}, {     43, 7}, {     33, 8}, \
+  { {    500, 5}, {     27, 6}, {     14, 5}, {     29, 6}, \
+    {     31, 7}, {     16, 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}, {     51, 9}, {     27, 8}, \
+    {     43, 9}, {     23, 8}, {     49, 9}, {     27, 8}, \
     {     57, 9}, {     31, 8}, {     63, 9}, {     43,10}, \
     {     23, 9}, {     59,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}, {     95,10}, {    191,11}, \
-    {    111,12}, {     63,11}, {    143,10}, {    287, 9}, \
-    {    575,10}, {    303,11}, {    159,10}, {    319,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}, \
+    {     79,10}, {    167,11}, {     95,10}, {    199,11}, \
+    {    111,12}, {     63,11}, {    143,10}, {    287,11}, \
+    {    159,12}, {     95,11}, {    191,10}, {    399,11}, \
+    {    207,10}, {    415,13}, {     63,12}, {    127,11}, \
+    {    271,10}, {    543,11}, {    287,10}, {    575,12}, \
     {    159,11}, {    335,10}, {    671,11}, {    367,12}, \
     {    191,11}, {    399,10}, {    799,11}, {    431,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}, \
-    {    415,11}, {    863,12}, {    447,14}, {    127,13}, \
-    {    255,12}, {    607,13}, {    319,12}, {    735,13}, \
-    {    383,12}, {    799,11}, {   1599,12}, {    863,13}, \
-    {    447,12}, {    927,11}, {   1855,14}, {    255,13}, \
-    {    511,12}, {   1055,13}, {    575,12}, {   1215,13}, \
-    {    639,12}, {   1279,13}, {    703,14}, {    383,13}, \
-    {    767,12}, {   1535,13}, {    831,12}, {   1663,13}, \
-    {    895,12}, {   1791,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}, {   1663,14}, {    895,13}, \
-    {   1855,15}, {    511,14}, {   1023,13}, {   2175,14}, \
+    {    383,11}, {    799,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}, {    511,12}, {   1055,13}, {    575,12}, \
+    {   1215,13}, {    639,12}, {   1279,13}, {    703,14}, \
+    {    383,13}, {    767,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}, {   1343,12}, {   2687,13}, \
+    {   1471,14}, {    767,13}, {   1599,12}, {   3199,13}, \
+    {   1727,14}, {    895,13}, {   1855,15}, {    511,14}, \
+    {   1023,13}, {   2111,12}, {   4223,13}, {   2175,14}, \
     {   1151,13}, {   2431,14}, {   1279,13}, {   2687,14}, \
-    {   1407,15}, {    767,14}, {   1535,13}, {   3199,14}, \
-    {   1663,13}, {   3455,14}, {   1791,16}, {  65536,17}, \
-    { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
-    {2097152,22}, {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 155
+    {   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 150
 #define MUL_FFT_THRESHOLD                 6272
 
-#define SQR_FFT_MODF_THRESHOLD             440  /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD             468  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    436, 5}, {     14, 4}, {     29, 5}, {     31, 6}, \
+  { {    468, 5}, {     29, 6}, {     15, 5}, {     31, 6}, \
     {     35, 7}, {     18, 6}, {     37, 7}, {     37, 8}, \
-    {     19, 7}, {     40, 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}, \
-    {    127,10}, {    255,11}, {    143,10}, {    287, 9}, \
-    {    575,10}, {    303,11}, {    159,10}, {    319,12}, \
-    {     95,11}, {    191,10}, {    399,11}, {    207,10}, \
-    {    431,13}, {     63,12}, {    127,11}, {    271,10}, \
-    {    543,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}, {    383,11}, \
-    {    799,12}, {    415,11}, {    863,12}, {    447,11}, \
-    {    895,14}, {    127,13}, {    255,12}, {    543,11}, \
-    {   1087,12}, {    607,13}, {    319,12}, {    735,13}, \
-    {    383,12}, {    863,13}, {    447,12}, {    959,14}, \
-    {    255,13}, {    511,12}, {   1087,13}, {    575,12}, \
-    {   1183,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}, {   1087,12}, \
-    {   2175,13}, {   1215,14}, {    639,13}, {   1343,12}, \
-    {   2687,13}, {   1471,14}, {    767,13}, {   1663,14}, \
-    {    895,13}, {   1919,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,14}, {   1791,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 151
+    {     19, 7}, {     40, 8}, {     29, 9}, {     15, 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}, {    143,11}, \
+    {     79,10}, {    167,11}, {     95,10}, {    191,11}, \
+    {    111,12}, {     63,11}, {    127,10}, {    255,11}, \
+    {    143,10}, {    287, 9}, {    575,10}, {    303,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,10}, {    863,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}, {    383,11}, {    799,12}, \
+    {    415,11}, {    863,12}, {    447,11}, {    895,14}, \
+    {    127,13}, {    255,12}, {    543,11}, {   1087,12}, \
+    {    607,13}, {    319,12}, {    735,13}, {    383,12}, \
+    {    863,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}, {    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}, {   1663,14}, {    895,13}, \
+    {   1919,15}, {    511,14}, {   1023,13}, {   2175,14}, \
+    {   1151,13}, {   2431,14}, {   1279,13}, {   2687,14}, \
+    {   1407,15}, {  32768,16}, {  65536,17}, { 131072,18}, \
+    { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
+    {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 154
 #define SQR_FFT_THRESHOLD                 4032
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
 #define MULLO_DC_THRESHOLD                  62
-#define MULLO_MUL_N_THRESHOLD            12322
+#define MULLO_MUL_N_THRESHOLD            11616
 
-#define DC_DIV_QR_THRESHOLD                 55
-#define DC_DIVAPPR_Q_THRESHOLD             220
-#define DC_BDIV_QR_THRESHOLD                92
-#define DC_BDIV_Q_THRESHOLD                252
+#define DC_DIV_QR_THRESHOLD                 61
+#define DC_DIVAPPR_Q_THRESHOLD             222
+#define DC_BDIV_QR_THRESHOLD                95
+#define DC_BDIV_Q_THRESHOLD                264
 
-#define INV_MULMOD_BNM1_THRESHOLD           70
-#define INV_NEWTON_THRESHOLD               156
-#define INV_APPR_THRESHOLD                 154
+#define INV_MULMOD_BNM1_THRESHOLD           78
+#define INV_NEWTON_THRESHOLD               133
+#define INV_APPR_THRESHOLD                 141
 
 #define BINV_NEWTON_THRESHOLD              248
 #define REDC_1_TO_REDC_2_THRESHOLD           0  /* always */
-#define REDC_2_TO_REDC_N_THRESHOLD         149
+#define REDC_2_TO_REDC_N_THRESHOLD         148
 
-#define MU_DIV_QR_THRESHOLD               1142
+#define MU_DIV_QR_THRESHOLD               1187
 #define MU_DIVAPPR_Q_THRESHOLD            1142
 #define MUPI_DIV_QR_THRESHOLD                0  /* always */
-#define MU_BDIV_QR_THRESHOLD              1142
+#define MU_BDIV_QR_THRESHOLD              1308
 #define MU_BDIV_Q_THRESHOLD               1470
 
-#define POWM_SEC_TABLE  2,29,298,1897
+#define POWM_SEC_TABLE  1,28,251,1925
 
-#define MATRIX22_STRASSEN_THRESHOLD         19
-#define HGCD_THRESHOLD                     115
-#define HGCD_APPR_THRESHOLD                181
-#define HGCD_REDUCE_THRESHOLD             3014
-#define GCD_DC_THRESHOLD                   555
-#define GCDEXT_DC_THRESHOLD                368
+#define MATRIX22_STRASSEN_THRESHOLD         23
+#define HGCD_THRESHOLD                     120
+#define HGCD_APPR_THRESHOLD                 77
+#define HGCD_REDUCE_THRESHOLD             3389
+#define GCD_DC_THRESHOLD                   393
+#define GCDEXT_DC_THRESHOLD                440
 #define JACOBI_BASE_METHOD                   4
 
-#define GET_STR_DC_THRESHOLD                13
-#define GET_STR_PRECOMPUTE_THRESHOLD        21
+#define GET_STR_DC_THRESHOLD                14
+#define GET_STR_PRECOMPUTE_THRESHOLD        20
 #define SET_STR_DC_THRESHOLD              1216
 #define SET_STR_PRECOMPUTE_THRESHOLD      3170
 
index e838800ceebe930162aaa3ab6dd26afb3fc67c6e..477df4cd7183bc362f9fb1c140f3014a34867e49 100644 (file)
@@ -2,22 +2,33 @@ dnl  IA-64 mpn_hamdist -- mpn hamming distance.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
+dnl  Copyright 2003-2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 419adc437baf04ff030f89c082f06f5b4f869e3c..f71d280b179bc2ee59fe1ee9e62390045d39dfaa 100644 (file)
@@ -2,21 +2,32 @@ divert(-1)
 
 
 dnl  Copyright 2000, 2002, 2003 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  ia64 assembler comments are C++ style "//" to the end of line.  gas
@@ -88,7 +99,7 @@ m4_assert_defined(`IA64_ALIGN_OK')
 
 dnl  Usage: ASSERT([pr] [,code])
 dnl
-dnl  Require that the given predictate register is true after executing the
+dnl  Require that the given predicate register is true after executing the
 dnl  test code.  For example,
 dnl
 dnl         ASSERT(p6,
index 976a89c3dd8bed948421bdabe16fdcc7ba9e9b48..5effdda815c836eff9ecc6032c2dcf6654a95c04 100644 (file)
@@ -5,19 +5,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund and Kevin Ryde.
 dnl  Copyright 2000, 2002, 2004 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 5e69f3ba78ac29babe0befc26c3d3781f38ecea6..e4a2f61cce5158e03e565e215eb053ad17662f26 100644 (file)
@@ -3,22 +3,33 @@ dnl  mpn_nior_n, mpn_xor_n, mpn_xnor_n -- mpn bitwise logical operations.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2003-2005 Free Software Foundation, Inc.
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
@@ -80,6 +91,8 @@ ifdef(`HAVE_ABI_32',
 `      addp4   rp = 0, rp                      C                       M I
        addp4   up = 0, up                      C                       M I
        addp4   vp = 0, vp                      C                       M I
+       nop.m           0
+       nop.m           0
        zxt4    n = n                           C                       I
        ;;
 ')
index 80167acc3170a6050678e2ddc23a55f774d3267e..694aaf0f400f5877ef748988abf91cba9f3920f2 100644 (file)
@@ -2,23 +2,33 @@ dnl  IA-64 mpn_lshift/mpn_rshift.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 2000-2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -74,6 +84,8 @@ ifdef(`HAVE_ABI_32',
 `      addp4   rp = 0, rp              C                       M I
        addp4   up = 0, up              C               M I
        sxt4    n = n                   C               M I
+       nop.m           0
+       nop.m           0
        zxt4    cnt = cnt               C               I
        ;;
 ')
index 2cf19002f3d2f5b6e55b8fa5d4f98516985c266e..c4024864846c9d53ed320728ca127d94de9ac394 100644 (file)
@@ -2,23 +2,33 @@ dnl  IA-64 mpn_lshiftc.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2010 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2000-2005, 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -62,6 +72,8 @@ ifdef(`HAVE_ABI_32',
 `      addp4   rp = 0, rp              C                               M I
        addp4   up = 0, up              C                               M I
        sxt4    n = n                   C                               M I
+       nop.m           0
+       nop.m           0
        zxt4    cnt = cnt               C                               I
        ;;
 ')
index 9f181ca0967dd04bed39a289b4fbcae5304f9d23..edf3602c4c09d9e1f130cc645ed7f77a7e09d5b2 100644 (file)
@@ -2,22 +2,33 @@ dnl  IA-64 mpn_mod_34lsub1
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2003, 2004, 2005, 2010 Free Software Foundation, Inc.
+dnl  Copyright 2003-2005, 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -59,6 +70,7 @@ PROLOGUE(mpn_mod_34lsub1)
        .body
 ifdef(`HAVE_ABI_32',`
        addp4           up = 0, up              C                       M I
+       nop.m           0
        zxt4            n = n                   C                       I
        ;;
 ')
index 16ca97368a04f6b332b87a1c8d530da8a2d4ce08..14d5e81602902fdf336cb1dfb4ca3aba70626d62 100644 (file)
@@ -2,22 +2,33 @@ dnl  Itanium-2 mpn_modexact_1c_odd -- mpn by 1 exact remainder.
 
 dnl  Contributed to the GNU project by Kevin Ryde.
 
-dnl  Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2003-2005 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index f020ae1ea16c3271351250ba26df1706f3eac984..21bf6d0e14f3e99a413ead7ba40c80278f28da13 100644 (file)
@@ -3,23 +3,33 @@ dnl  store the result in a second limb vector.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2000, 2001, 2002, 2003, 2004, 2006, 2007 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2000-2004, 2006, 2007 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index a0abdac02fe9d5d7b68e870db6ff5047f3fadcaf..2bbce972673f4cd0414579f875c5233b5a2ba886 100644 (file)
@@ -6,19 +6,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund.
 dnl  Copyright 2004, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -109,7 +120,7 @@ ifdef(`HAVE_ABI_32',`
        ;;
 .mmi;          ldf8    uy = [up], 8            C                       M
                ldf8    v1 = [vp]               C                       M
-               shr.u   n = n, 2                C                       I
+               shr.u   n = n, 2                C                       I0
 .mmi;          nop     1                       C                       M
                cmp.eq  p10, p0 = 1, r14        C                       M I
                cmp.eq  p11, p0 = 2, r14        C                       M I
index fc2f4b91621c50e79b15f102855ea2eaa096065d..c0b5c5c1cfa09ab4aaad734b8c900ca7fe7f716a 100644 (file)
@@ -2,23 +2,33 @@ dnl  IA-64 mpn_popcount -- mpn population count.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 2000-2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -40,6 +50,7 @@ PROLOGUE(mpn_popcount)
        .prologue
 ifdef(`HAVE_ABI_32',
 `      addp4           up = 0, up              C                       M I
+       nop.m           0
        zxt4            n = n                   C                       I
        ;;
 ')
index d7531178b6533bbdc7424928fbf8c2514668f94d..3c7defb0baeb493330eb37f09193745bc84a0017 100644 (file)
@@ -2,22 +2,33 @@ dnl  IA-64 mpn_rsh1add_n/mpn_rsh1sub_n -- rp[] = (up[] +- vp[]) >> 1.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
+dnl  Copyright 2003-2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -67,6 +78,8 @@ ifdef(`HAVE_ABI_32',`
        addp4           rp = 0, rp              C                       M I
        addp4           up = 0, up              C                       M I
        addp4           vp = 0, vp              C                       M I
+       nop.m           0
+       nop.m           0
        zxt4            n = n                   C                       I
        ;;
 ')
diff --git a/mpn/ia64/sec_tabselect.asm b/mpn/ia64/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..f116ea3
--- /dev/null
@@ -0,0 +1,150 @@
+dnl  IA-64 mpn_sec_tabselect.
+
+dnl  Copyright 2011 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 Itanium:       ?
+C Itanium 2:     2.5
+
+C NOTES
+C  * Using software pipelining could trivially yield 2 c/l without unrolling,
+C    or 1+epsilon with unrolling.  (This code was modelled after the powerpc64
+C    code, for simplicity.)
+
+C mpn_sec_tabselect (mp_limb_t *rp, mp_limb_t *tp, mp_size_t n, mp_size_t nents, mp_size_t which)
+define(`rp',     `r32')
+define(`tp',     `r33')
+define(`n',      `r34')
+define(`nents',  `r35')
+define(`which',  `r36')
+
+define(`mask',   `r8')
+
+define(`rp1',     `r32')
+define(`tp1',     `r33')
+define(`rp2',     `r14')
+define(`tp2',     `r15')
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_sec_tabselect)
+       .prologue
+       .save   ar.lc, r2
+       .body
+ifdef(`HAVE_ABI_32',`
+.mmi;  addp4   rp = 0, rp              C                       M I
+       addp4   tp = 0, tp              C                       M I
+       zxt4    n = n                   C                       I
+.mii;  nop     0
+       zxt4    nents = nents           C                       I
+       zxt4    which = which           C                       I
+       ;;
+')
+.mmi;  add     rp2 = 8, rp1
+       add     tp2 = 8, tp1
+       add     r6 = -2, n
+       ;;
+.mmi;  cmp.eq  p10, p0 = 1, n
+       and     r9 = 1, n               C set cr0 for use in inner loop
+       shr.u   r6 = r6, 1              C inner loop count
+       ;;
+.mmi;  cmp.eq  p8, p0 = 0, r9
+       sub     which = nents, which
+       shl     n = n, 3
+       ;;
+
+L(outer):
+.mmi   cmp.eq  p6, p7 = which, nents   C are we at the selected table entry?
+       nop     0
+       mov     ar.lc = r6              C                       I0
+       ;;
+.mmb;
+  (p6) mov     mask = -1
+  (p7) mov     mask = 0
+  (p8) br.dptk L(top)                  C branch to loop entry if n even
+       ;;
+
+.mmi;  ld8     r16 = [tp1], 8
+       add     tp2 = 8, tp2
+       nop     0
+       ;;
+.mmi;  ld8     r18 = [rp1]
+       and     r16 = r16, mask
+       nop     0
+       ;;
+.mmi;  andcm   r18 = r18, mask
+       ;;
+       or      r16 = r16, r18
+       nop     0
+       ;;
+.mmb;  st8     [rp1] = r16, 8
+       add     rp2 = 8, rp2
+  (p10)        br.dpnt L(end)
+
+       ALIGN(32)
+L(top):
+.mmi;  ld8     r16 = [tp1], 16
+       ld8     r17 = [tp2], 16
+       nop     0
+       ;;
+.mmi;  ld8     r18 = [rp1]
+       and     r16 = r16, mask
+       nop     0
+.mmi;  ld8     r19 = [rp2]
+       and     r17 = r17, mask
+       nop     0
+       ;;
+.mmi;  andcm   r18 = r18, mask
+       andcm   r19 = r19, mask
+       nop     0
+       ;;
+.mmi;  or      r16 = r16, r18
+       or      r17 = r17, r19
+       nop     0
+       ;;
+.mmb;  st8     [rp1] = r16, 16
+       st8     [rp2] = r17, 16
+       br.cloop.dptk   L(top)
+       ;;
+L(end):
+.mmi;  sub     rp1 = rp1, n            C move rp back to beginning
+       sub     rp2 = rp2, n            C move rp back to beginning
+       cmp.ne  p9, p0 = 1, nents
+.mmb;  add     nents = -1, nents
+       nop     0
+  (p9) br.dptk L(outer)
+       ;;
+
+.mib;  nop     0
+       nop     0
+       br.ret.sptk.many b0
+EPILOGUE()
index 591945a156886322ddcd29144ac7eaadcf75da0c..f9288298b36ce024d84a7e1afbe60e20f3707de5 100644 (file)
@@ -5,19 +5,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund.
 dnl  Copyright 2010, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 2cb7c680aaf91d59f7ee9ff53abd4c4f8010d74a..cb2a5525b5ab4379d7717f0067a64da4a75bc96d 100644 (file)
@@ -3,22 +3,33 @@ dnl  result from a second limb vector.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+dnl  Copyright 2000-2004 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/ia64/tabselect.asm b/mpn/ia64/tabselect.asm
deleted file mode 100644 (file)
index cc5b49b..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-dnl  IA-64 mpn_tabselect.
-
-dnl  Copyright 2011 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 Itanium:       ?
-C Itanium 2:     2.5
-
-C NOTES
-C  * Using software pipelining could trivially yield 2 c/l without unrolling,
-C    or 1+epsilon with unrolling.  (This code was modelled after the powerpc64
-C    code, for simplicity.)
-
-C mpn_tabselect (mp_limb_t *rp, mp_limb_t *tp, mp_size_t n, mp_size_t nents, mp_size_t which)
-define(`rp',     `r32')
-define(`tp',     `r33')
-define(`n',      `r34')
-define(`nents',  `r35')
-define(`which',  `r36')
-
-define(`mask',   `r8')
-
-define(`rp1',     `r32')
-define(`tp1',     `r33')
-define(`rp2',     `r14')
-define(`tp2',     `r15')
-
-ASM_START()
-       TEXT
-       ALIGN(16)
-PROLOGUE(mpn_tabselect)
-       .prologue
-       .save   ar.lc, r2
-       .body
-ifdef(`HAVE_ABI_32',`
-.mmi;  addp4   rp = 0, rp              C                       M I
-       addp4   tp = 0, tp              C                       M I
-       zxt4    n = n                   C                       I
-.mii;  nop     0
-       zxt4    nents = nents           C                       I
-       zxt4    which = which           C                       I
-       ;;
-')
-.mmi;  add     rp2 = 8, rp1
-       add     tp2 = 8, tp1
-       add     r6 = -2, n
-       ;;
-.mmi;  cmp.eq  p10, p0 = 1, n
-       and     r9 = 1, n               C set cr0 for use in inner loop
-       shr.u   r6 = r6, 1              C inner loop count
-       ;;
-.mmi;  cmp.eq  p8, p0 = 0, r9
-       sub     which = nents, which
-       shl     n = n, 3
-       ;;
-
-L(outer):
-.mmi   cmp.eq  p6, p7 = which, nents   C are we at the selected table entry?
-       nop     0
-       mov     ar.lc = r6              C                       I0
-       ;;
-.mmb;
-  (p6) mov     mask = -1
-  (p7) mov     mask = 0
-  (p8) br.dptk L(top)                  C branch to loop entry if n even
-       ;;
-
-.mmi;  ld8     r16 = [tp1], 8
-       add     tp2 = 8, tp2
-       nop     0
-       ;;
-.mmi;  ld8     r18 = [rp1]
-       and     r16 = r16, mask
-       nop     0
-       ;;
-.mmi;  andcm   r18 = r18, mask
-       ;;
-       or      r16 = r16, r18
-       nop     0
-       ;;
-.mmb;  st8     [rp1] = r16, 8
-       add     rp2 = 8, rp2
-  (p10)        br.dpnt L(end)
-
-       ALIGN(32)
-L(top):
-.mmi;  ld8     r16 = [tp1], 16
-       ld8     r17 = [tp2], 16
-       nop     0
-       ;;
-.mmi;  ld8     r18 = [rp1]
-       and     r16 = r16, mask
-       nop     0
-.mmi;  ld8     r19 = [rp2]
-       and     r17 = r17, mask
-       nop     0
-       ;;
-.mmi;  andcm   r18 = r18, mask
-       andcm   r19 = r19, mask
-       nop     0
-       ;;
-.mmi;  or      r16 = r16, r18
-       or      r17 = r17, r19
-       nop     0
-       ;;
-.mmb;  st8     [rp1] = r16, 16
-       st8     [rp2] = r17, 16
-       br.cloop.dptk   L(top)
-       ;;
-L(end):
-.mmi;  sub     rp1 = rp1, n            C move rp back to beginning
-       sub     rp2 = rp2, n            C move rp back to beginning
-       cmp.ne  p9, p0 = 1, nents
-.mmb;  add     nents = -1, nents
-       nop     0
-  (p9) br.dptk L(outer)
-       ;;
-
-.mib;  nop     0
-       nop     0
-       br.ret.sptk.many b0
-EPILOGUE()
index 31a9b48cbe3474dfb700adc4439b26df303d2309..06b74bd6ce7eca120706f33a8f4fd5fd77f51b07 100644 (file)
@@ -1,22 +1,33 @@
 ;;; gmpasm-mode.el -- GNU MP asm and m4 editing mode.
 
 
-;; Copyright 1999, 2000, 2001, 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 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.
-;;
-;; 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 Lesser General Public
-;; License for more details.
-;;
-;; You should have received a copy of the GNU Lesser General Public License
-;; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+;; 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/.
 
 
 ;;; Commentary:
index 984e8e9b0eaeb1428af617505d65c237ae321beb..16d80c6f51bdba6ee1c0500eb6c78243feca21ab 100755 (executable)
@@ -4,20 +4,31 @@
 
 # Copyright 2001 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 # Usage: m4-ccas --m4=M4 CC ... file.asm ...
index 8838f8d41f288fea25e4408b326800027c750e4f..5261564df2bd82ebd160f882c476370de8da825f 100644 (file)
@@ -3,17 +3,28 @@ Copyright 2001, 2003, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index da9bb415b2e98f719fde864bdfd901247d4f9b7d..f7d379ec013a5ba1128c4327e7f380f569e7df67 100644 (file)
@@ -1,22 +1,32 @@
 dnl  mc68020 mpn_add_n, mpn_sub_n -- add or subtract limb vectors
 
-dnl  Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002, 2003, 2005 Free
-dnl  Software Foundation, Inc.
-dnl
+dnl  Copyright 1992, 1994, 1996, 1999-2003, 2005 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 21b817ed41ca15fc1b15686a9cba8b310e875bd8..9ac7b4101971f9c3d1be513df3b56d9edc43da08 100644 (file)
@@ -1,25 +1,36 @@
 /* gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright 2000-2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 
 /* 25MHz 68040 */
index 9d7a5ed0f6ef3e82ddc1038c79ed7696a0434549..f202abfe434824f41098f31f5ac83030bdce0464 100644 (file)
@@ -1,22 +1,32 @@
 dnl  mc68020 mpn_lshift -- mpn left shift.
 
-dnl  Copyright 1996, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
-dnl  Inc.
-dnl
+dnl  Copyright 1996, 1999-2003 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
@@ -104,14 +114,14 @@ ifelse(scale_available_p,1,`
        bcs     L(L1)
        subql   #1, s_size
 
-L(Loop:)
+L(Loop):
        movel   M(-,s_ptr), d2
        movel   d2, d3
        lsrl    d5, d3
        orl     d3, d1
        movel   d1, M(-,res_ptr)
        lsll    cnt, d2
-L(L1:)
+L(L1):
        movel   M(-,s_ptr), d1
        movel   d1, d3
        lsrl    d5, d3
@@ -123,7 +133,7 @@ L(L1:)
        subl    #0x10000, s_size
        bcc     L(Loop)
 
-L(Lend:)
+L(Lend):
        movel   d1, M(-,res_ptr)        C store least significant limb
 
 C Restore used registers from stack frame.
index 17a345998a1d8e0f6ccf3511ce1b3e53f98e751c..15289f676fc63762daf210fcfcbaa76985917285 100644 (file)
@@ -2,22 +2,33 @@ divert(-1)
 
 dnl  m4 macros for 68k assembler.
 
-dnl  Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2001-2003 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  The default m4 `#' commenting interferes with the assembler syntax for
index 521c36c0c26126212a31f2f084cab594c2fd4237..4ee30ad9b3086c0d58fb49596f7ada945b50eba8 100644 (file)
@@ -1,22 +1,32 @@
 dnl  mc68020 mpn_addmul_1, mpn_submul_1 -- add or subtract mpn multiple.
 
-dnl  Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002, 2011 Free Software
-dnl  Foundation, Inc.
-dnl
+dnl  Copyright 1992, 1994, 1996, 1999-2002, 2011 Free Software Foundation, Inc.
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index d24f6d1d9ad9550a325a40279c836c3e09f1fac7..f5fbb3063b67b60fc68114b9e1f02589b5ac6850 100644 (file)
@@ -1,22 +1,32 @@
 dnl  mc68020 mpn_mul_1 -- mpn by limb multiply
 
-dnl  Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002 Free Software
-dnl  Foundation, Inc.
-dnl
+dnl  Copyright 1992, 1994, 1996, 1999-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index ebc1ef26db28c5fb15bcd16809ff15a1d81212ef..aadeab999ae5e6c766c12721d5b2767dfa4ad2a1 100644 (file)
@@ -1,21 +1,32 @@
 dnl  mc68020 mpn_udiv_qrnnd -- 2x1 limb division
 
-dnl  Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2001 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 4d6e8a8eb89370805a0c7c38ef5d7ccc102da37a..f19314e9bbbef7b20a19d0c19bbdd9360603979f 100644 (file)
@@ -1,21 +1,32 @@
 dnl  mc68020 mpn_umul_ppmm -- limb by limb multiplication
 
-dnl  Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2001 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 1bf58ac310e4658c8ac1f403cd5e1512c019489e..21b5f89f48376569b8755dd45463d8d044b41d88 100644 (file)
@@ -1,22 +1,32 @@
 dnl  mc68020 mpn_rshift -- mpn right shift.
 
-dnl  Copyright 1996, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
-dnl  Inc.
-dnl
+dnl  Copyright 1996, 1999-2003 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
@@ -79,7 +89,7 @@ ifelse(scale_available_p,1,`
        cmpl    s_ptr, a2
        bls     L(Lspecial)             C jump if s_ptr >= res_ptr + s_size
 
-L(Lnormal:)
+L(Lnormal):
        moveql  #32, d5
        subl    cnt, d5
        movel   M(s_ptr,+), d2
@@ -94,14 +104,14 @@ L(Lnormal:)
        bcs     L(L1)
        subql   #1, s_size
 
-L(Loop:)
+L(Loop):
        movel   M(s_ptr,+), d2
        movel   d2, d3
        lsll    d5, d3
        orl     d3, d1
        movel   d1, M(res_ptr,+)
        lsrl    cnt, d2
-L(L1:)
+L(L1):
        movel   M(s_ptr,+), d1
        movel   d1, d3
        lsll    d5, d3
@@ -113,7 +123,7 @@ L(L1:)
        subl    #0x10000, s_size
        bcc     L(Loop)
 
-L(Lend:)
+L(Lend):
        movel   d1, M(res_ptr)  C store most significant limb
 
 C Restore used registers from stack frame.
@@ -124,7 +134,7 @@ C We loop from most significant end of the arrays, which is only permissable
 C if the source and destination don't overlap, since the function is
 C documented to work for overlapping source and destination.
 
-L(Lspecial:)
+L(Lspecial):
 ifelse(scale_available_p,1,`
        lea     M(s_ptr,s_size,l,4), s_ptr
        lea     M(res_ptr,s_size,l,4), res_ptr
@@ -141,11 +151,11 @@ ifelse(scale_available_p,1,`
        bcc     L(LL1)
        subql   #1, s_size
 
-L(LLoop:)
+L(LLoop):
        movel   M(-,s_ptr), d2
        roxrl   #1, d2
        movel   d2, M(-,res_ptr)
-L(LL1:)
+L(LL1):
        movel   M(-,s_ptr), d2
        roxrl   #1, d2
        movel   d2, M(-,res_ptr)
@@ -157,7 +167,7 @@ L(LL1:)
        addl    d0, d0          C restore cy
        bra     L(LLoop)
 
-L(LLend:)
+L(LLend):
 C Restore used registers from stack frame.
        moveml  M(sp,+), d2-d6/a2
        rts
index 226afc54492a207d5435288de7c26ba3c817f297..91c21fa1f8ad987fd53ab5712d78eb1646bfe43d 100644 (file)
@@ -2,20 +2,31 @@
 
 # Copyright 2001, 2003 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 # Usage:  perl t-m68k-defs.pl [-t]
index 046e3bf19a6d5dcc3fb19493a40f18b5ae784773..1b51e83079e9794014c217c218878f8657fefd0b 100644 (file)
@@ -3,17 +3,28 @@ Copyright 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index db2fffff3ed0256089295b0482047fda040957d1..dbdb22f8888087739059e89ae4c918f083e686cc 100644 (file)
@@ -3,20 +3,31 @@
 
 ; Copyright 1992, 1994, 1995, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+;  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/.
 
 
 ; INPUT PARAMETERS
index 3b627c01a7075cc5f9889cf19c95934a6ed7de99..c3b12b3cd05a9e0175d0894d4504da562b3f0495 100644 (file)
@@ -3,20 +3,31 @@
 
 ; Copyright 1995, 1996, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+;  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/.
 
 
 ; INPUT PARAMETERS
index f41283395d29a8e4884acd2e3d88a9f083cfefda..321221f23ca04c19032a3825748911b929ae93b0 100644 (file)
@@ -3,20 +3,31 @@
 
 ; Copyright 1996, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+;  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/.
 
 
 ; INPUT PARAMETERS
index e8e88790a7bcca918f3e68bfcbcd12cce02a8d8b..28fd14b77b157182d0d0fd06201e511d148bd481 100644 (file)
@@ -3,20 +3,31 @@
 
 ; Copyright 1992, 1994, 1995, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+;  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/.
 
 
 ; INPUT PARAMETERS
index a21a2cc0c03219304b2ade770cf5a4a496a97500..f0a8ecb3f06655cb754a1add602018bc21cbb20e 100644 (file)
@@ -3,20 +3,31 @@
 
 ; Copyright 1995, 1996, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+;  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/.
 
 
 ; INPUT PARAMETERS
index 5c385bd3518bee1b868661c232d0c3950c3e13ff..c8abdc0b7f4947279c85715698daf85ae1a04195 100644 (file)
@@ -3,20 +3,31 @@
 
 ; Copyright 1992, 1994, 1995, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+;  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/.
 
 
 ; INPUT PARAMETERS
index 9ea78ff3a1985464fcc5a34e362c4b4690162475..2bd8f09ca3df29d3d62fe2960531c550de903f9b 100644 (file)
@@ -3,20 +3,31 @@
 
 ; Copyright 1992, 1994, 1996, 2000 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 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.
-
-; 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 Lesser General Public
-; License for more details.
-
-; You should have received a copy of the GNU Lesser General Public License
-; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+;  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/.
 
 
 ; INPUT PARAMETERS
index 9f22ed9d24a274b82bf931b7b050d693e3f44257..1b8f31151603e225366bc38b6c9196f6c60dce1b 100644 (file)
@@ -1,22 +1,33 @@
 /* Minimal values gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2006, 2008, 2009, 2010, 2012 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000, 2006, 2008-2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* The values in this file are not currently minimal.
    Trimming them further would be good.  */
index f7dc7efab9712afa6861152e726f3192f2941552..e7d4c48f48027a1287c1774103e403cc60f9484d 100644 (file)
@@ -4,19 +4,30 @@ dnl  sum in a third limb vector.
 dnl  Copyright 1995, 2000, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index f43e3c638be37b35f777095282a406ec4f793fd9..9aa9e163ce846b158d171886fd4f154b38441482 100644 (file)
@@ -4,19 +4,30 @@ dnl  the product to a second limb vector.
 dnl  Copyright 1992, 1994, 1996, 2000, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index a8f27326cd6107b32768e580a89f6f0d1092d77e..986135df9642cd1538b5240372ffa0be7502597b 100644 (file)
@@ -1,26 +1,36 @@
 /* gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 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 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.
+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 Lesser General Public License
+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 a copy of the GNU Lesser General Public License along
-with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 
 /* Generated by tuneup.c, 2002-02-20, gcc 2.95 (R3000) */
index 8a27951775414824c3229685a124e9ff5d2fa3b8..6a58bb4579bd5d9a8828ec46c58d2b0b66c56de8 100644 (file)
@@ -3,19 +3,30 @@ dnl  MIPS32 mpn_lshift -- Left shift.
 dnl  Copyright 1995, 2000, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index a30e8df090572e196210cc1a75124c532c2a45e3..5fa89eca35d8fd15d8333c0e0234e68f47b2f0f5 100644 (file)
@@ -3,22 +3,33 @@ divert(-1)
 dnl  m4 macros for MIPS assembly code (both 32-bit and 64-bit).
 
 
-dnl  Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+dnl  Copyright 2000-2002 Free Software Foundation, Inc.
 dnl
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  Usage: ASM_START()
index 37c6ca8f7227b79e70c3e970d71665b46cdb395d..8b49e575e412b8c01469a8fc03eabcc600f9415a 100644 (file)
@@ -3,22 +3,33 @@ divert(-1)
 dnl  m4 macros for MIPS assembly code.
 
 
-dnl  Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+dnl  Copyright 2000-2002 Free Software Foundation, Inc.
 dnl
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  Usage: ASM_START()
index 1e1a275f66c6140dc680e93a9f6023c32b26c2df..4337bc2bd40405bd1062db9613f5c4a75dc820d9 100644 (file)
@@ -4,19 +4,30 @@ dnl  the product in a second limb vector.
 dnl  Copyright 1992, 1994, 1996, 2000, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 23d1e780e639d0865a8fe1f2d79d7f0ce5c25ebc..4b54510408f5e87c2d4e1a3fec62f748aa6d14b0 100644 (file)
@@ -3,19 +3,30 @@ dnl  MIPS32 mpn_rshift -- Right shift.
 dnl  Copyright 1995, 2000, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index ed41271676c73e2173154372e4491b7e4e56e974..a962ce1b79dfcda3d86b120469c1d4cddeca2ab9 100644 (file)
@@ -4,19 +4,30 @@ dnl  store difference in a third limb vector.
 dnl  Copyright 1995, 2000, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 4e43654e0a025ec95819bfd529dab86832e4c379..335722b4e5747faad887213acac8512ba1138fad 100644 (file)
@@ -4,19 +4,30 @@ dnl  subtract the product from a second limb vector.
 dnl  Copyright 1992, 1994, 1996, 2000, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 04ecbe509536e3da631759b522c52edbfe2e3b2d..1ced0eb883e2e6ab490464837feb72d28fe36f97 100644 (file)
@@ -3,19 +3,30 @@ dnl  MIPS32 umul_ppmm -- longlong.h support.
 dnl  Copyright 1999, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 65a1af16682477259676b54a6823b36e1e6131d3..7ddd0e572c704805a175ef77c2c7b11d104e2c60 100644 (file)
@@ -3,17 +3,28 @@ Copyright 1996 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
@@ -30,7 +41,7 @@ RELEVANT OPTIMIZATION ISSUES
 
    On the R4600, branches takes a single cycle
 
-   On the R8000, branches often take no noticable cycles, as they are
+   On the R8000, branches often take no noticeable cycles, as they are
    executed in a separate function unit..
 
 2. The R4000 and R4400 have a load latency of 4 cycles.
index d6cdf9370544cfbc9e45c3055a9fd1a9bb8a5cf3..6856407efdb85722f897d1066e0d64fc82d23309 100644 (file)
@@ -1,22 +1,33 @@
 dnl  MIPS64 mpn_add_n -- Add two limb vectors of the same length > 0 and store
 dnl  sum in a third limb vector.
 
-dnl  Copyright 1995, 2000, 2001, 2002, 2011 Free Software Foundation, Inc.
+dnl  Copyright 1995, 2000-2002, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index a116298a765efeeb9934b583011b317066bac4b5..8ff0976e2523f3a719a8fd52d092b7f7133dfb97 100644 (file)
@@ -1,23 +1,33 @@
 dnl  MIPS64 mpn_addmul_1 -- Multiply a limb vector with a single limb and add
 dnl  the product to a second limb vector.
 
-dnl  Copyright 1992, 1994, 1995, 2000, 2001, 2002 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 1992, 1994, 1995, 2000-2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 2bf942431d8960daa18e45cac65974f64b395376..b7fcf24a4136cf2f475035b3c9d68018466b6af7 100644 (file)
@@ -1,26 +1,36 @@
 /* gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2004 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 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.
+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 Lesser General Public License
+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 a copy of the GNU Lesser General Public License along
-with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 
 /* Generated by tuneup.c, 2004-02-10, gcc 3.2 & MIPSpro C 7.2.1 (R1x000) */
index 16da93c5ab1c87580ff66385f5e81a51b97806a7..3440eaf80b5b62200f602d11b70434f1d8124ca8 100644 (file)
@@ -1,21 +1,32 @@
 dnl  MIPS64 mpn_lshift -- Left shift.
 
-dnl  Copyright 1995, 2000, 2001, 2002 Free Software Foundation, Inc.
+dnl  Copyright 1995, 2000-2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d16e08d594ecb4d15e504af83ff8ce5a40bf84cc..77acf0ac2576901b0936e0986611650c831e704f 100644 (file)
@@ -1,23 +1,33 @@
 dnl  MIPS64 mpn_mul_1 -- Multiply a limb vector with a single limb and store
 dnl  the product in a second limb vector.
 
-dnl  Copyright 1992, 1994, 1995, 2000, 2001, 2002 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 1992, 1994, 1995, 2000-2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 52948756212621cde0fadcc8fdcd4174f145417e..9253cb51d8548c6b6f40a3a42498d34dbfbd8ad7 100644 (file)
@@ -1,21 +1,32 @@
 dnl  MIPS64 mpn_rshift -- Right shift.
 
-dnl  Copyright 1995, 2000, 2001, 2002 Free Software Foundation, Inc.
+dnl  Copyright 1995, 2000-2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 511a7552c9f01830ebea8b45b9ea9383220541f7..dcb87dc21f1361dda15aab77c9801a0504a68241 100644 (file)
@@ -3,19 +3,30 @@ dnl  MIPS64 mpn_sqr_diagonal.
 dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  INPUT PARAMETERS
index 1419cbfd1dde2c5c4bd0fb8547a90b9088ba7149..6a698976ebab601a5e136dd35786aebcb7084397 100644 (file)
@@ -1,22 +1,33 @@
 dnl  MIPS64 mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
 dnl  store difference in a third limb vector.
 
-dnl  Copyright 1995, 2000, 2001, 2002, 2011 Free Software Foundation, Inc.
+dnl  Copyright 1995, 2000-2002, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 11e17370c07f4ef63f9275943a99f8560fed29b8..089589cd736d402e670060993e052235297cff1d 100644 (file)
@@ -1,23 +1,33 @@
 dnl  MIPS64 mpn_submul_1 -- Multiply a limb vector with a single limb and
 dnl  subtract the product from a second limb vector.
 
-dnl  Copyright 1992, 1994, 1995, 2000, 2001, 2002 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 1992, 1994, 1995, 2000-2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 1792d97fdb88338a7d2ae4c3c00773ee40f76ada..b9aac575912dd9a73e377b8bf52cb0fabebe84a4 100644 (file)
@@ -3,19 +3,30 @@ dnl  MIPS64 umul_ppmm -- longlong.h support.
 dnl  Copyright 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/ns32k/add_n.s b/mpn/ns32k/add_n.s
deleted file mode 100644 (file)
index 962cc16..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# ns32000 __gmpn_add_n -- Add two limb vectors of the same length > 0 and store
-# sum in a third limb vector.
-
-# Copyright 1992, 1994, 2000 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 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.
-
-# 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 Lesser General Public
-# License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-       .align 1
-.globl ___gmpn_add_n
-___gmpn_add_n:
-       save    [r3,r4,r5]
-       negd    28(sp),r3
-       movd    r3,r0
-       lshd    2,r0
-       movd    24(sp),r4
-       subd    r0,r4                   # r4 -> to end of S2
-       movd    20(sp),r5
-       subd    r0,r5                   # r5 -> to end of S1
-       movd    16(sp),r2
-       subd    r0,r2                   # r2 -> to end of RES
-       subd    r0,r0                   # cy = 0
-
-Loop:  movd    r5[r3:d],r0
-       addcd   r4[r3:d],r0
-       movd    r0,r2[r3:d]
-       acbd    1,r3,Loop
-
-       scsd    r0                      # r0 = cy.
-       restore [r5,r4,r3]
-       ret     0
diff --git a/mpn/ns32k/addmul_1.s b/mpn/ns32k/addmul_1.s
deleted file mode 100644 (file)
index 1dd8791..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# ns32000 __gmpn_addmul_1 -- Multiply a limb vector with a limb and add
-# the result to a second limb vector.
-
-# Copyright 1992, 1994, 2000 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 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.
-
-# 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 Lesser General Public
-# License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-       .align 1
-.globl ___gmpn_addmul_1
-___gmpn_addmul_1:
-       save    [r3,r4,r5,r6,r7]
-       negd    24(sp),r4
-       movd    r4,r0
-       lshd    2,r0
-       movd    20(sp),r5
-       subd    r0,r5                   # r5 -> to end of S1
-       movd    16(sp),r6
-       subd    r0,r6                   # r6 -> to end of RES
-       subd    r0,r0                   # r0 = 0, cy = 0
-       movd    28(sp),r7               # r7 = s2_limb
-
-Loop:  movd    r5[r4:d],r2
-       meid    r7,r2                   # r2 = low_prod, r3 = high_prod
-       addcd   r0,r2                   # r2 = low_prod + cy_limb
-       movd    r3,r0                   # r0 = new cy_limb
-       addcd   0,r0
-       addd    r2,r6[r4:d]
-       acbd    1,r4,Loop
-
-       addcd   0,r0
-       restore [r7,r6,r5,r4,r3]
-       ret     0
diff --git a/mpn/ns32k/mul_1.s b/mpn/ns32k/mul_1.s
deleted file mode 100644 (file)
index abc911e..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# ns32000 __gmpn_mul_1 -- Multiply a limb vector with a limb and store
-# the result in a second limb vector.
-
-# Copyright 1992, 1994, 2000 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 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.
-
-# 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 Lesser General Public
-# License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-       .align 1
-.globl ___gmpn_mul_1
-___gmpn_mul_1:
-       save    [r3,r4,r5,r6,r7]
-       negd    24(sp),r4
-       movd    r4,r0
-       lshd    2,r0
-       movd    20(sp),r5
-       subd    r0,r5                   # r5 -> to end of S1
-       movd    16(sp),r6
-       subd    r0,r6                   # r6 -> to end of RES
-       subd    r0,r0                   # r0 = 0, cy = 0
-       movd    28(sp),r7               # r7 = s2_limb
-
-Loop:  movd    r5[r4:d],r2
-       meid    r7,r2                   # r2 = low_prod, r3 = high_prod
-       addcd   r0,r2                   # r2 = low_prod + cy_limb
-       movd    r3,r0                   # r0 = new cy_limb
-       movd    r2,r6[r4:d]
-       acbd    1,r4,Loop
-
-       addcd   0,r0
-       restore [r7,r6,r5,r4,r3]
-       ret     0
diff --git a/mpn/ns32k/sub_n.s b/mpn/ns32k/sub_n.s
deleted file mode 100644 (file)
index 5252ddf..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# ns32000 __gmpn_sub_n -- Subtract two limb vectors of the same length > 0 and
-# store difference in a third limb vector.
-
-# Copyright 1992, 1994, 2000 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 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.
-
-# 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 Lesser General Public
-# License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-       .align 1
-.globl ___gmpn_sub_n
-___gmpn_sub_n:
-       save    [r3,r4,r5]
-       negd    28(sp),r3
-       movd    r3,r0
-       lshd    2,r0
-       movd    24(sp),r4
-       subd    r0,r4                   # r4 -> to end of S2
-       movd    20(sp),r5
-       subd    r0,r5                   # r5 -> to end of S1
-       movd    16(sp),r2
-       subd    r0,r2                   # r2 -> to end of RES
-       subd    r0,r0                   # cy = 0
-
-Loop:  movd    r5[r3:d],r0
-       subcd   r4[r3:d],r0
-       movd    r0,r2[r3:d]
-       acbd    1,r3,Loop
-
-       scsd    r0                      # r0 = cy.
-       restore [r5,r4,r3]
-       ret     0
diff --git a/mpn/ns32k/submul_1.s b/mpn/ns32k/submul_1.s
deleted file mode 100644 (file)
index 7a0ba9a..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# ns32000 __gmpn_submul_1 -- Multiply a limb vector with a limb and subtract
-# the result from a second limb vector.
-
-# Copyright 1992, 1994, 2000 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 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.
-
-# 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 Lesser General Public
-# License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-       .align 1
-.globl ___gmpn_submul_1
-___gmpn_submul_1:
-       save    [r3,r4,r5,r6,r7]
-       negd    24(sp),r4
-       movd    r4,r0
-       lshd    2,r0
-       movd    20(sp),r5
-       subd    r0,r5                   # r5 -> to end of S1
-       movd    16(sp),r6
-       subd    r0,r6                   # r6 -> to end of RES
-       subd    r0,r0                   # r0 = 0, cy = 0
-       movd    28(sp),r7               # r7 = s2_limb
-
-Loop:  movd    r5[r4:d],r2
-       meid    r7,r2                   # r2 = low_prod, r3 = high_prod
-       addcd   r0,r2                   # r2 = low_prod + cy_limb
-       movd    r3,r0                   # r0 = new cy_limb
-       addcd   0,r0
-       subd    r2,r6[r4:d]
-       acbd    1,r4,Loop
-
-       addcd   0,r0
-       restore [r7,r6,r5,r4,r3]
-       ret     0
index 72158d30ea1496d71fb1161beee63f02c7a3d3bd..4323390c9b882d1fe4e07fb998d6b7eda98efda1 100644 (file)
@@ -3,17 +3,28 @@ Copyright 1996, 1999, 2001, 2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index 1bb27ae883345e5dec276e492f675283df419bef..46f39377ea87572d34a434a0404fadbe1e4c675a 100644 (file)
@@ -1,22 +1,33 @@
 dnl  HP-PA mpn_add_n -- Add two limb vectors of the same length > 0 and store
 dnl  sum in a third limb vector.
 
-dnl  Copyright 1992, 1994, 2000, 2001, 2002 Free Software Foundation, Inc.
+dnl  Copyright 1992, 1994, 2000-2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index fd1eb97555e774628eaea08be2e82102ba9113df..377efcb1565fdc12b0a37d7a940453da7bb7840d 100644 (file)
@@ -1,25 +1,35 @@
 /* HP-PA 1.0 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 /* These values are for the PA7100 using GCC.  */
 /* Generated by tuneup.c, 2000-10-27. */
index c50e4e10f7e322ddca5af3587d16757cee0b60d9..ec2f2198e84a48ee5e9db3cdd2f70c6fccefe392 100644 (file)
@@ -1,23 +1,33 @@
 dnl  HP-PA 1.1 mpn_addmul_1 -- Multiply a limb vector with a limb and add the
 dnl  result to a second limb vector.
 
-dnl  Copyright 1992, 1993, 1994, 2000, 2001, 2002 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 1992-1994, 2000-2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 32b3ae9d63c5360c9044a110929fd830782a6268..1261b24c83ecbe97345b17b76abbf03d5e77b053 100644 (file)
@@ -1,25 +1,35 @@
 /* HP-PA 1.1 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2004 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 /* Generated by tuneup.c, 2004-02-07, gcc 2.8 (pa7100/100MHz) */
 
index 9e17c2d0234dcd65e687b1248d2fd76d2c72b239..6e60c2f61fec0ac96a8491408a471e08ab8fb63e 100644 (file)
@@ -1,23 +1,33 @@
 dnl  HP-PA 1.1 mpn_mul_1 -- Multiply a limb vector with a limb and store the
 dnl  result in a second limb vector.
 
-dnl  Copyright 1992, 1993, 1994, 2000, 2001, 2002 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 1992-1994, 2000-2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 326a13398411ff1b80e04b508c34a8ec0aba2486..b96d40382687d498d17549d872f583cc08d353ef 100644 (file)
@@ -2,23 +2,33 @@ dnl  HP-PA mpn_add_n -- Add two limb vectors of the same length > 0 and store
 dnl  sum in a third limb vector.  Optimized for the PA7100, where is runs at
 dnl  4.25 cycles/limb.
 
-dnl  Copyright 1992, 1994, 2000, 2001, 2002, 2003 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 1992, 1994, 2000-2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 57f4d76745f75ad19fbfdd76b173da5d3df87625..fb16100d83d16d6c1c1ca5b0a42b96f832a636e6 100644 (file)
@@ -1,22 +1,33 @@
 dnl  HP-PA 7100/7200 mpn_addmul_1 -- Multiply a limb vector with a limb and
 dnl  add the result to a second limb vector.
 
-dnl  Copyright 1995, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+dnl  Copyright 1995, 2000-2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index f6b4068cfaf91977d44a1469438d5a7474905de2..d65db2a76bfd09a313eeeb5e5b70fd235230a0a5 100644 (file)
@@ -1,23 +1,33 @@
 dnl  HP-PA  mpn_lshift -- Shift a number left.
 dnl  Optimized for the PA7100, where is runs at 3.25 cycles/limb.
 
-dnl  Copyright 1992, 1994, 2000, 2001, 2002, 2003 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 1992, 1994, 2000-2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index ed7313b5fcb303c45b20083caca7490055831fa9..f7896fc949bc02636888b0e08c731d95c8490ed7 100644 (file)
@@ -1,23 +1,33 @@
 dnl  HP-PA  mpn_rshift -- Shift a number right.
 dnl  Optimized for the PA7100, where is runs at 3.25 cycles/limb.
 
-dnl  Copyright 1992, 1994, 2000, 2001, 2002, 2003 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 1992, 1994, 2000-2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 38ea0e197e106670c3013f64de570ac4a5d88e3a..df3f6e8b819303e4acc5ea2abcd722e6ed935cbf 100644 (file)
@@ -2,23 +2,33 @@ dnl  HP-PA mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
 dnl  store difference in a third limb vector.  Optimized for the PA7100, where
 dnl  is runs at 4.25 cycles/limb.
 
-dnl  Copyright 1992, 1994, 2000, 2001, 2002, 2003 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 1992, 1994, 2000-2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index aee9d9033e62fcd60301ef41a09cab17e278453c..5ea08cbee5503dda2ebfe5afc158dba767d064df 100644 (file)
@@ -1,22 +1,33 @@
 dnl  HP-PA 7100/7200 mpn_submul_1 -- Multiply a limb vector with a limb and
 dnl  subtract the result from a second limb vector.
 
-dnl  Copyright 1995, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+dnl  Copyright 1995, 2000-2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 4eba989276587eb0fab0797820dc034875f15f3c..1c7a18e37d681f656ddcbf3d3e5b3665038b7cbb 100644 (file)
@@ -3,19 +3,30 @@ dnl  HP-PA 1.1 32-bit mpn_sqr_diagonal.
 dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index c6bc38394bc2e903c28ae4c594fea70a80c72eb7..a9b11d24a893c160e285037c2bc48dd8bbed1a64 100644 (file)
@@ -1,23 +1,33 @@
 dnl  HP-PA 1.1 mpn_submul_1 -- Multiply a limb vector with a limb and subtract
 dnl  the result from a second limb vector.
 
-dnl  Copyright 1992, 1993, 1994, 2000, 2001, 2002 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 1992-1994, 2000-2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index e6a9927edfd85e2a0dc25fd12935c4797e2cb7d6..626ecd202b01406c17ebf9aea2d962fef476f4fe 100644 (file)
@@ -4,19 +4,30 @@ dnl  This version runs fast on PA 7000 and later.
 dnl  Copyright 1993, 1994, 2000, 2001, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 7f1cb939493dd1562a4c147fb9c17afc0f246d0e..18b923cd5a9bc6ac59e7ce616d68132a6f0c65a2 100644 (file)
@@ -1,19 +1,30 @@
 dnl  Copyright 1999, 2001 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 685c4c91ae0985b21404538248b8997a0327aa7b..8d881b8b0862577780be201e443106f6d06cd506 100644 (file)
@@ -1,22 +1,33 @@
 dnl  HP-PA 2.0 32-bit mpn_add_n -- Add two limb vectors of the same length > 0
 dnl  and store sum in a third limb vector.
 
-dnl  Copyright 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+dnl  Copyright 1997, 1998, 2000-2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d25a84bc0c4495d128a9d835eb6700dc65ee571e..6016274714ddf69e7f7b059413f1bec5aabd9721 100644 (file)
@@ -1,25 +1,36 @@
 /* gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2009, 2010 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2002, 2009, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 /* 552 MHz PA8600 (gcc61.fsffrance.org) */
 
index 3493c873227ba6b97ead3d6f32d4a33972a24008..c55112fac53995a450bf5f271dcff379600a5d40 100644 (file)
@@ -3,19 +3,30 @@ dnl  HP-PA 32-bit mpn_sqr_diagonal optimized for the PA8x00.
 dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index b0aefb4abb60a6d364824389249ff4be00063457..47b3163fe3cae6caca3fc9f4494b3495d6840a60 100644 (file)
@@ -1,22 +1,33 @@
 dnl  HP-PA 2.0 32-bit mpn_sub_n -- Subtract two limb vectors of the same
 dnl  length > 0 and store difference in a third limb vector.
 
-dnl  Copyright 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+dnl  Copyright 1997, 1998, 2000-2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 2128fbeed4321fd4483690b8211c6a36ead549f9..5ea497c1f1916efea36ef1340bce1cbd60942168 100644 (file)
@@ -1,21 +1,32 @@
 dnl  HP-PA  mpn_lshift -- Shift a number left.
 
-dnl  Copyright 1992, 1994, 2000, 2001, 2002 Free Software Foundation, Inc.
+dnl  Copyright 1992, 1994, 2000-2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 837ee4747ab109fd674bd62c659fce0e701c1163..b26e715fc5b6ccb2e80d0148a62fdb38e53699bc 100644 (file)
@@ -3,21 +3,32 @@ divert(-1)
 dnl  m4 macros for HPPA assembler.
 
 dnl  Copyright 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  hppa assembler comments are introduced with ";".
index 238b0be7ed1ad9eceedefb3bcd73734680a95cc6..c5eac830c9b7f91d42972bf89775c542523001bb 100644 (file)
@@ -1,21 +1,32 @@
 dnl  HP-PA  mpn_rshift -- Shift a number right.
 
-dnl  Copyright 1992, 1994, 2000, 2001, 2002 Free Software Foundation, Inc.
+dnl  Copyright 1992, 1994, 2000-2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d07ebb5bb6461e27fc1ceffc9f78c3b3dd073e44..9c71655b9838cef998deb524ae3d0d23c47d87d2 100644 (file)
@@ -1,22 +1,33 @@
 dnl  HP-PA mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
 dnl  store difference in a third limb vector.
 
-dnl  Copyright 1992, 1994, 2000, 2001, 2002 Free Software Foundation, Inc.
+dnl  Copyright 1992, 1994, 2000-2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 86886e484c9665392d3fb397d28de22242be2229..addbf41ef5161d5484ecfbd31e8c91aa901a4669 100644 (file)
@@ -1,22 +1,33 @@
 dnl  HP-PA  __udiv_qrnnd division support, used from longlong.h.
 dnl  This version runs fast on pre-PA7000 CPUs.
 
-dnl  Copyright 1993, 1994, 2000, 2001, 2002 Free Software Foundation, Inc.
+dnl  Copyright 1993, 1994, 2000-2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 6234a407f28b72754257c1a41521ee8e0533bc61..a51ce028a4e3ded325e16b6520c1e815b3bbe9c5 100644 (file)
@@ -3,17 +3,28 @@ Copyright 1999, 2001, 2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index 4e76546050f15dee8970016247e0af65848dbb76..2cb9af9f147a3c5e2b3e13a23be066d24df2dd78 100644 (file)
@@ -1,22 +1,33 @@
 dnl  HP-PA 2.0 64-bit mpn_addmul_1 -- Multiply a limb vector with a limb and
 dnl  add the result to a second limb vector.
 
-dnl  Copyright 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+dnl  Copyright 1998-2000, 2002, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 4048e8c38363e411adc23c2704eded4093a89595..ab4536fefba87bd0f425537c6165459b46e355ad 100644 (file)
@@ -4,19 +4,30 @@ dnl  Copyright 1997, 2000, 2002, 2003, 2009, 2010 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  This runs at 2 cycles/limb on PA8000 and 1.6875 cycles/limb on PA8500.  It
index b2cca7a3568e3ccf66cab92d51544442044669c3..2a55ddea30ffda195791f8de9e5abcd148765020 100644 (file)
@@ -3,19 +3,30 @@ dnl  PA64 mpn_addlsh1_n/mpn_sublsh1_n -- rp[] = up[] +- (vp[] << 1).
 dnl  Copyright 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 081757acadd4e3c565661784be7343178cdc7d89..c2719c3c897dfeae4bf5b6c84a8a2ef5f6472d25 100644 (file)
@@ -1,25 +1,35 @@
 /* gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009,
-2010 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2004, 2008-2010 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 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.
+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 Lesser General Public License
+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 a copy of the GNU Lesser General Public License along
-with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 /* 440MHz PA8200 */
 
index 0dceba20c1e4b33758d5b786af958552dfcfff7a..c0fc2921c1654a7b9960f92719e4787f64176326 100644 (file)
@@ -3,19 +3,30 @@ dnl  HP-PA 2.0 mpn_lshift -- Left shift.
 dnl  Copyright 1997, 2000, 2002, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  This runs at 1.5 cycles/limb on PA8000 and 1.0 cycles/limb on PA8500.
index fbb5f174ae394c9c6ae5b3abce60442f8d9d7159..6935c23ccd7cfb83080b63256cd674676f8a2d50 100644 (file)
@@ -1,22 +1,33 @@
 dnl  HP-PA 2.0 64-bit mpn_mul_1 -- Multiply a limb vector with a limb and store
 dnl  the result in a second limb vector.
 
-dnl  Copyright 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+dnl  Copyright 1998-2000, 2002, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 80470c989204abb4ce726b5e4a075e68040c6c1a..cfc242ea9ca274248c375a3444bc8014478a88d3 100644 (file)
@@ -3,19 +3,30 @@ dnl  HP-PA 2.0 mpn_rshift -- Right shift.
 dnl  Copyright 1997, 2000, 2002, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  This runs at 1.5 cycles/limb on PA8000 and 1.0 cycles/limb on PA8500.
index 73c64b06ed0309f88bda46bcda4d5a4819666a3c..f6fadc93c63a095db5fb465cce8be209168414d6 100644 (file)
@@ -1,21 +1,32 @@
 dnl  HP-PA 2.0 64-bit mpn_sqr_diagonal.
 
-dnl  Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+dnl  Copyright 2001-2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  This code runs at 7.25 cycles/limb on PA8000 and 7.75 cycles/limb on
index 40678239fa9df0c7178754289be667afd9a164bf..f8a1968e45b495196dec62c39d15a646f9687243 100644 (file)
@@ -1,22 +1,33 @@
 dnl  HP-PA 2.0 64-bit mpn_submul_1 -- Multiply a limb vector with a limb and
 dnl  subtract the result from a second limb vector.
 
-dnl  Copyright 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+dnl  Copyright 1998-2000, 2002, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 3775783a057e95b7ec31ace56cdb9cbfdaeb0d7f..1380a85932ee995e0b5c1cf9beb559a96af6f3f6 100644 (file)
@@ -1,21 +1,32 @@
 dnl  HP-PA 2.0 64-bit mpn_udiv_qrnnd_r.
 
-dnl  Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+dnl  Copyright 2001-2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 635e44fea0146605c72a27d3d7e3eb066c7130a7..c3341ecfe60d72894fc0baf6fbe40d0ec47b9101 100644 (file)
@@ -1,26 +1,36 @@
 dnl  Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  Optimizations:
 dnl  * Avoid skip instructions
 dnl  * Put carry-generating and carry-consuming insns consecutively
-dnl  * Don't allocate any stack, "home" positions for parameteters could be
-dnl    used.
+dnl  * Don't allocate any stack, "home" positions for parameters could be used.
 
 include(`../config.m4')
 
index 4fcafab7e172e5298ae493dca4eccf2a934f7b3b..6d6ca73da9809e451548095234a1611a4d7dceaf 100644 (file)
@@ -1,22 +1,32 @@
 dnl  IBM POWER mpn_add_n -- Add two limb vectors of equal, non-zero length.
 
-dnl  Copyright 1992, 1994, 1995, 1996, 1999, 2000, 2001, 2005 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 1992, 1994-1996, 1999-2001, 2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  INPUT PARAMETERS
index fcda2c1263e21ef85d3ab3ba6ae04d043a5073ee..76d8df3c76c174b8471c790753dd818348d83bfa 100644 (file)
@@ -1,22 +1,33 @@
 dnl  IBM POWER mpn_addmul_1 -- Multiply a limb vector with a limb and add the
 dnl  result to a second limb vector.
 
-dnl  Copyright 1992, 1994, 1999, 2000, 2001 Free Software Foundation, Inc.
+dnl  Copyright 1992, 1994, 1999-2001 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  INPUT PARAMETERS
index 34f74aac38b5b24e628f483485b86801edcd2f11..7cb36f963e7a39b556dbfbc3f3cef3d6fe17a803 100644 (file)
@@ -1,21 +1,32 @@
 /* POWER gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright 2002-2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* Generated by tuneup.c, 2003-02-10, gcc 3.2, POWER2 66.7MHz */
 
index a4adb7aad5368d4afc1cb440205ad97bf039faf3..efa210556d00f4454a6c5afea9c933fee6be2737 100644 (file)
@@ -1,21 +1,32 @@
 dnl  IBM POWER mpn_lshift -- Shift a number left.
 
-dnl  Copyright 1992, 1994, 1999, 2000, 2001 Free Software Foundation, Inc.
+dnl  Copyright 1992, 1994, 1999-2001 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  INPUT PARAMETERS
index bd33942adf0c4450ab1987ba9b546f84f31808b5..38b7b66be0b69470a6aee83d77c62092fcd3a890 100644 (file)
@@ -1,22 +1,33 @@
 dnl  IBM POWER mpn_mul_1 -- Multiply a limb vector with a limb and store the
 dnl  result in a second limb vector.
 
-dnl  Copyright 1992, 1994, 1999, 2000, 2001 Free Software Foundation, Inc.
+dnl  Copyright 1992, 1994, 1999-2001 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  INPUT PARAMETERS
index 4645015ccd7385e6d6e3a54744e808c2eb22df50..1d1815ccb51447c02a9f1f1eabd67a4d5efd4e87 100644 (file)
@@ -1,21 +1,32 @@
 dnl  IBM POWER mpn_rshift -- Shift a number right.
 
-dnl  Copyright 1992, 1994, 1999, 2000, 2001 Free Software Foundation, Inc.
+dnl  Copyright 1992, 1994, 1999-2001 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  INPUT PARAMETERS
index 7a798022cd3f24f11cbf0421fed824378c1a307c..4a9ed143b8a4e56ab5efd2cc7cd7315f5bf9a262 100644 (file)
@@ -1,19 +1,30 @@
 dnl  Copyright 1999, 2001 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d34415d7e495225b964efb922360dc7fbb4b88c0..390c802d8bca5bc32f74e169cc1a3e2dabbc945a 100644 (file)
@@ -1,23 +1,33 @@
 dnl  IBM POWER mpn_sub_n -- Subtract two limb vectors of equal, non-zero
 dnl  length.
 
-dnl  Copyright 1992, 1994, 1995, 1996, 1999, 2000, 2001, 2005 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 1992, 1994-1996, 1999-2001, 2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  INPUT PARAMETERS
index 3c3492d00c5b69ad1f9e8d0fb1a04322fa3d0541..1788e0d4f4f9b7358a59e0b47ef85e3aa9c11074 100644 (file)
@@ -1,22 +1,33 @@
 dnl  IBM POWER mpn_submul_1 -- Multiply a limb vector with a limb and subtract
 dnl  the result from a second limb vector.
 
-dnl  Copyright 1992, 1994, 1999, 2000, 2001 Free Software Foundation, Inc.
+dnl  Copyright 1992, 1994, 1999-2001 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  INPUT PARAMETERS
index 996f2e6cb1ceb45a916f7583d47e42c32c251154..5a0599e21d94f2d42319c13bd8c5a17fac3bdaa5 100644 (file)
@@ -1,19 +1,30 @@
 dnl  Copyright 1999, 2001 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index c6b4b101be046553bca28f547e931317920e05d6..1b8b574b9cc3e3b16c8c5e1532bfef75450066aa 100644 (file)
@@ -1,21 +1,32 @@
 dnl  PowerPC 750 mpn_com -- mpn bitwise one's complement
 
 dnl  Copyright 2002, 2003 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index fca0fec1b56e5541576ccba4f8efb0cb1f92b307..3667e8596d2d9b45c97aa0fd73fb1c381d2a17b4 100644 (file)
@@ -5,20 +5,31 @@ Copyright 2002, 2004, 2009, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 
 /* This file is used for 75x (G3) and for 7400/7410 (G4), both which have
index 9298793f27567c39532db364eb60a914cbf7abe8..3a1c1a7212e81ccf2e5a99953b6d7a1e4c039dd5 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC 750 mpn_lshift -- mpn left shift.
 dnl  Copyright 2002, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 944e8690a7cae38b02ac2eea5e964fe69dc0ac32..4825fee61833e2194a07f8212b7b1e880fb90fc4 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC 750 mpn_rshift -- mpn right shift.
 dnl  Copyright 2002, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 43aca466c253a3a30884902d8a7980297f0f7c48..887e78b290327e2fd21b5910c87d56efc9dce764 100644 (file)
@@ -3,17 +3,28 @@ Copyright 2002, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index db627a0a31b7ac613d8b352c952295db7baa7054..71645c3ec32a87818d8f907944c48f0c41bc50de 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-32 mpn_addlsh1_n -- rp[] = up[] + (vp[] << 1)
 dnl  Copyright 2003, 2005, 2007 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 6260691b34ac66e1d1e65ac0166709284be910fa..7f47ab2ce72eefdf3e7a24cdf824a03258d79439 100644 (file)
@@ -1,23 +1,33 @@
 dnl  PowerPC-32 mpn_addmul_1 -- Multiply a limb vector with a limb and add the
 dnl  result to a second limb vector.
 
-dnl  Copyright 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2005 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 1995, 1997, 1998, 2000-2003, 2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 81199c78d46284fa97227fbc46ba525edd93df04..fde20200b2440b2535a07d90d9257132d0a02591 100644 (file)
@@ -1,22 +1,33 @@
 divert(-1)
 dnl  m4 macros for AIX 32-bit assembly.
 
-dnl  Copyright 2000, 2001, 2002, 2005, 2006 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2002, 2005, 2006 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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(`ASM_START',
 `      .toc')
index 12115a9e9d5362b678b855f3b885fe267a7fcfb6..25ece0966e9a115be2d45b472538e3817a930f73 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-32 mpn_add_n and mpn_sub_n.
 dnl  Copyright 2002, 2005, 2007 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 41870fbe8a1ebacd25dd7572f4153c9064c81188..72b2c482e4d36e23f58b4327f1e5926382c5e8df 100644 (file)
@@ -3,19 +3,30 @@ dnl  PPC32 mpn_bdiv_dbm1c.
 dnl  Copyright 2008 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index b76103a8ca359792dc862a1a50a35bdc6c22ba7f..db4226800b363ec63d2a123648d5c6b2421174a5 100644 (file)
@@ -2,31 +2,44 @@ divert(-1)
 dnl  m4 macros for Mac OS 32-bit assembly.
 
 dnl  Copyright 2005, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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 MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or 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/.
 
 define(`ASM_START',`')
 
-dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
+dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
 dnl          EPILOGUE_cpu(GSYM_PREFIX`'foo)
 dnl
 
 define(`PROLOGUE_cpu',
-m4_assert_numargs(1)
-`      .text
+m4_assert_numargs_range(1,2)
+`ifelse(`$2',toc,,
+`ifelse(`$2',,,`m4_error(`Unrecognised PROLOGUE parameter')')')dnl
+       .text
        .globl  $1
        .align  3
 $1:')
index cf11a198245a0e51e543fe82a379771a30283c6b..288a7d30ac8a0327566e86e6c6e63173fe1c6c50 100644 (file)
@@ -1,21 +1,32 @@
 dnl  PowerPC-32 mpn_divexact_by3 -- mpn by 3 exact division
 
 dnl  Copyright 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 916219e00cd3c1276bfbc0409bbf8cd5179d8fe4..c6e64efe2333b940e12360762ccaade511edc2c2 100644 (file)
@@ -3,19 +3,30 @@ 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  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 20f9a2f327ba1d7c3dc20eddc1f2dad5ae01e36e..cd7633c6330ee34106eeb8b50cdb6208c68d5394 100644 (file)
@@ -2,21 +2,32 @@ divert(-1)
 dnl  m4 macros for powerpc32 eABI assembly.
 
 dnl  Copyright 2003, 2005, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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(`ASM_START',`')
 
index ab1559ebd495c6ba70db45679c889c44dd0b89f4..a64a1271ff8533c62b219428f922297d71400ba9 100644 (file)
@@ -2,31 +2,43 @@ divert(-1)
 dnl  m4 macros for powerpc32 GNU/Linux assembly.
 
 dnl  Copyright 2003, 2005, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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 MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or 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/.
 
 define(`ASM_START',`')
 
-dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
+dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
 dnl          EPILOGUE_cpu(GSYM_PREFIX`'foo)
 dnl
 
 define(`PROLOGUE_cpu',
-m4_assert_numargs(1)
-       `
+m4_assert_numargs_range(1,2)
+`ifelse(`$2',toc,,
+`ifelse(`$2',,,`m4_error(`Unrecognised PROLOGUE parameter')')')dnl
        .section        ".text"
        .align  3
        .globl  $1
index b478a471241b2e5b9a38f3754f2618ac518716c8..784a6d7b74731670158590cbfcfd6498e3dcbb0d 100644 (file)
@@ -1,25 +1,36 @@
 /* PowerPC-32 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009,
-2010 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2004, 2008-2010, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 
 /* This file is supposed to be used for 604, 604e, 744x/745x/747x (G4+), i.e.,
@@ -31,6 +42,8 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
    7400/7410 (G4), both which have much slower multiply instructions.  */
 
 /* 1417 MHz PPC 7447A */
+/* FFT tuning limit = 12500000 */
+/* Generated by tuneup.c, 2014-03-12, gcc 4.6 */
 
 #define DIVREM_1_NORM_THRESHOLD              0  /* always */
 #define DIVREM_1_UNNORM_THRESHOLD            0  /* always */
@@ -43,26 +56,29 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #define MOD_1_2_TO_MOD_1_4_THRESHOLD        49
 #define PREINV_MOD_1_TO_MOD_1_THRESHOLD     18
 #define USE_PREINV_DIVREM_1                  1
+#define DIV_QR_1N_PI1_METHOD                 1
+#define DIV_QR_1_NORM_THRESHOLD              2
+#define DIV_QR_1_UNNORM_THRESHOLD            1
 #define DIV_QR_2_PI2_THRESHOLD           MP_SIZE_T_MAX  /* never */
 #define DIVEXACT_1_THRESHOLD                 0  /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD           66
+#define BMOD_1_TO_MOD_1_THRESHOLD           69
 
 #define MUL_TOOM22_THRESHOLD                14
 #define MUL_TOOM33_THRESHOLD                73
 #define MUL_TOOM44_THRESHOLD               106
-#define MUL_TOOM6H_THRESHOLD               157
+#define MUL_TOOM6H_THRESHOLD               156
 #define MUL_TOOM8H_THRESHOLD               236
 
 #define MUL_TOOM32_TO_TOOM43_THRESHOLD      73
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD      72
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD      71
 #define MUL_TOOM42_TO_TOOM53_THRESHOLD      73
 #define MUL_TOOM42_TO_TOOM63_THRESHOLD      72
 #define MUL_TOOM43_TO_TOOM54_THRESHOLD      82
 
-#define SQR_BASECASE_THRESHOLD               4
-#define SQR_TOOM2_THRESHOLD                 26
-#define SQR_TOOM3_THRESHOLD                 77
-#define SQR_TOOM4_THRESHOLD                136
+#define SQR_BASECASE_THRESHOLD               0  /* always */
+#define SQR_TOOM2_THRESHOLD                 22
+#define SQR_TOOM3_THRESHOLD                 74
+#define SQR_TOOM4_THRESHOLD                130
 #define SQR_TOOM6_THRESHOLD                189
 #define SQR_TOOM8_THRESHOLD                284
 
@@ -73,67 +89,65 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 #define MUL_FFT_MODF_THRESHOLD             284  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    284, 5}, {     17, 6}, {      9, 5}, {     19, 6}, \
-    {     13, 7}, {      7, 6}, {     17, 7}, {      9, 6}, \
-    {     20, 7}, {     11, 6}, {     23, 7}, {     13, 8}, \
-    {      7, 7}, {     19, 8}, {     11, 7}, {     25, 9}, \
-    {      7, 8}, {     15, 7}, {     33, 8}, {     19, 7}, \
-    {     39, 8}, {     23, 7}, {     47, 9}, {     15, 8}, \
-    {     39, 9}, {     23, 8}, {     47,10}, {     15, 9}, \
-    {     31, 8}, {     67, 9}, {     39, 8}, {     79, 9}, \
-    {     47, 8}, {     95,10}, {     31, 9}, {     71, 8}, \
-    {    143, 9}, {     79,10}, {     47, 9}, {     95,11}, \
-    {     31,10}, {     63, 9}, {    127, 8}, {    255, 9}, \
-    {    135, 8}, {    271, 9}, {    143,10}, {     79, 9}, \
-    {    159, 8}, {    319, 9}, {    175,10}, {     95, 9}, \
-    {    191, 8}, {    383, 9}, {    207, 8}, {    415,11}, \
-    {     63,10}, {    127, 9}, {    255, 8}, {    511, 9}, \
-    {    271,10}, {    143, 9}, {    287, 8}, {    575,10}, \
-    {    159, 9}, {    319,10}, {    175,11}, {     95,10}, \
-    {    191, 9}, {    383,10}, {    207, 9}, {    415, 8}, \
-    {    831,12}, {     63,11}, {    127,10}, {    255, 9}, \
-    {    511,10}, {    271, 9}, {    543, 8}, {   1087,10}, \
-    {    287, 9}, {    575,11}, {    159,10}, {    319, 9}, \
-    {    639,10}, {    351, 9}, {    703,11}, {    191,10}, \
-    {    415, 9}, {    831,11}, {    223,10}, {    447, 9}, \
-    {    895,10}, {    479, 9}, {    959,12}, {    127,11}, \
-    {    255,10}, {    543, 9}, {   1087,11}, {    287,10}, \
-    {    607,11}, {    319,10}, {    639,11}, {    351,10}, \
-    {    703, 9}, {   1407,12}, {    191,11}, {    383,10}, \
-    {    767,11}, {    415,10}, {    831,11}, {    447,10}, \
-    {    895,11}, {    479,10}, {    959,13}, {    127,12}, \
-    {    255,11}, {    543,10}, {   1087,11}, {    607,12}, \
-    {    319,11}, {    639,10}, {   1279,11}, {    703,10}, \
-    {   1407,12}, {    383,11}, {    831,12}, {    447,11}, \
-    {    959,10}, {   1919,13}, {    255,12}, {    511,11}, \
-    {   1087,12}, {    575,11}, {   1215,10}, {   2431,12}, \
-    {    639,11}, {   1279,12}, {    703,11}, {   1407,13}, \
-    {    383,12}, {    959,11}, {   1919,14}, {    255,13}, \
-    {    511,12}, {   1215,11}, {   2431,13}, {    639,12}, \
-    {   1471,13}, {    767,12}, {   1599,13}, {    895,12}, \
-    {   1919,14}, {    511,13}, {   1023,12}, {   2111,13}, \
-    {   1151,12}, {   2431,13}, {   1407,14}, {    767,13}, \
-    {   1535,12}, {   3071,13}, {   1919,12}, {   3839,15}, \
-    {  32768,16} }
-#define MUL_FFT_TABLE3_SIZE 165
-#define MUL_FFT_THRESHOLD                 3392
-
-#define SQR_FFT_MODF_THRESHOLD             236  /* k = 5 */
-#define SQR_FFT_TABLE3                                      \
-  { {    248, 5}, {     17, 6}, {      9, 5}, {     19, 6}, \
+  { {    284, 5}, {     15, 6}, {      8, 5}, {     17, 6}, \
     {     17, 7}, {      9, 6}, {     20, 7}, {     11, 6}, \
     {     23, 7}, {     13, 8}, {      7, 7}, {     19, 8}, \
     {     11, 7}, {     25, 9}, {      7, 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}, {     63, 8}, {    127, 9}, {     71, 8}, \
-    {    143, 9}, {     79,10}, {     47, 9}, {     95,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, 9}, {    207, 8}, {    415,11}, \
+    {     67, 9}, {     39, 8}, {     79, 9}, {     47, 8}, \
+    {     95,10}, {     31, 9}, {     71, 8}, {    143, 9}, \
+    {     79,10}, {     47, 9}, {     95,11}, {     31,10}, \
+    {     63, 9}, {    127, 8}, {    255, 9}, {    135, 8}, \
+    {    271, 9}, {    143,10}, {     79, 9}, {    159, 8}, \
+    {    319, 9}, {    175,10}, {     95, 9}, {    191, 8}, \
+    {    383, 9}, {    207, 8}, {    415,11}, {     63,10}, \
+    {    127, 9}, {    255, 8}, {    511, 9}, {    271,10}, \
+    {    143, 9}, {    287, 8}, {    575,10}, {    159, 9}, \
+    {    319,10}, {    175,11}, {     95,10}, {    191, 9}, \
+    {    383,10}, {    207, 9}, {    415, 8}, {    831,12}, \
+    {     63,11}, {    127,10}, {    255, 9}, {    511,10}, \
+    {    271, 9}, {    543, 8}, {   1087,10}, {    287, 9}, \
+    {    575,11}, {    159,10}, {    319, 9}, {    639,10}, \
+    {    351, 9}, {    703,11}, {    191,10}, {    415, 9}, \
+    {    831,11}, {    223,10}, {    447, 9}, {    895,10}, \
+    {    479, 9}, {    959,12}, {    127,11}, {    255,10}, \
+    {    543, 9}, {   1087,11}, {    287,10}, {    575,11}, \
+    {    319,10}, {    639,11}, {    351,10}, {    703, 9}, \
+    {   1407,12}, {    191,11}, {    383,10}, {    767,11}, \
+    {    415,10}, {    831,11}, {    447,10}, {    895,11}, \
+    {    479,10}, {    959,13}, {    127,12}, {    255,11}, \
+    {    543,10}, {   1087,11}, {    607,12}, {    319,11}, \
+    {    639,10}, {   1279,11}, {    703,10}, {   1407,12}, \
+    {    383,11}, {    831,12}, {    447,11}, {    959,13}, \
+    {    255,12}, {    511,11}, {   1087,12}, {    575,11}, \
+    {   1215,10}, {   2431,12}, {    639,11}, {   1279,12}, \
+    {    703,11}, {   1407,13}, {    383,12}, {    895,11}, \
+    {   1791,12}, {    959,14}, {    255,13}, {    511,12}, \
+    {   1215,11}, {   2431,13}, {    639,12}, {   1471,13}, \
+    {    767,12}, {   1599,13}, {    895,12}, {   1919,14}, \
+    {    511,13}, {   1023,12}, {   2111,13}, {   1151,12}, \
+    {   2431,13}, {   1407,14}, {  16384,15}, {  32768,16} }
+#define MUL_FFT_TABLE3_SIZE 160
+#define MUL_FFT_THRESHOLD                 3712
+
+#define SQR_FFT_MODF_THRESHOLD             248  /* k = 5 */
+#define SQR_FFT_TABLE3                                      \
+  { {    248, 5}, {     17, 6}, {      9, 5}, {     19, 6}, \
+    {     17, 7}, {      9, 6}, {     20, 7}, {     11, 6}, \
+    {     23, 7}, {     13, 8}, {      7, 7}, {     19, 8}, \
+    {     11, 7}, {     25, 9}, {      7, 8}, {     15, 7}, \
+    {     33, 8}, {     19, 7}, {     39, 8}, {     27, 9}, \
+    {     15, 8}, {     39, 9}, {     23, 8}, {     47,10}, \
+    {     15, 9}, {     31, 8}, {     67, 9}, {     39, 8}, \
+    {     79, 9}, {     47, 8}, {     95,10}, {     31, 9}, \
+    {     63, 8}, {    127, 9}, {     71, 8}, {    143, 9}, \
+    {     79,10}, {     47, 9}, {     95,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, 9}, {    207, 8}, {    415, 7}, {    831,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}, \
@@ -141,54 +155,54 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
     {    831,12}, {     63,11}, {    127,10}, {    255, 9}, \
     {    511,10}, {    271, 9}, {    543,10}, {    287, 9}, \
     {    575,11}, {    159,10}, {    319, 9}, {    639,10}, \
-    {    351, 9}, {    703, 8}, {   1407, 9}, {    735,11}, \
-    {    191,10}, {    415, 9}, {    831,11}, {    223,10}, \
-    {    447, 9}, {    895,10}, {    479,12}, {    127,11}, \
-    {    255,10}, {    543,11}, {    287,10}, {    607,11}, \
-    {    319,10}, {    639,11}, {    351,10}, {    703, 9}, \
-    {   1407,12}, {    191,11}, {    383,13}, {    127,12}, \
-    {    255,11}, {    543,10}, {   1087,11}, {    575,10}, \
-    {   1151,12}, {    319,11}, {    703,10}, {   1407,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,11}, {   2431,13}, {    639,12}, \
-    {   1471,13}, {    767,12}, {   1599,13}, {    895,12}, \
-    {   1919,14}, {    511,13}, {   1023,12}, {   2111,13}, \
-    {   1151,12}, {   2431,13}, {   1407,12}, {   2815,14}, \
-    {    767,13}, {   1535,12}, {   3199,13}, {   1919,15}, \
-    {  32768,16} }
-#define SQR_FFT_TABLE3_SIZE 153
-#define SQR_FFT_THRESHOLD                 2368
+    {    351, 9}, {    703,11}, {    191,10}, {    383, 9}, \
+    {    767,10}, {    415, 9}, {    831,11}, {    223,10}, \
+    {    447, 9}, {    895,12}, {    127,11}, {    255,10}, \
+    {    543,11}, {    287,10}, {    607,11}, {    319,10}, \
+    {    639,11}, {    351,10}, {    703, 9}, {   1407,12}, \
+    {    191,11}, {    383,10}, {    767,11}, {    415,10}, \
+    {    831,11}, {    447,10}, {    895,11}, {    479,13}, \
+    {    127,12}, {    255,11}, {    543,10}, {   1087,11}, \
+    {    607,12}, {    319,11}, {    639,10}, {   1279,11}, \
+    {    703,10}, {   1407,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}, {   1919,14}, {    511,13}, {   1023,12}, \
+    {   2111,13}, {   1151,12}, {   2431,13}, {   1407,14}, \
+    {  16384,15}, {  32768,16} }
+#define SQR_FFT_TABLE3_SIZE 154
+#define SQR_FFT_THRESHOLD                 2688
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
 #define MULLO_DC_THRESHOLD                  45
 #define MULLO_MUL_N_THRESHOLD             6633
 
-#define DC_DIV_QR_THRESHOLD                 43
-#define DC_DIVAPPR_Q_THRESHOLD             153
+#define DC_DIV_QR_THRESHOLD                 44
+#define DC_DIVAPPR_Q_THRESHOLD             142
 #define DC_BDIV_QR_THRESHOLD                54
 #define DC_BDIV_Q_THRESHOLD                124
 
-#define INV_MULMOD_BNM1_THRESHOLD           42
+#define INV_MULMOD_BNM1_THRESHOLD           43
 #define INV_NEWTON_THRESHOLD               179
 #define INV_APPR_THRESHOLD                 157
 
-#define BINV_NEWTON_THRESHOLD              204
-#define REDC_1_TO_REDC_N_THRESHOLD          54
+#define BINV_NEWTON_THRESHOLD              214
+#define REDC_1_TO_REDC_N_THRESHOLD          55
 
 #define MU_DIV_QR_THRESHOLD                998
-#define MU_DIVAPPR_Q_THRESHOLD            1037
+#define MU_DIVAPPR_Q_THRESHOLD            1078
 #define MUPI_DIV_QR_THRESHOLD               84
-#define MU_BDIV_QR_THRESHOLD               748
-#define MU_BDIV_Q_THRESHOLD                942
+#define MU_BDIV_QR_THRESHOLD               872
+#define MU_BDIV_Q_THRESHOLD               1078
 
-#define POWM_SEC_TABLE  4,23,164,616,1812
+#define POWM_SEC_TABLE  1,19,102,428,1378
 
-#define MATRIX22_STRASSEN_THRESHOLD         11
-#define HGCD_THRESHOLD                     118
-#define HGCD_APPR_THRESHOLD                167
+#define MATRIX22_STRASSEN_THRESHOLD         12
+#define HGCD_THRESHOLD                     120
+#define HGCD_APPR_THRESHOLD                166
 #define HGCD_REDUCE_THRESHOLD             1679
 #define GCD_DC_THRESHOLD                   339
 #define GCDEXT_DC_THRESHOLD                273
@@ -200,4 +214,4 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #define SET_STR_PRECOMPUTE_THRESHOLD      1505
 
 #define FAC_DSC_THRESHOLD                  141
-#define FAC_ODD_THRESHOLD                   34
+#define FAC_ODD_THRESHOLD                   29
index 84c5de3e395d1d4c707a4190e9b2ebdfd99066cf..612bfe523c7413fe63f846ecf7ff66e981efdd93 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-32 mpn_invert_limb -- Invert a normalized limb.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 00dcc7029b2c2a689959c2ef54e971f5b7268ed9..948f8c6cf3e5223546cefad5c4114fb918d2c6cb 100644 (file)
@@ -1,22 +1,32 @@
 dnl  PowerPC-32 mpn_lshift -- Shift a number left.
 
-dnl  Copyright 1995, 1998, 2000, 2002, 2003, 2004, 2005 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 1995, 1998, 2000, 2002-2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 3d7a82a7c483db9e3a7c378c9acd63d8ee746cce..61606d1b66e668abf24211892337f530be81e50d 100644 (file)
@@ -1,22 +1,32 @@
 dnl  PowerPC-32 mpn_lshiftc.
 
-dnl  Copyright 1995, 1998, 2000, 2002, 2003, 2004, 2005, 2010 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 1995, 1998, 2000, 2002-2005, 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index fa0f0139ee5067edeac70abb360cc199b1c82ecd..6d7fe4d0890c474ada4ed984cf0154c57515a644 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-32 mpn_mod_34lsub1 -- mpn remainder mod 2^24-1.
 dnl  Copyright 2002, 2003, 2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index ba9a393b09678fab0dd9d981e53b4fc39e4e45ed..e8a6b5e28ad9a14a8654c83f6848020d8a88f9a1 100644 (file)
@@ -1,21 +1,32 @@
 dnl  PowerPC-32 mpn_modexact_1_odd -- mpn by limb exact remainder.
 
 dnl  Copyright 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index e6f44e21d9d22cd6770f3c026345c437412a059e..e42087cfa8b2bcb9bdd9bea706d741575357c9ad 100644 (file)
@@ -5,19 +5,30 @@ dnl  Copyright 1995, 1997, 2000, 2002, 2003, 2005 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 6999182a80de8922cae5909fa2ad16f72a5d0aad..c44df8fa50942afb2fc2e7aebb1a9d7e3a207bba 100644 (file)
@@ -1,22 +1,32 @@
 dnl  PowerPC-32 mpn_add_n/mpn_sub_n -- mpn addition and subtraction.
 
-dnl  Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2011 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 1999-2001, 2003-2005, 2007, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 3dd33ad1e7215e05a66300d1617c913ffae826fb..33826956a2effea4cabeb67d8c4587b24e86083d 100644 (file)
@@ -1,25 +1,35 @@
 /* PowerPC-32 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009,
-2010, 2011 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2004, 2008-2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 /* 450 MHz POWER3 */
 
index bb46419883f22fd3b012fcd21de4f3c4236a007d..20830a0bd728633c40c72822c5d1d49b23d67771 100644 (file)
@@ -1,24 +1,37 @@
 /* PowerPC-32 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009,
-2010, 2011 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2004, 2008-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* 1800 MHz PowerPC-970 */
+/* FFT tuning limit = 10000000 */
+/* Generated by tuneup.c, 2014-03-12, gcc 4.0 */
 
 #define DIVREM_1_NORM_THRESHOLD              0  /* always */
 #define DIVREM_1_UNNORM_THRESHOLD            0  /* always */
@@ -26,119 +39,166 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #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_1U_TO_MOD_1_1_THRESHOLD          5
 #define MOD_1_1_TO_MOD_1_2_THRESHOLD         9
 #define MOD_1_2_TO_MOD_1_4_THRESHOLD        42
 #define PREINV_MOD_1_TO_MOD_1_THRESHOLD     14
 #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_2_PI2_THRESHOLD           MP_SIZE_T_MAX  /* never */
 #define DIVEXACT_1_THRESHOLD                 0  /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD           46
+#define BMOD_1_TO_MOD_1_THRESHOLD           45
 
 #define MUL_TOOM22_THRESHOLD                20
 #define MUL_TOOM33_THRESHOLD                73
-#define MUL_TOOM44_THRESHOLD               121
+#define MUL_TOOM44_THRESHOLD               130
 #define MUL_TOOM6H_THRESHOLD               222
-#define MUL_TOOM8H_THRESHOLD               363
+#define MUL_TOOM8H_THRESHOLD               333
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD      84
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     107
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD      81
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD      88
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD     107
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD     108
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD      89
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD      92
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     100
 
-#define SQR_BASECASE_THRESHOLD               0  /* always */
+#define SQR_BASECASE_THRESHOLD               5
 #define SQR_TOOM2_THRESHOLD                 30
-#define SQR_TOOM3_THRESHOLD                 74
+#define SQR_TOOM3_THRESHOLD                 85
 #define SQR_TOOM4_THRESHOLD                160
-#define SQR_TOOM6_THRESHOLD                222
+#define SQR_TOOM6_THRESHOLD                197
 #define SQR_TOOM8_THRESHOLD                357
 
-#define MULMOD_BNM1_THRESHOLD               16
-#define SQRMOD_BNM1_THRESHOLD               18
+#define MULMID_TOOM42_THRESHOLD             32
+
+#define MULMOD_BNM1_THRESHOLD               15
+#define SQRMOD_BNM1_THRESHOLD               16
 
 #define MUL_FFT_MODF_THRESHOLD             444  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    444, 5}, {     15, 6}, {      8, 5}, {     17, 6}, \
-    {      9, 5}, {     19, 6}, {     10, 5}, {     21, 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}, {     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, 8}, {    319,10}, {     95, 8}, \
-    {    383,10}, {    111,11}, {     63,10}, {    127, 9}, \
-    {    255, 8}, {    511,10}, {    143, 9}, {    287, 8}, \
-    {    575, 9}, {    303,10}, {    159, 9}, {    319,11}, \
-    {     95, 9}, {    383,12}, {     63,11}, {    127,10}, \
+  { {    444, 5}, {     17, 6}, {      9, 5}, {     21, 6}, \
+    {     11, 5}, {     23, 6}, {     21, 7}, {     11, 6}, \
+    {     24, 7}, {     13, 6}, {     28, 7}, {     15, 6}, \
+    {     31, 7}, {     21, 8}, {     11, 7}, {     27, 8}, \
+    {     15, 7}, {     33, 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,10}, {     31, 9}, {     63, 8}, \
+    {    127, 9}, {     79,10}, {     47, 9}, {     95,11}, \
+    {     31,10}, {     63, 9}, {    135,10}, {     79, 9}, \
+    {    167,10}, {     95, 9}, {    191, 8}, {    383,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, 8}, \
     {   1087,10}, {    287, 9}, {    575,10}, {    303,11}, \
-    {    159,10}, {    319, 9}, {    639,10}, {    335, 9}, \
-    {    671,10}, {    351, 9}, {    703, 8}, {   1407,10}, \
-    {    383, 9}, {    767,10}, {    415, 9}, {    831,11}, \
-    {    223,10}, {    447,12}, {   4096,13}, {   8192,14}, \
-    {  16384,15}, {  32768,16} }
-#define MUL_FFT_TABLE3_SIZE 90
-#define MUL_FFT_THRESHOLD                 4736
-
-#define SQR_FFT_MODF_THRESHOLD             308  /* k = 5 */
+    {    159,10}, {    335, 9}, {    671, 8}, {   1343,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, 9}, {   1343,11}, {    351,10}, \
+    {    703, 9}, {   1407,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}, {    767,10}, {   1535,11}, {    831,12}, \
+    {    447,10}, {   1791,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}, {    767,11}, {   1535,12}, \
+    {    831,11}, {   1727,10}, {   3455,11}, {   1791,12}, \
+    {    959,14}, {    255,13}, {    511,12}, {   1215,11}, \
+    {   2431,13}, {    639,12}, {   1471,13}, {    767,12}, \
+    {   1727,11}, {   3455,12}, {   1791,14}, {    511,13}, \
+    {   1151,12}, {   2431,13}, {   8192,14}, {  16384,15}, \
+    {  32768,16} }
+#define MUL_FFT_TABLE3_SIZE 157
+#define MUL_FFT_THRESHOLD                 6784
+
+#define SQR_FFT_MODF_THRESHOLD             340  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    308, 5}, {     15, 6}, {      8, 5}, {     19, 6}, \
-    {     10, 5}, {     21, 6}, {     21, 7}, {     11, 6}, \
-    {     24, 7}, {     13, 6}, {     27, 7}, {     15, 6}, \
-    {     31, 7}, {     21, 8}, {     11, 7}, {     27, 8}, \
+  { {    340, 5}, {     21, 6}, {     11, 5}, {     23, 6}, \
+    {     21, 7}, {     11, 6}, {     24, 7}, {     13, 6}, \
+    {     28, 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, 9}, {     95,11}, {     31,10}, \
-    {     63, 9}, {    127, 8}, {    255, 9}, {    135,10}, \
-    {     79, 9}, {    159, 8}, {    319, 9}, {    175,10}, \
-    {     95, 9}, {    191, 8}, {    383, 9}, {    207,11}, \
-    {     63,10}, {    127, 9}, {    255, 8}, {    511, 9}, \
-    {    271,10}, {    143, 9}, {    287, 8}, {    575,10}, \
-    {    159, 9}, {    319,10}, {    175,11}, {     95,10}, \
-    {    191, 9}, {    383,10}, {    207,12}, {     63,11}, \
-    {    127,10}, {    255, 9}, {    511,10}, {    271, 9}, \
-    {    543, 8}, {   1087,10}, {    287, 9}, {    575,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}, \
-    {   4096,13}, {   8192,14}, {  16384,15}, {  32768,16} }
-#define SQR_FFT_TABLE3_SIZE 88
-#define SQR_FFT_THRESHOLD                 3520
+    {     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, 8}, \
+    {    319,10}, {     95, 9}, {    191, 8}, {    383, 9}, \
+    {    207,11}, {     63,10}, {    127, 9}, {    255, 8}, \
+    {    511, 9}, {    271,10}, {    143, 9}, {    287, 8}, \
+    {    575, 9}, {    303, 8}, {    607,10}, {    159, 9}, \
+    {    319,10}, {    175,11}, {     95,10}, {    191, 9}, \
+    {    383,10}, {    207,12}, {     63,11}, {    127,10}, \
+    {    255, 9}, {    511,10}, {    271, 9}, {    543, 8}, \
+    {   1087,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}, {    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}, {    479,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,12}, {    639,11}, {   1343,12}, {    703,11}, \
+    {   1407,13}, {    383,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}, {   8192,14}, \
+    {  16384,15}, {  32768,16} }
+#define SQR_FFT_TABLE3_SIZE 150
+#define SQR_FFT_THRESHOLD                 4736
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
-#define MULLO_DC_THRESHOLD                  62
-#define MULLO_MUL_N_THRESHOLD             8907
+#define MULLO_DC_THRESHOLD                  55
+#define MULLO_MUL_N_THRESHOLD            13463
 
-#define DC_DIV_QR_THRESHOLD                 53
-#define DC_DIVAPPR_Q_THRESHOLD             216
-#define DC_BDIV_QR_THRESHOLD                67
-#define DC_BDIV_Q_THRESHOLD                180
+#define DC_DIV_QR_THRESHOLD                 50
+#define DC_DIVAPPR_Q_THRESHOLD             196
+#define DC_BDIV_QR_THRESHOLD                51
+#define DC_BDIV_Q_THRESHOLD                166
 
-#define INV_MULMOD_BNM1_THRESHOLD           58
+#define INV_MULMOD_BNM1_THRESHOLD           50
 #define INV_NEWTON_THRESHOLD               226
-#define INV_APPR_THRESHOLD                 228
+#define INV_APPR_THRESHOLD                 202
 
-#define BINV_NEWTON_THRESHOLD              252
+#define BINV_NEWTON_THRESHOLD              228
 #define REDC_1_TO_REDC_N_THRESHOLD          67
 
 #define MU_DIV_QR_THRESHOLD               1187
 #define MU_DIVAPPR_Q_THRESHOLD            1308
 #define MUPI_DIV_QR_THRESHOLD              114
-#define MU_BDIV_QR_THRESHOLD              1017
-#define MU_BDIV_Q_THRESHOLD               1187
+#define MU_BDIV_QR_THRESHOLD               998
+#define MU_BDIV_Q_THRESHOLD               1142
+
+#define POWM_SEC_TABLE  3,28,78,480,1099
 
-#define MATRIX22_STRASSEN_THRESHOLD         15
-#define HGCD_THRESHOLD                      97
-#define GCD_DC_THRESHOLD                   386
-#define GCDEXT_DC_THRESHOLD                298
+#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               318
-#define SET_STR_PRECOMPUTE_THRESHOLD       929
+#define SET_STR_DC_THRESHOLD               381
+#define SET_STR_PRECOMPUTE_THRESHOLD      1002
+
+#define FAC_DSC_THRESHOLD                  179
+#define FAC_ODD_THRESHOLD                   28
index ba210ecc4222381effa5118498d036d8f71bc220..faa1e81da41bdb5203e81e0bf9ee16cf2c82be09 100644 (file)
@@ -1,25 +1,35 @@
 /* PowerPC-32 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009,
-2010, 2011 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2004, 2008-2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 /* 1650 MHz POWER5 */
 
index 529a66d198d8149d0eea52e363ca7e73dc66f166..c9504b63b3134a2d2a15a0e519df9eb345182c99 100644 (file)
@@ -1,25 +1,35 @@
 /* PowerPC-32 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009,
-2010, 2011 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2004, 2008-2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 /* 3500 MHz POWER6 */
 
index bd18d4042b5d471f9e493be8ab2616771fe8be8e..35bb61dca26074b5b06d3a0edb4889c736e19e49 100644 (file)
@@ -1,25 +1,35 @@
 /* PowerPC-32 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009,
-2010, 2011 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2004, 2008-2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 /* 3550 MHz POWER7/T4 */
 
index 33cf97e3873af9dfa9b2dbfa88207a74302c3a8e..0c142a2e0cf49c75f6416b7561288dfc5220088e 100644 (file)
@@ -3,21 +3,32 @@ divert(-1)
 dnl  m4 macros for PowerPC assembler (32 and 64 bit).
 
 dnl  Copyright 2000, 2002, 2003 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
index d9a74011c6b76eb8b6759883124b3ca3a85637ef..cb0046d5ee9a66bc56c2fc00eb4b4d03cda082db 100644 (file)
@@ -1,22 +1,32 @@
 dnl  PowerPC-32 mpn_rshift -- Shift a number right.
 
-dnl  Copyright 1995, 1998, 2000, 2002, 2003, 2004, 2005 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 1995, 1998, 2000, 2002-2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/powerpc32/sec_tabselect.asm b/mpn/powerpc32/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..a3f24d5
--- /dev/null
@@ -0,0 +1,141 @@
+dnl  PowerPC-32 mpn_sec_tabselect.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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')
+
+C                   cycles/limb
+C 603e:                         ?
+C 604e:                         ?
+C 75x (G3):             ?
+C 7400,7410 (G4):       2.5
+C 744x,745x (G4+):      2.0
+C power4/ppc970:        2.0
+C power5:               ?
+
+define(`rp',     `r3')
+define(`tp',     `r4')
+define(`n',      `r5')
+define(`nents',  `r6')
+define(`which',  `r7')
+
+define(`i',      `r8')
+define(`j',      `r9')
+define(`stride', `r12')
+define(`mask',   `r11')
+
+
+ASM_START()
+PROLOGUE(mpn_sec_tabselect)
+       addic.  j, n, -4                C outer loop induction variable
+       stmw    r27, -32(r1)
+       slwi    stride, n, 2
+
+       blt     cr0, L(outer_end)
+L(outer_top):
+       mtctr   nents
+       mr      r10, tp
+       li      r28, 0
+       li      r29, 0
+       li      r30, 0
+       li      r31, 0
+       addic.  j, j, -4                C outer loop induction variable
+       mr      i, which
+
+       ALIGN(16)
+L(top):        addic   i, i, -1                C set carry iff i != 0
+       subfe   mask, mask, mask
+       lwz     r0, 0(tp)
+       lwz     r27, 4(tp)
+       and     r0, r0, mask
+       and     r27, r27, mask
+       or      r28, r28, r0
+       or      r29, r29, r27
+       lwz     r0, 8(tp)
+       lwz     r27, 12(tp)
+       and     r0, r0, mask
+       and     r27, r27, mask
+       or      r30, r30, r0
+       or      r31, r31, r27
+       add     tp, tp, stride
+       bdnz    L(top)
+
+       stw     r28, 0(rp)
+       stw     r29, 4(rp)
+       stw     r30, 8(rp)
+       stw     r31, 12(rp)
+       addi    tp, r10, 16
+       addi    rp, rp, 16
+       bge     cr0, L(outer_top)
+L(outer_end):
+
+       andi.   r0, n, 2
+       beq     cr0, L(b0x)
+L(b1x):        mtctr   nents
+       mr      r10, tp
+       li      r28, 0
+       li      r29, 0
+       mr      i, which
+       ALIGN(16)
+L(tp2):        addic   i, i, -1
+       subfe   mask, mask, mask
+       lwz     r0, 0(tp)
+       lwz     r27, 4(tp)
+       and     r0, r0, mask
+       and     r27, r27, mask
+       or      r28, r28, r0
+       or      r29, r29, r27
+       add     tp, tp, stride
+       bdnz    L(tp2)
+       stw     r28, 0(rp)
+       stw     r29, 4(rp)
+       addi    tp, r10, 8
+       addi    rp, rp, 8
+
+L(b0x):        andi.   r0, n, 1
+       beq     cr0, L(b00)
+L(b01):        mtctr   nents
+       mr      r10, tp
+       li      r28, 0
+       mr      i, which
+       ALIGN(16)
+L(tp1):        addic   i, i, -1
+       subfe   mask, mask, mask
+       lwz     r0, 0(tp)
+       and     r0, r0, mask
+       or      r28, r28, r0
+       add     tp, tp, stride
+       bdnz    L(tp1)
+       stw     r28, 0(rp)
+
+L(b00):        lmw     r27, -32(r1)
+       blr
+EPILOGUE()
diff --git a/mpn/powerpc32/sqr_diag_addlsh1.asm b/mpn/powerpc32/sqr_diag_addlsh1.asm
new file mode 100644 (file)
index 0000000..f7aba33
--- /dev/null
@@ -0,0 +1,80 @@
+dnl  PowerPC-32 mpn_sqr_diag_addlsh1.
+
+dnl  Copyright 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 603e                  ?
+C 604e                  ?
+C 75x (G3)              ?
+C 7400,7410 (G4)        ?
+C 744x,745x (G4+)       6
+C power4/ppc970                 ?
+C power5                ?
+
+C This has been feebly optimised for 7447 but not for any other CPU.
+
+define(`rp',   r3)
+define(`tp',   r4)
+define(`up',   r5)
+define(`n',    r6)
+
+ASM_START()
+PROLOGUE(mpn_sqr_diag_addlsh1)
+       addi    n, n, -1
+       addi    tp, tp, -4
+       mtctr   n
+       lwz     r0, 0(up)
+       li      r10, 0
+       mullw   r7, r0, r0
+       stw     r7, 0(rp)
+       mulhwu  r6, r0, r0
+       addic   r31, r31, 0     C clear CF
+
+       ALIGN(16)
+L(top):        lwzu    r0, 4(up)
+       mullw   r7, r0, r0
+       lwz     r8, 4(tp)
+       lwzu    r9, 8(tp)
+       rlwimi  r10, r8, 1,0,30
+       srwi    r11, r8, 31
+       rlwimi  r11, r9, 1,0,30
+       adde    r10, r10, r6
+       adde    r11, r11, r7
+       stw     r10, 4(rp)
+       srwi    r10, r9, 31
+       mulhwu  r6, r0, r0
+       stwu    r11, 8(rp)
+       bdnz    L(top)
+
+       adde    r10, r10, r6
+       stw     r10, 4(rp)
+       blr
+EPILOGUE()
diff --git a/mpn/powerpc32/sqr_diagonal.asm b/mpn/powerpc32/sqr_diagonal.asm
deleted file mode 100644 (file)
index d315349..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-dnl  PowerPC-32 mpn_sqr_diagonal.
-
-dnl  Copyright 2001, 2002, 2003, 2005 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 603e:             ?
-C 604e:             4.0
-C 75x (G3):        10.5
-C 7400,7410 (G4):  10.5
-C 744x,745x (G4+):  4.0
-C power4/ppc970:    8.6
-C power5:           7.0
-
-C INPUT PARAMETERS
-C rp   r3
-C up   r4
-C n    r5
-
-ASM_START()
-PROLOGUE(mpn_sqr_diagonal)
-       lwz     r6,0(r4)
-       mtctr   r5
-
-       addi    r3,r3,-4
-       bdz     L(end1)
-
-       lwzu    r7,4(r4)
-       mullw   r9,r6,r6
-       mulhwu  r11,r6,r6
-       bdz     L(end2)
-
-       lwzu    r6,4(r4)
-       mullw   r8,r7,r7
-       mulhwu  r10,r7,r7
-       bdz     L(ende)
-
-L(loop):
-       lwzu    r7,4(r4)
-       stw     r9,4(r3)
-       mullw   r9,r6,r6
-       stwu    r11,8(r3)
-       mulhwu  r11,r6,r6
-       bdz     L(endo)
-       lwzu    r6,4(r4)
-       stw     r8,4(r3)
-       mullw   r8,r7,r7
-       stwu    r10,8(r3)
-       mulhwu  r10,r7,r7
-       bdnz    L(loop)
-
-L(ende):
-       stw     r9,4(r3)
-       mullw   r9,r6,r6
-       stw     r11,8(r3)
-       mulhwu  r11,r6,r6
-       stw     r8,12(r3)
-       stw     r10,16(r3)
-       stw     r9,20(r3)
-       stw     r11,24(r3)
-       blr
-L(endo):
-       stw     r8,4(r3)
-       mullw   r8,r7,r7
-       stw     r10,8(r3)
-       mulhwu  r10,r7,r7
-       stw     r9,12(r3)
-       stw     r11,16(r3)
-       stw     r8,20(r3)
-       stw     r10,24(r3)
-       blr
-
-L(end2):
-       mullw   r8,r7,r7
-       stw     r9,4(r3)
-       mulhwu  r10,r7,r7
-       stw     r11,8(r3)
-       stw     r8,12(r3)
-       stw     r10,16(r3)
-       blr
-L(end1):
-       mullw   r9,r6,r6
-       mulhwu  r11,r6,r6
-       stw     r9,4(r3)
-       stw     r11,8(r3)
-       blr
-EPILOGUE(mpn_sqr_diagonal)
index c8711d09a66c35966f7cee97a1c13852b345d401..6dc6460016f9faa972727cd218d8804655e3f7b3 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-32 mpn_sublsh1_n -- rp[] = up[] - (vp[] << 1)
 dnl  Copyright 2003, 2005, 2007 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index ae40bb447300e0daffe60f2e0dbb82e8b8a43e51..9fcdaa291b001f44bb35ab9de849fe6865ec7efb 100644 (file)
@@ -5,19 +5,30 @@ dnl  Copyright 1995, 1997, 1998, 2000, 2002, 2005 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/powerpc32/tabselect.asm b/mpn/powerpc32/tabselect.asm
deleted file mode 100644 (file)
index 155a7b4..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-dnl  PowerPC-32 mpn_tabselect.
-
-dnl  Copyright 2011 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 603e:              ?
-C 604e:              ?
-C 75x (G3):          ?
-C 7400,7410 (G4):    ?
-C 744x,745x (G4+):   ?
-C power4/ppc970:     3.3
-C power5:            ?
-
-C NOTES
-C  * This has not been tuned for any specific processor.  Its speed should not
-C    be too bad, though.
-C  * Using VMX could result in significant speedup for certain CPUs.
-
-C mpn_tabselect (mp_limb_t *rp, mp_limb_t *tp, mp_size_t n, mp_size_t nents, mp_size_t which)
-define(`rp',     `r3')
-define(`tp',     `r4')
-define(`n',      `r5')
-define(`nents',  `r6')
-define(`which',  `r7')
-
-define(`mask',   `r8')
-
-ASM_START()
-       TEXT
-       ALIGN(16)
-PROLOGUE(mpn_tabselect)
-       addi    r0, n, 1
-       srwi    r0, r0, 1               C inner loop count
-       andi.   r9, n, 1                C set cr0 for use in inner loop
-       subf    which, nents, which
-       slwi    n, n, 2
-
-L(outer):
-       mtctr   r0                      C put inner loop count in ctr
-
-       add     r9, which, nents        C are we at the selected table entry?
-       addic   r9, r9, -1              C set CF iff not selected entry
-       subfe   mask, r0, r0
-
-       beq     cr0, L(top)             C branch to loop entry if n even
-
-       lwz     r9, 0(tp)
-       addi    tp, tp, 4
-       and     r9, r9, mask
-       lwz     r11, 0(rp)
-       andc    r11, r11, mask
-       or      r9, r9, r11
-       stw     r9, 0(rp)
-       addi    rp, rp, 4
-       bdz     L(end)
-
-       ALIGN(16)
-L(top):        lwz     r9, 0(tp)
-       lwz     r10, 4(tp)
-       addi    tp, tp, 8
-       nop
-       and     r9, r9, mask
-       and     r10, r10, mask
-       lwz     r11, 0(rp)
-       lwz     r12, 4(rp)
-       andc    r11, r11, mask
-       andc    r12, r12, mask
-       or      r9, r9, r11
-       or      r10, r10, r12
-       stw     r9, 0(rp)
-       stw     r10, 4(rp)
-       addi    rp, rp, 8
-       bdnz    L(top)
-
-L(end):        subf    rp, n, rp               C move rp back to beginning
-       cmpwi   cr6, nents, 1
-       addi    nents, nents, -1
-       bne     cr6, L(outer)
-
-       blr
-EPILOGUE()
index 400f009337fca107a785385019a46bc3c9f79261..a5811e1651f296b2ce84d550a56cc88e7ac84600 100644 (file)
@@ -1,21 +1,32 @@
-dnl PowerPC-32 umul_ppmm -- support for longlong.h
+dnl  PowerPC-32 umul_ppmm -- support for longlong.h
 
-dnl Copyright 2000, 2001 Free Software Foundation, Inc.
+dnl  Copyright 2000, 2001 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 This file is part of the GNU MP Library.
+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 The GNU MP Library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public License as
-dnl published by the Free Software Foundation; either version 3 of the
-dnl License, or (at your option) any later version.
+dnl  or both in parallel, as here.
 dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
-dnl General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index e56f21c0506ae0495f1f7069b1bc058887d8742c..6aac6b8389691ecd6cffee433f3263529271df3a 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-32/VMX and PowerPC-64/VMX mpn_copyd.
 dnl  Copyright 2006 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 6c8303ac2546def936ca93bde3074545fed92eed..a97a0fa6dc840513eb0c7a5bf0ba1512cc05f30a 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-32/VMX and PowerPC-64/VMX mpn_copyi.
 dnl  Copyright 2006 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 7ed731e483b3d381195f382e3ae100dcdc1f0dfc..d656d3b73f7bc2780cbe87dfaeabf26a13afe389 100644 (file)
@@ -5,19 +5,30 @@ dnl  logical operations.
 dnl  Copyright 2006 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 3c561fc8baad044c37e78380670fbc647d471d80..9b7e4f1a503f441f97d57a57c44a04ed40fdba25 100644 (file)
@@ -1,22 +1,32 @@
 dnl  PowerPC-32 mpn_mod_34lsub1 -- mpn remainder mod 2^24-1.
 
-dnl  Copyright 2002, 2003, 2005, 2006, 2007, 2012 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 2002, 2003, 2005-2007, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 3e0db3336b6257b93a172491212273972d785b75..943c92d127305abf99e51c3b5b8bf99e24821546 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-32/VMX mpn_popcount.
 dnl  Copyright 2006 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 020ad23cd506fe4e0a6aeb06ecb62316e117f944..50dd3995c3db0936b0254338290d376599935c37 100644 (file)
@@ -1,19 +1,30 @@
-Copyright 1999, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
+Copyright 1999-2001, 2003-2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
@@ -139,7 +150,7 @@ Problem is to get 32-bit or 16-bit words to the fp registers.  Only 64-bit fp
 memops copies bits without fiddling with them.  We might therefore need to
 load to integer registers with zero extension, store as 64 bits into temp
 space, and then load to fp regs.  Alternatively, load directly to fp space
-and add well-chosen constants to get cancelation.  (Other part after given by
+and add well-chosen constants to get cancellation.  (Other part after given by
 subsequent subtraction.)
 
 Possible code mix for load-via-intregs variant:
index 88c89b018a42aaaaf27def9992b5d9adb8dc42b5..bf6517d69d93fed72312195fc376baf701466c09 100644 (file)
@@ -1,36 +1,47 @@
 divert(-1)
 dnl  m4 macros for AIX 64-bit assembly.
 
-dnl  Copyright 2000, 2001, 2002, 2005, 2006, 2010, 2012 Free Software
-dnl  Foundation, Inc.
-dnl
+dnl  Copyright 2000-2002, 2005, 2006, 2010, 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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  The GNU MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+dnl  or both in parallel, as here.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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/.
 
 define(`ASM_START',
        `.machine       "any"
        .toc')
 
-dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
+dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
 dnl          EPILOGUE_cpu(GSYM_PREFIX`'foo)
 dnl
 dnl  Don't want ELF style .size in the epilogue.
 
 define(`PROLOGUE_cpu',
-m4_assert_numargs(1)
-       `
+m4_assert_numargs_range(1,2)
+`ifelse(`$2',toc,,
+`ifelse(`$2',,,`m4_error(`Unrecognised PROLOGUE parameter')')')dnl
        .globl  $1
        .globl  .$1
        .csect  [DS], 3
@@ -81,4 +92,6 @@ define(`CALL',
 
 define(`ASM_END', `TOC_ENTRY')
 
+undefine(`EXTRA_REGISTER')
+
 divert
index cb89bade2cc9e785f6e0a93293cedeb40afaeff0..074b7ff6e4f10a223bee45a1ae3c1eea4524dc00 100644 (file)
 dnl  PowerPC-64 mpn_com.
 
-dnl  Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
+dnl  Copyright 2004, 2005, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C                  cycles/limb
-C POWER3/PPC630          1?
-C POWER4/PPC970          1.6
+C POWER3/PPC630          ?
+C POWER4/PPC970          1.25
 C POWER5                 ?
-C POWER6                 ?
-C POWER7                 1.45
-
-C TODO
-C  * 8-way unrolling brings timing down to about 1.3 cycles/limb.
+C POWER6                 1.32
+C POWER7                 1.13
 
 C INPUT PARAMETERS
-C rp   r3
-C up   r4
-C n    r5
+define(`rp',   `r3')
+define(`up',   `r4')
+define(`n',    `r5')
 
 ASM_START()
 PROLOGUE(mpn_com)
-       rldic.  r0, r5, 3, 59   C r0 = (r5 & 3) << 3; cr0 = (n == 4t)?
-       cmpldi  cr6, r0, 16     C cr6 = (n cmp 4t + 2)?
 
-       addi    r5, r5, 3       C compute...
 ifdef(`HAVE_ABI_mode32',
-`      rldicl  r5, r5, 62,34', C ...branch count
-`      rldicl  r5, r5, 62, 2') C ...branch count
-       mtctr   r5
+`      rldicl  n, n, 0,32')
 
-       add     r4, r4, r0      C offset up
-       add     r3, r3, r0      C offset rp
+       cmpdi   cr0, n, 4
+       blt     L(sml)
 
-       beq     cr0, L(L00)
-       blt     cr6, L(L01)
-       beq     cr6, L(L10)
-       b       L(L11)
+       addi    r10, n, 4
+       srdi    r10, r10, 3
+       mtctr   r10
 
-L(L00):        addi    r4, r4, 32
-       addi    r3, r3, 32
+       andi.   r0, n, 1
+       rlwinm  r11, n, 0,30,30
+       rlwinm  r12, n, 0,29,29
+       cmpdi   cr6, r11, 0
+       cmpdi   cr7, r12, 0
 
-       ALIGN(16)
-L(oop):        ld      r6, -32(r4)
+       beq     cr0, L(xx0)
+L(xx1):        ld      r6, 0(up)
+       addi    up, up, 8
        nor     r6, r6, r6
-       std     r6, -32(r3)
-L(L11):        ld      r6, -24(r4)
+       std     r6, 0(rp)
+       addi    rp, rp, 8
+
+L(xx0):        bne     cr6, L(x10)
+L(x00):        ld      r6, 0(r4)
+       ld      r7, 8(r4)
+       bne     cr7, L(100)
+L(000):        addi    rp, rp, -32
+       b       L(lo0)
+L(100):        addi    up, up, -32
+       b       L(lo4)
+L(x10):        ld      r8, 0(r4)
+       ld      r9, 8(r4)
+       bne     cr7, L(110)
+L(010):        addi    up, up, 16
+       addi    rp, rp, -16
+       b       L(lo2)
+L(110):        addi    up, up, -16
+       addi    rp, rp, -48
+       b       L(lo6)
+
+L(sml):        mtctr   n
+L(t):  ld      r6, 0(up)
+       addi    up, up, 8
        nor     r6, r6, r6
-       std     r6, -24(r3)
-L(L10):        ld      r6, -16(r4)
-       nor     r6, r6, r6
-       std     r6, -16(r3)
-L(L01):        ld      r6, -8(r4)
-       nor     r6, r6, r6
-       addi    r4, r4, 32
-       std     r6, -8(r3)
-       addi    r3, r3, 32
-       bdnz    L(oop)
+       std     r6, 0(rp)
+       addi    rp, rp, 8
+       bdnz    L(t)
+       blr
 
+       ALIGN(32)
+L(top):        nor     r6, r6, r6
+       nor     r7, r7, r7
+       std     r6, 0(rp)
+       std     r7, 8(rp)
+L(lo2):        ld      r6, 0(up)
+       ld      r7, 8(up)
+       nor     r8, r8, r8
+       nor     r9, r9, r9
+       std     r8, 16(rp)
+       std     r9, 24(rp)
+L(lo0):        ld      r8, 16(up)
+       ld      r9, 24(up)
+       nor     r6, r6, r6
+       nor     r7, r7, r7
+       std     r6, 32(rp)
+       std     r7, 40(rp)
+L(lo6):        ld      r6, 32(up)
+       ld      r7, 40(up)
+       nor     r8, r8, r8
+       nor     r9, r9, r9
+       std     r8, 48(rp)
+       std     r9, 56(rp)
+       addi    rp, rp, 64
+L(lo4):        ld      r8, 48(up)
+       ld      r9, 56(up)
+       addi    up, up, 64
+       bdnz    L(top)
+
+L(end):        nor     r6, r6, r6
+       nor     r7, r7, r7
+       std     r6, 0(rp)
+       std     r7, 8(rp)
+       nor     r8, r8, r8
+       nor     r9, r9, r9
+       std     r8, 16(rp)
+       std     r9, 24(rp)
        blr
 EPILOGUE()
index 256e7dc1224ebf9c53ed2c0b36bc60a7c6ef0028..c6ce9309f1d689a19680b17c39f160ba3ad10f98 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-64 mpn_copyd
 dnl  Copyright 2004, 2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 31d1fc2e78b18bbd4be22b52b7a5962bb76ab34f..9a86cb21cc62d6c3efb7b7e8a44a79268d6eb8f8 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-64 mpn_copyi.
 dnl  Copyright 2004, 2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index c0c0b2e84364f24769022e7e621f24133e00069a..a3180e48fd77312ce150e879819f715e2d99e075 100644 (file)
@@ -2,33 +2,46 @@ divert(-1)
 dnl  m4 macros for Mac OS 64-bit assembly.
 
 dnl  Copyright 2005, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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  The GNU MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+dnl  or both in parallel, as here.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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/.
 
 define(`ASM_START',`')
 
-dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
+dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
 dnl          EPILOGUE_cpu(GSYM_PREFIX`'foo)
 dnl
 
 define(`DARWIN')
 
 define(`PROLOGUE_cpu',
-m4_assert_numargs(1)
-`      .text
+m4_assert_numargs_range(1,2)
+`ifelse(`$2',toc,,
+`ifelse(`$2',,,`m4_error(`Unrecognised PROLOGUE parameter')')')dnl
+       .text
        .globl  $1
        .align  5
 $1:')
@@ -101,4 +114,6 @@ define(`CALL',
 
 define(`ASM_END', `dnl')
 
+define(`EXTRA_REGISTER', r2)
+
 divert
index c8d9015a8fdfdd669beb4e215d5fb8e8edb25cb9..ddb5a8ed79ddc1a20782b87a775a651bbce84a3c 100644 (file)
@@ -2,31 +2,60 @@ divert(-1)
 dnl  m4 macros for powerpc64 GNU/Linux assembly.
 
 dnl  Copyright 2003, 2005, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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 MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or 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/.
 
-define(`ASM_START',`')
+define(`ASM_START',
+`ifdef(`ELFv2_ABI',
+`
+       .abiversion 2
+')')
 
-dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
+dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
 dnl          EPILOGUE_cpu(GSYM_PREFIX`'foo)
 dnl
 
 define(`PROLOGUE_cpu',
-m4_assert_numargs(1)
-       `
+m4_assert_numargs_range(1,2)
+`ifelse(`$2',toc,,
+`ifelse(`$2',,,`m4_error(`Unrecognised PROLOGUE parameter')')')dnl
+ifdef(`ELFv2_ABI',
+`
+       .globl  $1
+       .type   $1, @function
+       .section        ".text"
+       .align  5
+$1:
+ifelse(`$2',toc,`
+0:     addis   2, 12, (.TOC.-0b)@ha
+       addi    2, 2, (.TOC.-0b)@l
+       .localentry $1, .-$1
+',)
+',`
        .globl  $1
        .globl  .$1
        .section        ".opd","aw"
@@ -37,11 +66,16 @@ $1:
        .type   .$1, @function
        .section        ".text"
        .align  5
-.$1:')
+.$1:
+')')
 
 define(`EPILOGUE_cpu',
 m4_assert_numargs(1)
-`      .size   .$1, .-.$1')
+`ifdef(`ELFv2_ABI',`
+       .size   $1, .-$1
+',`
+       .size   .$1, .-.$1
+')')
 
 define(`TOC_ENTRY', `')
 
@@ -84,4 +118,6 @@ define(`CALL',
 
 define(`ASM_END', `TOC_ENTRY')
 
+undefine(`EXTRA_REGISTER')
+
 divert
index 2caa2c7c638a6b2acfa2466f45977b3ee8c5b927..2fa6985d7a43a84a942ad865c7fb68d388a85bee 100644 (file)
@@ -1,22 +1,33 @@
 dnl  PowerPC-64 mpn_and_n, mpn_andn_n, mpn_nand_n, mpn_ior_n, mpn_iorn_n,
 dnl  mpn_nior_n, mpn_xor_n, mpn_xnor_n -- mpn bitwise logical operations.
 
-dnl  Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
+dnl  Copyright 2003-2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index eb70c498316fa54344cab2327b1315c1055da0d2..880944a4aed4ca70a307ee952d0cc407e0221de4 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-64 mpn_lshift -- rp[] = up[] << cnt
 dnl  Copyright 2003, 2005, 2010, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 8f470a5f4816b821e4f601dba99bed2cbb00bfb5..7cf6a83428c59b2e4dc2f673845909be6c2f1886 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-64 mpn_lshiftc -- rp[] = ~up[] << cnt
 dnl  Copyright 2003, 2005, 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -30,6 +41,7 @@ C TODO
 C  * Try to reduce the number of needed live registers
 C  * Micro-optimise header code
 C  * Keep in synch with lshift.asm and rshift.asm
+C  * Could the long-scheduled std insns be less scheduled?
 
 C INPUT PARAMETERS
 define(`rp',  `r3')
index 4c62041e73206f2208ad9221a32304c74f8037ec..1da8087fe136b8c681e127ce833c997f143df340 100644 (file)
@@ -1,22 +1,33 @@
 dnl  PowerPC-64/mode32 mpn_add_n -- Add two limb vectors of the same length > 0
 dnl  and store sum in a third limb vector.
 
-dnl  Copyright 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
+dnl  Copyright 1999-2001, 2003, 2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 41a90781a5b6bc844f2b54a492be932a29eb76a1..bdc39512ac58af4aa38f31a832b0927b9ed8a5a7 100644 (file)
@@ -1,22 +1,33 @@
 dnl  PowerPC-64 mpn_addmul_1 -- Multiply a limb vector with a limb and add
 dnl  the result to a second limb vector.
 
-dnl  Copyright 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
+dnl  Copyright 1999-2001, 2003, 2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 091be4d2729d792a4669d9edb22dbf63a0e87f07..3a17e98797279becf557da3215a44f048d4240ab 100644 (file)
@@ -1,22 +1,33 @@
 dnl  PowerPC-64 mpn_mul_1 -- Multiply a limb vector with a limb and add
 dnl  the result to a second limb vector.
 
-dnl  Copyright 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
+dnl  Copyright 1999-2001, 2003, 2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index db296f0f272f9edfce7e4177e0b823243c77a8c3..a7271381c5ca2c018fad023cd1fe98944653c842 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2008, 2009, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* 1800 MHz PPC970 */
 
index 01cfa9d84cb8fccea8f2777ece9a3a3a81afa459..ff5f4b3cfba7142bd24d2444973cce26ab149073 100644 (file)
@@ -1,22 +1,32 @@
 dnl  PowerPC-64 mpn_sqr_diagonal.
 
-dnl  Copyright 2001, 2002, 2003, 2005, 2006, 20010 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 2001-2003, 2005, 2006, 20010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 5bcc4a47b504715f2ca76a65cc2e3ab00ba7679b..6fdc1d471970fda25cd4ed6c05a53cf33710e16b 100644 (file)
@@ -1,22 +1,33 @@
 dnl  PowerPC-64/mode32 mpn_sub_n -- Subtract two limb vectors of the same
 dnl  length and store difference in a third limb vector.
 
-dnl  Copyright 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
+dnl  Copyright 1999-2001, 2003, 2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 44ac326994f5bf81b6eaec455fb297261c2679a9..22601c417e2fcca97f0e3b2d37d5088a37343f9f 100644 (file)
@@ -1,22 +1,33 @@
 dnl  PowerPC-64 mpn_submul_1 -- Multiply a limb vector with a limb and subtract
 dnl  the result from a second limb vector.
 
-dnl  Copyright 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
+dnl  Copyright 1999-2001, 2003, 2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 8c30871c2dd1642684c5e8c0aaca393ed3fbd588..0e8474fdcc227b99917c75a2c4c4bf58d028ef86 100644 (file)
@@ -1,22 +1,32 @@
 dnl  PowerPC-64 mpn_add_n/mpn_sub_n -- mpn addition and subtraction.
 
-dnl  Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2011 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 1999-2001, 2003-2005, 2007, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/powerpc64/mode64/aorscnd_n.asm b/mpn/powerpc64/mode64/aorscnd_n.asm
deleted file mode 100644 (file)
index ad143b6..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-dnl  PowerPC-64 mpn_addcnd_n/mpn_subcnd_n.
-
-dnl  Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2011, 2012 Free
-dnl  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 POWER3/PPC630          ?
-C POWER4/PPC970          2.25
-C POWER5                 ?
-C POWER6                 3
-C POWER7                 ?
-
-C INPUT PARAMETERS
-define(`rp',   `r3')
-define(`up',   `r4')
-define(`vp',   `r5')
-define(`n',    `r6')
-define(`cnd',  `r7')
-
-ifdef(`OPERATION_addcnd_n',`
-  define(ADDSUBC,      adde)
-  define(ADDSUB,       addc)
-  define(func,         mpn_addcnd_n)
-  define(GENRVAL,      `addi   r3, r3, 1')
-  define(SETCBR,       `addic  r0, $1, -1')
-  define(CLRCB,                `addic  r0, r0, 0')
-')
-ifdef(`OPERATION_subcnd_n',`
-  define(ADDSUBC,      subfe)
-  define(ADDSUB,       subfc)
-  define(func,         mpn_subcnd_n)
-  define(GENRVAL,      `neg    r3, r3')
-  define(SETCBR,       `subfic r0, $1, 0')
-  define(CLRCB,                `addic  r0, r1, -1')
-')
-
-MULFUNC_PROLOGUE(mpn_addcnd_n mpn_subcnd_n)
-
-ASM_START()
-PROLOGUE(func)
-       std     r31, -8(r1)
-       std     r30, -16(r1)
-       std     r29, -24(r1)
-       std     r28, -32(r1)
-       std     r27, -40(r1)
-
-       subfic  cnd, cnd, 0
-       subfe   cnd, cnd, cnd
-
-       rldicl. r0, r6, 0,62    C r0 = n & 3, set cr0
-       cmpdi   cr6, r0, 2
-       addi    r6, r6, 3       C compute count...
-       srdi    r6, r6, 2       C ...for ctr
-       mtctr   r6              C copy count into ctr
-       beq     cr0, L(b00)
-       blt     cr6, L(b01)
-       beq     cr6, L(b10)
-
-L(b11):        ld      r8, 0(up)       C load s1 limb
-       ld      r9, 0(vp)       C load s2 limb
-       ld      r10, 8(up)      C load s1 limb
-       ld      r11, 8(vp)      C load s2 limb
-       ld      r12, 16(up)     C load s1 limb
-       addi    up, up, 24
-       ld      r0, 16(vp)      C load s2 limb
-       addi    vp, vp, 24
-       and     r9, r9, cnd
-       and     r11, r11, cnd
-       and     r0, r0, cnd
-       ADDSUB  r29, r9, r8
-       ADDSUBC r30, r11, r10
-       ADDSUBC r31, r0, r12
-       std     r29, 0(rp)
-       std     r30, 8(rp)
-       std     r31, 16(rp)
-       addi    rp, rp, 24
-       bdnz    L(go)
-       b       L(ret)
-
-L(b01):        ld      r12, 0(up)      C load s1 limb
-       addi    up, up, 8
-       ld      r0, 0(vp)       C load s2 limb
-       addi    vp, vp, 8
-       and     r0, r0, cnd
-       ADDSUB  r31, r0, r12    C add
-       std     r31, 0(rp)
-       addi    rp, rp, 8
-       bdnz    L(go)
-       b       L(ret)
-
-L(b10):        ld      r10, 0(up)      C load s1 limb
-       ld      r11, 0(vp)      C load s2 limb
-       ld      r12, 8(up)      C load s1 limb
-       addi    up, up, 16
-       ld      r0, 8(vp)       C load s2 limb
-       addi    vp, vp, 16
-       and     r11, r11, cnd
-       and     r0, r0, cnd
-       ADDSUB  r30, r11, r10   C add
-       ADDSUBC r31, r0, r12    C add
-       std     r30, 0(rp)
-       std     r31, 8(rp)
-       addi    rp, rp, 16
-       bdnz    L(go)
-       b       L(ret)
-
-L(b00):        CLRCB                   C clear/set cy
-L(go): ld      r6, 0(up)       C load s1 limb
-       ld      r27, 0(vp)      C load s2 limb
-       ld      r8, 8(up)       C load s1 limb
-       ld      r9, 8(vp)       C load s2 limb
-       ld      r10, 16(up)     C load s1 limb
-       ld      r11, 16(vp)     C load s2 limb
-       ld      r12, 24(up)     C load s1 limb
-       ld      r0, 24(vp)      C load s2 limb
-       and     r27, r27, cnd
-       and     r9, r9, cnd
-       and     r11, r11, cnd
-       and     r0, r0, cnd
-       bdz     L(end)
-
-       addi    up, up, 32
-       addi    vp, vp, 32
-
-L(top):        ADDSUBC r28, r27, r6
-       ld      r6, 0(up)       C load s1 limb
-       ld      r27, 0(vp)      C load s2 limb
-       ADDSUBC r29, r9, r8
-       ld      r8, 8(up)       C load s1 limb
-       ld      r9, 8(vp)       C load s2 limb
-       ADDSUBC r30, r11, r10
-       ld      r10, 16(up)     C load s1 limb
-       ld      r11, 16(vp)     C load s2 limb
-       ADDSUBC r31, r0, r12
-       ld      r12, 24(up)     C load s1 limb
-       ld      r0, 24(vp)      C load s2 limb
-       std     r28, 0(rp)
-       addi    up, up, 32
-       std     r29, 8(rp)
-       addi    vp, vp, 32
-       std     r30, 16(rp)
-       std     r31, 24(rp)
-       addi    rp, rp, 32
-       and     r27, r27, cnd
-       and     r9, r9, cnd
-       and     r11, r11, cnd
-       and     r0, r0, cnd
-       bdnz    L(top)          C decrement ctr and loop back
-
-L(end):        ADDSUBC r28, r27, r6
-       ADDSUBC r29, r9, r8
-       ADDSUBC r30, r11, r10
-       ADDSUBC r31, r0, r12
-       std     r28, 0(rp)
-       std     r29, 8(rp)
-       std     r30, 16(rp)
-       std     r31, 24(rp)
-
-L(ret):        ld      r31, -8(r1)
-       ld      r30, -16(r1)
-       ld      r29, -24(r1)
-       ld      r28, -32(r1)
-       ld      r27, -40(r1)
-
-       subfe   r3, r0, r0      C -cy
-       GENRVAL
-       blr
-EPILOGUE()
diff --git a/mpn/powerpc64/mode64/aorslsh1_n.asm b/mpn/powerpc64/mode64/aorslsh1_n.asm
deleted file mode 100644 (file)
index 0021309..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-dnl  PowerPC-64 mpn_addlsh1_n and mpn_sublsh1_n.
-
-dnl  Copyright 2003, 2005, 2009, 2010 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')
-
-
-define(LSH,            1)
-define(RSH,            63)
-
-ifdef(`OPERATION_addlsh1_n',`
-  define(ADDSUBC,      addc)
-  define(ADDSUBE,      adde)
-  define(INITCY,       `addic  $1, r1, 0')
-  define(RETVAL,       `addze  r3, $1')
-  define(func, mpn_addlsh1_n)
-')
-ifdef(`OPERATION_sublsh1_n',`
-  define(ADDSUBC,      subfc)
-  define(ADDSUBE,      subfe)
-  define(INITCY,       `addic  $1, r1, -1')
-  define(RETVAL,       `subfze r3, $1
-                       neg     r3, r3')
-  define(func, mpn_sublsh1_n)
-')
-
-MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_n)
-
-include_mpn(`powerpc64/mode64/aorslshC_n.asm')
diff --git a/mpn/powerpc64/mode64/aorslsh2_n.asm b/mpn/powerpc64/mode64/aorslsh2_n.asm
deleted file mode 100644 (file)
index 99de79c..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-dnl  PowerPC-64 mpn_addlsh2_n and mpn_sublsh2_n.
-
-dnl  Copyright 2003, 2005, 2009, 2010 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')
-
-
-define(LSH,            2)
-define(RSH,            62)
-
-ifdef(`OPERATION_addlsh2_n',`
-  define(ADDSUBC,      addc)
-  define(ADDSUBE,      adde)
-  define(INITCY,       `addic  $1, r1, 0')
-  define(RETVAL,       `addze  r3, $1')
-  define(func, mpn_addlsh2_n)
-')
-ifdef(`OPERATION_sublsh2_n',`
-  define(ADDSUBC,      subfc)
-  define(ADDSUBE,      subfe)
-  define(INITCY,       `addic  $1, r1, -1')
-  define(RETVAL,       `subfze r3, $1
-                       neg     r3, r3')
-  define(func, mpn_sublsh2_n)
-')
-
-MULFUNC_PROLOGUE(mpn_addlsh2_n mpn_sublsh2_n)
-
-include_mpn(`powerpc64/mode64/aorslshC_n.asm')
diff --git a/mpn/powerpc64/mode64/aorslshC_n.asm b/mpn/powerpc64/mode64/aorslshC_n.asm
deleted file mode 100644 (file)
index 3776d3e..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-dnl  PowerPC-64 mpn_addlshC_n and mpn_sublshC_n, where C is a small constant.
-
-dnl  Copyright 2003, 2005, 2009, 2010 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/.
-
-C                  cycles/limb
-C POWER3/PPC630          1.83   (1.5 c/l should be possible)
-C POWER4/PPC970          3      (2.0 c/l should be possible)
-C POWER5                 3
-C POWER6              3.5-47
-C POWER7                 3
-
-C STATUS
-C  * Try combining upx+up, and vpx+vp.
-C  * The worst case 47 c/l for POWER6 happens if the 3rd operand for ldx is
-C    greater than the 2nd operand.  Yes, this addition is non-commutative wrt
-C    performance.
-
-C INPUT PARAMETERS
-define(`rp', `r3')
-define(`up', `r4')
-define(`vp', `r5')
-define(`n',  `r6')
-
-define(`rpx', `r6')
-define(`upx', `r7')
-define(`vpx', `r12')
-
-define(`s0', `r0')  define(`s1', `r9')
-define(`u0', `r8')
-define(`v0', `r10') define(`v1', `r11')
-
-
-ASM_START()
-PROLOGUE(func)
-       cmpldi  cr0, n, 13
-       bgt     L(big)
-
-       mtctr   n               C copy n in ctr
-       INITCY( r0)             C clear cy
-
-       ld      v0, 0(vp)       C load v limb
-       ld      u0, 0(up)       C load u limb
-       addi    up, up, -8      C update up
-       addi    rp, rp, -8      C update rp
-       sldi    s1, v0, LSH
-       bdz     L(ex1)          C If done, skip loop
-
-       ALIGN(16)
-L(lo0):        ld      v1, 8(vp)       C load v limb
-       ADDSUBE s1, s1, u0      C add limbs with cy, set cy
-       ldu     u0, 16(up)      C load u limb and update up
-       srdi    s0, v0, RSH     C shift down previous v limb
-       std     s1, 8(rp)       C store result limb
-       rldimi  s0, v1, LSH, 0  C left shift v limb and merge with prev v limb
-       bdz     L(ex0)          C decrement ctr and exit if done
-       ldu     v0, 16(vp)      C load v limb and update vp
-       ADDSUBE s0, s0, u0      C add limbs with cy, set cy
-       ld      u0, 8(up)       C load u limb
-       srdi    s1, v1, RSH     C shift down previous v limb
-       stdu    s0, 16(rp)      C store result limb and update rp
-       rldimi  s1, v0, LSH, 0  C left shift v limb and merge with prev v limb
-       bdnz    L(lo0)          C decrement ctr and loop back
-
-L(ex1):        ADDSUBE r7, s1, u0
-       std     r7, 8(rp)       C store last result limb
-       srdi    r0, v0, RSH
-       RETVAL( r0)
-       blr
-L(ex0):        ADDSUBE r7, s0, u0
-       std     r7, 16(rp)      C store last result limb
-       srdi    r0, v1, RSH
-       RETVAL( r0)
-       blr
-
-
-L(big):        rldicl. r0, n, 0,63     C r0 = n & 1, set cr0
-       addi    r6, n, -1       C ...for ctr
-       srdi    r6, r6, 1       C ...for ctr
-       mtctr   r6              C copy count into ctr
-       beq     cr0, L(b0)
-
-L(b1): ld      v1, 0(vp)
-       ld      u0, 0(up)
-       sldi    s1, v1, LSH
-       srdi    s0, v1, RSH
-       ld      v0, 8(vp)
-       ADDSUBC s1, s1, u0      C add limbs without cy, set cy
-       addi    rpx, rp, -16
-       addi    rp, rp, -8
-       sub     upx, up, rp
-       sub     vpx, vp, rp
-       sub     up, up, rpx
-       sub     vp, vp, rpx
-       addi    up, up, 8
-       addi    upx, upx, 16
-       addi    vp, vp, 16
-       addi    vpx, vpx, 24
-       b       L(mid)
-
-L(b0): ld      v0, 0(vp)
-       ld      u0, 0(up)
-       sldi    s0, v0, LSH
-       srdi    s1, v0, RSH
-       ld      v1, 8(vp)
-       ADDSUBC s0, s0, u0      C add limbs without cy, set cy
-       addi    rpx, rp, -8
-       addi    rp, rp, -16
-       sub     upx, up, rpx
-       sub     vpx, vp, rpx
-       sub     up, up, rp
-       sub     vp, vp, rp
-       addi    up, up, 8
-       addi    upx, upx, 16
-       addi    vp, vp, 16
-       addi    vpx, vpx, 24
-
-       ALIGN(32)
-L(top):        ldx     u0, rp, up
-       ldx     v0, rp, vp
-       rldimi  s1, v1, LSH, 0
-       stdu    s0, 16(rp)
-       srdi    s0, v1, RSH
-       ADDSUBE s1, s1, u0      C add limbs with cy, set cy
-L(mid):        ldx     u0, rpx, upx
-       ldx     v1, rpx, vpx
-       rldimi  s0, v0, LSH, 0
-       stdu    s1, 16(rpx)
-       srdi    s1, v0, RSH
-       ADDSUBE s0, s0, u0      C add limbs with cy, set cy
-       bdnz    L(top)          C decrement CTR and loop back
-
-       ldx     u0, rp, up
-       rldimi  s1, v1, LSH, 0
-       std     s0, 16(rp)
-       srdi    s0, v1, RSH
-       ADDSUBE s1, s1, u0      C add limbs with cy, set cy
-       std     s1, 24(rp)
-
-       RETVAL( r0)
-       blr
-EPILOGUE()
index 2b5432dae6a292d11b8c720cdc6f2bd98eb9230a..0c12f9b6608c6d2b596d8bbae2bd8856c2daa206 100644 (file)
@@ -1,32 +1,42 @@
 dnl  PowerPC-64 mpn_addmul_1 and mpn_submul_1.
 
-dnl  Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2010, 2011, 2012
-dnl  Free Software Foundation, Inc.
+dnl  Copyright 1999-2001, 2003-2006, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
-C               mpn_addmul_1    mpn_submul_1
-C               cycles/limb     cycles/limb
-C POWER3/PPC630   6-18             6-18
-C POWER4/PPC970                   8.3
-C POWER5                          8.25
-C POWER6          16.25            16.75
-C POWER7           3.77             4.9
+C                   mpn_addmul_1    mpn_submul_1
+C                   cycles/limb     cycles/limb
+C POWER3/PPC630                6-18            6-18
+C POWER4/PPC970                 8               8.3
+C POWER5                8               8.25
+C POWER6               16.25           16.75
+C POWER7                3.77            4.9
 
 C TODO
 C  * Try to reduce the number of needed live registers
diff --git a/mpn/powerpc64/mode64/aorsorrlsh1_n.asm b/mpn/powerpc64/mode64/aorsorrlsh1_n.asm
new file mode 100644 (file)
index 0000000..2c5400a
--- /dev/null
@@ -0,0 +1,43 @@
+dnl  PowerPC-64 mpn_addlsh1_n, mpn_sublsh1_n, mpn_rsblsh1_n.
+
+dnl  Copyright 2003, 2005, 2009, 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')
+
+
+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(`powerpc64/mode64/aorsorrlshC_n.asm')
diff --git a/mpn/powerpc64/mode64/aorsorrlsh2_n.asm b/mpn/powerpc64/mode64/aorsorrlsh2_n.asm
new file mode 100644 (file)
index 0000000..447791a
--- /dev/null
@@ -0,0 +1,43 @@
+dnl  PowerPC-64 mpn_addlsh2_n, mpn_sublsh2_n, mpn_rsblsh2_n.
+
+dnl  Copyright 2003, 2005, 2009, 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')
+
+
+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(`powerpc64/mode64/aorsorrlshC_n.asm')
diff --git a/mpn/powerpc64/mode64/aorsorrlshC_n.asm b/mpn/powerpc64/mode64/aorsorrlshC_n.asm
new file mode 100644 (file)
index 0000000..6158f54
--- /dev/null
@@ -0,0 +1,187 @@
+dnl  PowerPC-64 mpn_addlshC_n, mpn_sublshC_n, mpn_rsblshC_n.
+
+dnl  Copyright 2003, 2005, 2009, 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/.
+
+C                  cycles/limb
+C POWER3/PPC630          1.83   (1.5 c/l should be possible)
+C POWER4/PPC970          3      (2.0 c/l should be possible)
+C POWER5                 3
+C POWER6              3.5-47
+C POWER7                 3
+
+C STATUS
+C  * Try combining upx+up, and vpx+vp.
+C  * The worst case 47 c/l for POWER6 happens if the 3rd operand for ldx is
+C    greater than the 2nd operand.  Yes, this addition is non-commutative wrt
+C    performance.
+
+C INPUT PARAMETERS
+define(`rp', `r3')
+define(`up', `r4')
+define(`vp', `r5')
+define(`n',  `r6')
+
+ifdef(`DO_add', `
+  define(`ADDSUBC',    `addc   $1, $2, $3')
+  define(`ADDSUBE',    `adde   $1, $2, $3')
+  define(INITCY,       `addic  $1, r1, 0')
+  define(RETVAL,       `addze  r3, $1')
+  define(`func',       mpn_addlsh`'LSH`'_n)')
+ifdef(`DO_sub', `
+  define(`ADDSUBC',    `subfc  $1, $2, $3')
+  define(`ADDSUBE',    `subfe  $1, $2, $3')
+  define(INITCY,       `addic  $1, r1, -1')
+  define(RETVAL,       `subfze r3, $1
+                       neg     r3, r3')
+  define(`func',       mpn_sublsh`'LSH`'_n)')
+ifdef(`DO_rsb', `
+  define(`ADDSUBC',    `subfc  $1, $3, $2')
+  define(`ADDSUBE',    `subfe  $1, $3, $2')
+  define(INITCY,       `addic  $1, r1, -1')
+  define(RETVAL,       `addme  r3, $1')
+  define(`func',       mpn_rsblsh`'LSH`'_n)')
+
+define(`rpx', `r6')
+define(`upx', `r7')
+define(`vpx', `r12')
+
+define(`s0', `r0')  define(`s1', `r9')
+define(`u0', `r8')
+define(`v0', `r10') define(`v1', `r11')
+
+
+ASM_START()
+PROLOGUE(func)
+       cmpldi  cr0, n, 13
+       bgt     L(big)
+
+       mtctr   n               C copy n in ctr
+       INITCY( r0)             C clear cy
+
+       ld      v0, 0(vp)       C load v limb
+       ld      u0, 0(up)       C load u limb
+       addi    up, up, -8      C update up
+       addi    rp, rp, -8      C update rp
+       sldi    s1, v0, LSH
+       bdz     L(ex1)          C If done, skip loop
+
+       ALIGN(16)
+L(lo0):        ld      v1, 8(vp)       C load v limb
+       ADDSUBE(s1, s1, u0)     C add limbs with cy, set cy
+       ldu     u0, 16(up)      C load u limb and update up
+       srdi    s0, v0, RSH     C shift down previous v limb
+       std     s1, 8(rp)       C store result limb
+       rldimi  s0, v1, LSH, 0  C left shift v limb and merge with prev v limb
+       bdz     L(ex0)          C decrement ctr and exit if done
+       ldu     v0, 16(vp)      C load v limb and update vp
+       ADDSUBE(s0, s0, u0)     C add limbs with cy, set cy
+       ld      u0, 8(up)       C load u limb
+       srdi    s1, v1, RSH     C shift down previous v limb
+       stdu    s0, 16(rp)      C store result limb and update rp
+       rldimi  s1, v0, LSH, 0  C left shift v limb and merge with prev v limb
+       bdnz    L(lo0)          C decrement ctr and loop back
+
+L(ex1):        ADDSUBE(r7, s1, u0)
+       std     r7, 8(rp)       C store last result limb
+       srdi    r0, v0, RSH
+       RETVAL( r0)
+       blr
+L(ex0):        ADDSUBE(r7, s0, u0)
+       std     r7, 16(rp)      C store last result limb
+       srdi    r0, v1, RSH
+       RETVAL( r0)
+       blr
+
+
+L(big):        rldicl. r0, n, 0,63     C r0 = n & 1, set cr0
+       addi    r6, n, -1       C ...for ctr
+       srdi    r6, r6, 1       C ...for ctr
+       mtctr   r6              C copy count into ctr
+       beq     cr0, L(b0)
+
+L(b1): ld      v1, 0(vp)
+       ld      u0, 0(up)
+       sldi    s1, v1, LSH
+       srdi    s0, v1, RSH
+       ld      v0, 8(vp)
+       ADDSUBC(s1, s1, u0)     C add limbs without cy, set cy
+       addi    rpx, rp, -16
+       addi    rp, rp, -8
+       sub     upx, up, rp
+       sub     vpx, vp, rp
+       sub     up, up, rpx
+       sub     vp, vp, rpx
+       addi    up, up, 8
+       addi    upx, upx, 16
+       addi    vp, vp, 16
+       addi    vpx, vpx, 24
+       b       L(mid)
+
+L(b0): ld      v0, 0(vp)
+       ld      u0, 0(up)
+       sldi    s0, v0, LSH
+       srdi    s1, v0, RSH
+       ld      v1, 8(vp)
+       ADDSUBC(s0, s0, u0)     C add limbs without cy, set cy
+       addi    rpx, rp, -8
+       addi    rp, rp, -16
+       sub     upx, up, rpx
+       sub     vpx, vp, rpx
+       sub     up, up, rp
+       sub     vp, vp, rp
+       addi    up, up, 8
+       addi    upx, upx, 16
+       addi    vp, vp, 16
+       addi    vpx, vpx, 24
+
+       ALIGN(32)
+L(top):        ldx     u0, rp, up
+       ldx     v0, rp, vp
+       rldimi  s1, v1, LSH, 0
+       stdu    s0, 16(rp)
+       srdi    s0, v1, RSH
+       ADDSUBE(s1, s1, u0)     C add limbs with cy, set cy
+L(mid):        ldx     u0, rpx, upx
+       ldx     v1, rpx, vpx
+       rldimi  s0, v0, LSH, 0
+       stdu    s1, 16(rpx)
+       srdi    s1, v0, RSH
+       ADDSUBE(s0, s0, u0)     C add limbs with cy, set cy
+       bdnz    L(top)          C decrement CTR and loop back
+
+       ldx     u0, rp, up
+       rldimi  s1, v1, LSH, 0
+       std     s0, 16(rp)
+       srdi    s0, v1, RSH
+       ADDSUBE(s1, s1, u0)     C add limbs with cy, set cy
+       std     s1, 24(rp)
+
+       RETVAL( s0)
+       blr
+EPILOGUE()
index e88fc44402cfd443d80e9d014c74f2a46afe6b1e..45cded971594cc12fea3ccb313f4ce632623bee3 100644 (file)
@@ -3,28 +3,38 @@ dnl  PPC64 mpn_bdiv_dbm1c.
 dnl  Copyright 2008, 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C                 cycles/limb
 C POWER3/PPC630       6-18
-C POWER4/PPC970       8.5?
+C POWER4/PPC970       8.25
 C POWER5              8.5  fluctuating as function of n % 3
 C POWER6             15
-C POWER6             15
 C POWER7              4.75
 
 C TODO
diff --git a/mpn/powerpc64/mode64/cnd_aors_n.asm b/mpn/powerpc64/mode64/cnd_aors_n.asm
new file mode 100644 (file)
index 0000000..24968c1
--- /dev/null
@@ -0,0 +1,196 @@
+dnl  PowerPC-64 mpn_cnd_add_n/mpn_cnd_sub_n.
+
+dnl  Copyright 1999-2001, 2003-2005, 2007, 2011, 2012 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          2.25
+C POWER5                 ?
+C POWER6                 3
+C POWER7                 2
+
+C INPUT PARAMETERS
+define(`cnd',  `r3')
+define(`rp',   `r4')
+define(`up',   `r5')
+define(`vp',   `r6')
+define(`n',    `r7')
+
+ifdef(`OPERATION_cnd_add_n',`
+  define(ADDSUBC,      adde)
+  define(ADDSUB,       addc)
+  define(func,         mpn_cnd_add_n)
+  define(GENRVAL,      `addi   r3, r3, 1')
+  define(SETCBR,       `addic  r0, $1, -1')
+  define(CLRCB,                `addic  r0, r0, 0')
+')
+ifdef(`OPERATION_cnd_sub_n',`
+  define(ADDSUBC,      subfe)
+  define(ADDSUB,       subfc)
+  define(func,         mpn_cnd_sub_n)
+  define(GENRVAL,      `neg    r3, r3')
+  define(SETCBR,       `subfic r0, $1, 0')
+  define(CLRCB,                `addic  r0, r1, -1')
+')
+
+MULFUNC_PROLOGUE(mpn_cnd_add_n mpn_cnd_sub_n)
+
+ASM_START()
+PROLOGUE(func)
+       std     r31, -8(r1)
+       std     r30, -16(r1)
+       std     r29, -24(r1)
+       std     r28, -32(r1)
+       std     r27, -40(r1)
+
+       subfic  cnd, cnd, 0
+       subfe   cnd, cnd, cnd
+
+       rldicl. r0, n, 0,62     C r0 = n & 3, set cr0
+       cmpdi   cr6, r0, 2
+       addi    n, n, 3 C compute count...
+       srdi    n, n, 2 C ...for ctr
+       mtctr   n               C copy count into ctr
+       beq     cr0, L(b00)
+       blt     cr6, L(b01)
+       beq     cr6, L(b10)
+
+L(b11):        ld      r8, 0(up)       C load s1 limb
+       ld      r9, 0(vp)       C load s2 limb
+       ld      r10, 8(up)      C load s1 limb
+       ld      r11, 8(vp)      C load s2 limb
+       ld      r12, 16(up)     C load s1 limb
+       addi    up, up, 24
+       ld      r0, 16(vp)      C load s2 limb
+       addi    vp, vp, 24
+       and     r9, r9, cnd
+       and     r11, r11, cnd
+       and     r0, r0, cnd
+       ADDSUB  r29, r9, r8
+       ADDSUBC r30, r11, r10
+       ADDSUBC r31, r0, r12
+       std     r29, 0(rp)
+       std     r30, 8(rp)
+       std     r31, 16(rp)
+       addi    rp, rp, 24
+       bdnz    L(go)
+       b       L(ret)
+
+L(b01):        ld      r12, 0(up)      C load s1 limb
+       addi    up, up, 8
+       ld      r0, 0(vp)       C load s2 limb
+       addi    vp, vp, 8
+       and     r0, r0, cnd
+       ADDSUB  r31, r0, r12    C add
+       std     r31, 0(rp)
+       addi    rp, rp, 8
+       bdnz    L(go)
+       b       L(ret)
+
+L(b10):        ld      r10, 0(up)      C load s1 limb
+       ld      r11, 0(vp)      C load s2 limb
+       ld      r12, 8(up)      C load s1 limb
+       addi    up, up, 16
+       ld      r0, 8(vp)       C load s2 limb
+       addi    vp, vp, 16
+       and     r11, r11, cnd
+       and     r0, r0, cnd
+       ADDSUB  r30, r11, r10   C add
+       ADDSUBC r31, r0, r12    C add
+       std     r30, 0(rp)
+       std     r31, 8(rp)
+       addi    rp, rp, 16
+       bdnz    L(go)
+       b       L(ret)
+
+L(b00):        CLRCB                   C clear/set cy
+L(go): ld      r7, 0(up)       C load s1 limb
+       ld      r27, 0(vp)      C load s2 limb
+       ld      r8, 8(up)       C load s1 limb
+       ld      r9, 8(vp)       C load s2 limb
+       ld      r10, 16(up)     C load s1 limb
+       ld      r11, 16(vp)     C load s2 limb
+       ld      r12, 24(up)     C load s1 limb
+       ld      r0, 24(vp)      C load s2 limb
+       and     r27, r27, cnd
+       and     r9, r9, cnd
+       and     r11, r11, cnd
+       and     r0, r0, cnd
+       bdz     L(end)
+
+       addi    up, up, 32
+       addi    vp, vp, 32
+
+L(top):        ADDSUBC r28, r27, r7
+       ld      r7, 0(up)       C load s1 limb
+       ld      r27, 0(vp)      C load s2 limb
+       ADDSUBC r29, r9, r8
+       ld      r8, 8(up)       C load s1 limb
+       ld      r9, 8(vp)       C load s2 limb
+       ADDSUBC r30, r11, r10
+       ld      r10, 16(up)     C load s1 limb
+       ld      r11, 16(vp)     C load s2 limb
+       ADDSUBC r31, r0, r12
+       ld      r12, 24(up)     C load s1 limb
+       ld      r0, 24(vp)      C load s2 limb
+       std     r28, 0(rp)
+       addi    up, up, 32
+       std     r29, 8(rp)
+       addi    vp, vp, 32
+       std     r30, 16(rp)
+       std     r31, 24(rp)
+       addi    rp, rp, 32
+       and     r27, r27, cnd
+       and     r9, r9, cnd
+       and     r11, r11, cnd
+       and     r0, r0, cnd
+       bdnz    L(top)          C decrement ctr and loop back
+
+L(end):        ADDSUBC r28, r27, r7
+       ADDSUBC r29, r9, r8
+       ADDSUBC r30, r11, r10
+       ADDSUBC r31, r0, r12
+       std     r28, 0(rp)
+       std     r29, 8(rp)
+       std     r30, 16(rp)
+       std     r31, 24(rp)
+
+L(ret):        ld      r31, -8(r1)
+       ld      r30, -16(r1)
+       ld      r29, -24(r1)
+       ld      r28, -32(r1)
+       ld      r27, -40(r1)
+
+       subfe   r3, r0, r0      C -cy
+       GENRVAL
+       blr
+EPILOGUE()
index 0f94154bf6f396d3014a39e4e8b0312645e662ba..434dde9145c4b541d19f0f8b3fd7ad815cc00a5a 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-64 mpn_divexact_1 -- mpn by limb exact division.
 dnl  Copyright 2006, 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -42,7 +53,7 @@ ASM_START()
 
 EXTERN(binvert_limb_table)
 
-PROLOGUE(mpn_divexact_1)
+PROLOGUE(mpn_divexact_1,toc)
        addic.  n, n, -1
        ld      r12, 0(up)
        bne     cr0, L(2)
index 60f52904f0b9ac6ce3d0abf15cf3d5e9bcdd6d2f..b283877006437007d7eccc59430a6bdf3c1bc2f9 100644 (file)
@@ -1,22 +1,32 @@
 dnl  PowerPC-64 mpn_divrem_1 -- Divide an mpn number by an unnormalized limb.
 
-dnl  Copyright 2003, 2004, 2005, 2007, 2008, 2010, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2003-2005, 2007, 2008, 2010, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -46,7 +56,7 @@ ASM_START()
 
 EXTERN_FUNC(mpn_invert_limb)
 
-PROLOGUE(mpn_divrem_1)
+PROLOGUE(mpn_divrem_1,toc)
 
        mfcr    r12
        add.    r10, r6, r4
@@ -97,7 +107,6 @@ L(71):
        sld     r31, r31, r27
        mr      r3, r30
        CALL(   mpn_invert_limb)
-       nop
        beq-    cr4, L(110)
        sldi    r9, r28, 3
        addic.  r6, r28, -2
index 18f549357ca689100f270dcdf2292ead0796e42d..73ec23c94d5dee20fe05c118f74d420173ded73b 100644 (file)
@@ -3,19 +3,30 @@ dnl  PPC-64 mpn_divrem_2 -- Divide an mpn number by a normalized 2-limb number.
 dnl  Copyright 2007, 2008 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -42,7 +53,7 @@ ASM_START()
 
 EXTERN_FUNC(mpn_invert_limb)
 
-PROLOGUE(mpn_divrem_2)
+PROLOGUE(mpn_divrem_2,toc)
        mflr    r0
        std     r23, -72(r1)
        std     r24, -64(r1)
@@ -96,7 +107,6 @@ L(8):
        blt     cr0, L(18)
        mr      r3, r30
        CALL(   mpn_invert_limb)
-       nop
        mulld   r10, r3, r30
        mulhdu  r0, r3, r28
        addc    r8, r10, r28
diff --git a/mpn/powerpc64/mode64/gcd_1.asm b/mpn/powerpc64/mode64/gcd_1.asm
new file mode 100644 (file)
index 0000000..8762bbb
--- /dev/null
@@ -0,0 +1,122 @@
+dnl  PowerPC-64 mpn_gcd_1.
+
+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')
+
+C                  cycles/bit (approx)
+C POWER3/PPC630                 ?
+C POWER4/PPC970                 8.5
+C POWER5                ?
+C POWER6               10.1
+C POWER7                9.4
+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(`mask', `r0')dnl
+define(`a1',   `r4')dnl
+define(`a2',   `r5')dnl
+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
+       li      r12, 63
+       bne     L(mid)
+       b       L(end)
+
+       ALIGN(16)
+L(top):
+       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
+       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
+       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
+EPILOGUE()
index 23d1ce516eddb7a4faf005485b80d8fade850790..f8305f47202e7263038b96ea935ca1d43274c4a2 100644 (file)
@@ -5,20 +5,31 @@ Copyright 2008, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 /* 1600MHz PPC970 */
 
index 31b2430010128845f2c9e8a564e246b267d514e5..dfdba6451ed7fd2b2c8e8f519906621543338a22 100644 (file)
@@ -1,21 +1,32 @@
 dnl  PowerPC-64 mpn_invert_limb -- Invert a normalized limb.
 
-dnl  Copyright 2004, 2005, 2006, 2008, 2010 Free Software Foundation, Inc.
+dnl  Copyright 2004-2006, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -27,7 +38,7 @@ C POWER6               170
 C POWER7                66
 
 ASM_START()
-PROLOGUE(mpn_invert_limb)
+PROLOGUE(mpn_invert_limb,toc)
        LEAL(   r12, approx_tab)
        srdi    r9, r3, 32
        rlwinm  r9, r9, 10, 23, 30      C (d >> 55) & 0x1fe
@@ -61,8 +72,8 @@ PROLOGUE(mpn_invert_limb)
        srdi    r0, r0, 1               C p1 >> 1
        add     r0, r0, r9              C v3 = (v2 << 31) + (p1 >> 1)
        nop
-       mulhdu  r9, r0, r3
        mulld   r11, r0, r3
+       mulhdu  r9, r0, r3
        addc    r10, r11, r3
        adde    r3, r9, r3
        subf    r3, r3, r0
@@ -70,37 +81,8 @@ PROLOGUE(mpn_invert_limb)
 EPILOGUE()
 
 DEF_OBJECT(approx_tab)
-        .short  0x7fd,0x7f5,0x7ed,0x7e5,0x7dd,0x7d5,0x7ce,0x7c6
-        .short  0x7bf,0x7b7,0x7b0,0x7a8,0x7a1,0x79a,0x792,0x78b
-        .short  0x784,0x77d,0x776,0x76f,0x768,0x761,0x75b,0x754
-        .short  0x74d,0x747,0x740,0x739,0x733,0x72c,0x726,0x720
-        .short  0x719,0x713,0x70d,0x707,0x700,0x6fa,0x6f4,0x6ee
-        .short  0x6e8,0x6e2,0x6dc,0x6d6,0x6d1,0x6cb,0x6c5,0x6bf
-        .short  0x6ba,0x6b4,0x6ae,0x6a9,0x6a3,0x69e,0x698,0x693
-        .short  0x68d,0x688,0x683,0x67d,0x678,0x673,0x66e,0x669
-        .short  0x664,0x65e,0x659,0x654,0x64f,0x64a,0x645,0x640
-        .short  0x63c,0x637,0x632,0x62d,0x628,0x624,0x61f,0x61a
-        .short  0x616,0x611,0x60c,0x608,0x603,0x5ff,0x5fa,0x5f6
-        .short  0x5f1,0x5ed,0x5e9,0x5e4,0x5e0,0x5dc,0x5d7,0x5d3
-        .short  0x5cf,0x5cb,0x5c6,0x5c2,0x5be,0x5ba,0x5b6,0x5b2
-        .short  0x5ae,0x5aa,0x5a6,0x5a2,0x59e,0x59a,0x596,0x592
-        .short  0x58e,0x58a,0x586,0x583,0x57f,0x57b,0x577,0x574
-        .short  0x570,0x56c,0x568,0x565,0x561,0x55e,0x55a,0x556
-        .short  0x553,0x54f,0x54c,0x548,0x545,0x541,0x53e,0x53a
-        .short  0x537,0x534,0x530,0x52d,0x52a,0x526,0x523,0x520
-        .short  0x51c,0x519,0x516,0x513,0x50f,0x50c,0x509,0x506
-        .short  0x503,0x500,0x4fc,0x4f9,0x4f6,0x4f3,0x4f0,0x4ed
-        .short  0x4ea,0x4e7,0x4e4,0x4e1,0x4de,0x4db,0x4d8,0x4d5
-        .short  0x4d2,0x4cf,0x4cc,0x4ca,0x4c7,0x4c4,0x4c1,0x4be
-        .short  0x4bb,0x4b9,0x4b6,0x4b3,0x4b0,0x4ad,0x4ab,0x4a8
-        .short  0x4a5,0x4a3,0x4a0,0x49d,0x49b,0x498,0x495,0x493
-        .short  0x490,0x48d,0x48b,0x488,0x486,0x483,0x481,0x47e
-        .short  0x47c,0x479,0x477,0x474,0x472,0x46f,0x46d,0x46a
-        .short  0x468,0x465,0x463,0x461,0x45e,0x45c,0x459,0x457
-        .short  0x455,0x452,0x450,0x44e,0x44b,0x449,0x447,0x444
-        .short  0x442,0x440,0x43e,0x43b,0x439,0x437,0x435,0x432
-        .short  0x430,0x42e,0x42c,0x42a,0x428,0x425,0x423,0x421
-        .short  0x41f,0x41d,0x41b,0x419,0x417,0x414,0x412,0x410
-        .short  0x40e,0x40c,0x40a,0x408,0x406,0x404,0x402,0x400
+forloop(i,256,512-1,dnl
+`      .short  eval(0x7fd00/i)
+')dnl
 END_OBJECT(approx_tab)
 ASM_END()
index f24ceb2c8c0ba5fca5730c5f59a935fe29914959..873373054f5194bd1175df9fc189da9ed4e7ac97 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-64 mpn_mod_1_1p
 dnl  Copyright 2010, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -69,7 +80,10 @@ L(top):      ld      r4, -24(r3)
        adde    r9, r9, r10
        bdnz    L(top)
 
-L(end):        lwz     r0, 12(r6)
+L(end):
+ifdef(`HAVE_LIMB_LITTLE_ENDIAN',
+`      lwz     r0, 8(r6)',
+`      lwz     r0, 12(r6)')
        ld      r3, 0(r6)
        cmpdi   cr7, r0, 0
        beq-    cr7, L(4)
@@ -103,7 +117,7 @@ L(10):      subf    r3, r5, r3
        blr
 EPILOGUE()
 
-PROLOGUE(mpn_mod_1_1p_cps)
+PROLOGUE(mpn_mod_1_1p_cps,toc)
        mflr    r0
        std     r29, -24(r1)
        std     r30, -16(r1)
@@ -116,7 +130,6 @@ PROLOGUE(mpn_mod_1_1p_cps)
        sld     r30, r4, r31
        mr      r3, r30
        CALL(   mpn_invert_limb)
-       nop
        cmpdi   cr7, r31, 0
        neg     r0, r30
        beq-    cr7, L(13)
index b6163c5e7aebfe38c360953560ef35b90e214df3..0b7d6bf6997f85fa93417ab1bbf926648fce9499 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-64 mpn_mod_1s_4p
 dnl  Copyright 2010, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -144,7 +155,10 @@ L(top):    ld      r31, -16(ap)
        adde    r9, r7, r4
        bdnz    L(top)
 
-L(end):        lwz     r3, 12(cps)
+L(end):
+ifdef(`HAVE_LIMB_LITTLE_ENDIAN',
+`      lwz     r3, 8(cps)',
+`      lwz     r3, 12(cps)')
        mulld   r10, r9, r26
        mulhdu  r9, r9, r26
        addc    r11, r0, r10
@@ -183,7 +197,7 @@ L(16):      subf    r0, d, r0
        b       L(10)
 EPILOGUE()
 
-PROLOGUE(mpn_mod_1s_4p_cps)
+PROLOGUE(mpn_mod_1s_4p_cps,toc)
        mflr    r0
        std     r29, -24(r1)
        std     r30, -16(r1)
@@ -195,7 +209,6 @@ PROLOGUE(mpn_mod_1s_4p_cps)
        sld     r30, r4, r31
        mr      r3, r30
        CALL(   mpn_invert_limb)
-       nop
        subfic  r9, r31, 64
        li      r10, 1
        sld     r10, r10, r31
index 30b9f98bee9dbfb450bbf476c98c19dd660f14cc..c35e0e37a4a119cff54919e11b52b2bec9ae0c0f 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-64 mpn_mod_34lsub1 -- modulo 2^48-1.
 dnl  Copyright 2005 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 37e4028d88bd2ac814c562ddfe3d41ad45bf0436..726339a9310541d34d71ed93e400148edb749f3c 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-64 mpn_modexact_1_odd -- mpn by limb exact remainder.
 dnl  Copyright 2006 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -41,7 +52,7 @@ ASM_START()
 
 EXTERN(binvert_limb_table)
 
-PROLOGUE(mpn_modexact_1c_odd)
+PROLOGUE(mpn_modexact_1c_odd,toc)
        addic.  n, n, -1                C set carry as side effect
        ld      r8, 0(up)
        bne     cr0, L(2)
index e911cf551ec0bf422acb443f9cfe0939a0dc3ff2..27a8f8fb4d1524c62f8ac8cfeb155e69da74bb68 100644 (file)
@@ -1,23 +1,33 @@
 dnl  PowerPC-64 mpn_mul_1 -- Multiply a limb vector with a limb and store
 dnl  the result in a second limb vector.
 
-dnl  Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2010 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 1999-2001, 2003-2006, 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 9a3957f945ea278f0762747e63026af160fc2d49..18731879e4bb09682e30e632c6ea9259babb12f8 100644 (file)
@@ -1,22 +1,32 @@
 dnl  PowerPC-64 mpn_mul_basecase.
 
-dnl  Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2008 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 1999-2001, 2003-2006, 2008 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 03c07e43d8f25324187d6db0264f1017406f66a5..61a437b6e6cd3306ad051283afc6485adcd447ba 100644 (file)
@@ -1,24 +1,35 @@
 /* POWER3/PowerPC630 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2008-2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 
 #define MOD_1_NORM_THRESHOLD                 0  /* always */
index 3b4911922e7dee560a334b994709df43c57f7444..d909b292bb3fc061eb2b4799a0bec501332a1b45 100644 (file)
 /* POWER4/PowerPC970 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2008-2010, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
+/* 1800 MHz PPC970 */
+/* FFT tuning limit = 10000000 */
+/* Generated by tuneup.c, 2014-03-12, gcc 4.0 */
 
 #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         9
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD        20
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD        10
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD        22
 #define PREINV_MOD_1_TO_MOD_1_THRESHOLD     16
 #define USE_PREINV_DIVREM_1                  0
+#define DIV_QR_1N_PI1_METHOD                 1
+#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           37
+#define BMOD_1_TO_MOD_1_THRESHOLD           34
 
-#define MUL_TOOM22_THRESHOLD                18
+#define MUL_TOOM22_THRESHOLD                14
 #define MUL_TOOM33_THRESHOLD                53
-#define MUL_TOOM44_THRESHOLD               106
-#define MUL_TOOM6H_THRESHOLD               180
-#define MUL_TOOM8H_THRESHOLD               309
+#define MUL_TOOM44_THRESHOLD               136
+#define MUL_TOOM6H_THRESHOLD               197
+#define MUL_TOOM8H_THRESHOLD               296
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD      61
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD      89
 #define MUL_TOOM32_TO_TOOM53_THRESHOLD      91
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD      92
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD      51
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD      89
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD      96
 #define MUL_TOOM43_TO_TOOM54_THRESHOLD      79
 
 #define SQR_BASECASE_THRESHOLD               0  /* always (native) */
-#define SQR_TOOM2_THRESHOLD                 28
-#define SQR_TOOM3_THRESHOLD                 73
-#define SQR_TOOM4_THRESHOLD                136
-#define SQR_TOOM6_THRESHOLD                194
-#define SQR_TOOM8_THRESHOLD                272
+#define SQR_TOOM2_THRESHOLD                 24
+#define SQR_TOOM3_THRESHOLD                 85
+#define SQR_TOOM4_THRESHOLD                142
+#define SQR_TOOM6_THRESHOLD                270
+#define SQR_TOOM8_THRESHOLD                430
 
 #define MULMID_TOOM42_THRESHOLD             32
 
 #define MULMOD_BNM1_THRESHOLD               11
-#define SQRMOD_BNM1_THRESHOLD               16
+#define SQRMOD_BNM1_THRESHOLD               15
 
-#define MUL_FFT_MODF_THRESHOLD             372  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             380  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    372, 5}, {     13, 6}, {      7, 5}, {     15, 6}, \
-    {      8, 5}, {     17, 6}, {      9, 5}, {     19, 6}, \
-    {     10, 5}, {     21, 6}, {     19, 7}, {     10, 6}, \
-    {     21, 7}, {     11, 6}, {     23, 7}, {     21, 8}, \
-    {     11, 7}, {     25, 8}, {     13, 7}, {     31, 8}, \
-    {     17, 7}, {     35, 8}, {     21, 9}, {     11, 8}, \
+  { {    380, 5}, {     13, 6}, {      7, 5}, {     17, 6}, \
+    {      9, 5}, {     19, 6}, {     10, 5}, {     21, 6}, \
+    {     13, 5}, {     28, 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}, {     21, 9}, {     11, 8}, \
     {     27, 9}, {     15, 8}, {     35, 9}, {     19, 8}, \
-    {     41, 9}, {     23, 8}, {     49, 9}, {     27,10}, \
+    {     39, 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}, {     63, 9}, {    127,10}, {     79,11}, \
-    {     47,10}, {     95, 9}, {    191,10}, {    103, 9}, \
-    {    207,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, 8}, {    767,10}, {    207, 9}, \
-    {    415,11}, {    111,10}, {    223,12}, {     63,11}, \
+    {     83,10}, {     47, 9}, {     95,10}, {     55,11}, \
+    {     31,10}, {     63, 9}, {    127,10}, {     87,11}, \
+    {     47,10}, {     95, 9}, {    191,10}, {    103,12}, \
+    {     31,11}, {     63,10}, {    127, 9}, {    255, 8}, \
+    {    511,10}, {    135, 9}, {    271,11}, {     79,10}, \
+    {    159, 9}, {    319,10}, {    167, 9}, {    335,11}, \
+    {     95,10}, {    191, 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, 8}, \
-    {   1151,10}, {    303, 9}, {    607,10}, {    319, 9}, \
-    {    639,10}, {    335,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 106
-#define MUL_FFT_THRESHOLD                 3264
-
-#define SQR_FFT_MODF_THRESHOLD             284  /* k = 5 */
+    {    543,11}, {    143,10}, {    287, 9}, {    575,10}, \
+    {    303, 9}, {    607,10}, {    319, 9}, {    639,10}, \
+    {    335, 9}, {    671,10}, {    351,12}, {     95,11}, \
+    {    191,10}, {    383, 9}, {    767,11}, {    207,10}, \
+    {    415, 9}, {    831,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,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}, {    895,12}, \
+    {    479,14}, {    127,13}, {    255,12}, {    607,13}, \
+    {    319,12}, {    703,13}, {    383,12}, {    895,14}, \
+    {    255,13}, {    511,12}, {   1023,13}, {    575,12}, \
+    {   1151,13}, {    703,14}, {    383,13}, {    895,15}, \
+    {    255,14}, {    511,13}, {   1023,12}, {   2047,13}, \
+    {   1087,12}, {   2175,13}, {   1151,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 165
+#define MUL_FFT_THRESHOLD                 9088
+
+#define SQR_FFT_MODF_THRESHOLD             308  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    280, 5}, {     13, 6}, {      7, 5}, {     15, 6}, \
-    {      8, 5}, {     17, 6}, {     19, 7}, {     10, 6}, \
-    {     21, 7}, {     21, 8}, {     11, 7}, {     24, 8}, \
-    {     13, 7}, {     29, 8}, {     15, 7}, {     31, 8}, \
-    {     17, 7}, {     35, 8}, {     21, 9}, {     11, 8}, \
-    {     27, 9}, {     15, 8}, {     33, 9}, {     19, 8}, \
-    {     41, 9}, {     23, 8}, {     47, 9}, {     27,10}, \
+  { {    308, 5}, {     17, 6}, {      9, 5}, {     19, 6}, \
+    {     13, 5}, {     28, 6}, {     21, 7}, {     11, 6}, \
+    {     23, 7}, {     14, 6}, {     29, 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}, {     67,10}, {     39, 9}, \
     {     83,10}, {     47, 9}, {     95,10}, {     55,11}, \
-    {     31,10}, {     71, 9}, {    143,10}, {     79,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, 9}, {    287,11}, {     79,10}, {    159, 9}, \
+    {     31,10}, {     79,11}, {     47,10}, {     95, 9}, \
+    {    191, 8}, {    383,12}, {     31,11}, {     63,10}, \
+    {    127, 9}, {    255, 8}, {    511,10}, {    135, 9}, \
+    {    271, 8}, {    543,11}, {     79,10}, {    159, 9}, \
     {    319, 8}, {    639,10}, {    175, 9}, {    351,11}, \
     {     95,10}, {    191, 9}, {    383, 8}, {    767,10}, \
-    {    207, 9}, {    415,12}, {     63,11}, {    127,10}, \
-    {    255, 9}, {    511,10}, {    271,11}, {    143,10}, \
-    {    287, 9}, {    575,11}, {    159,10}, {    319, 9}, \
-    {    639,11}, {    175,10}, {    351,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 SQR_FFT_TABLE3_SIZE 103
-#define SQR_FFT_THRESHOLD                 2752
-
-#define MULLO_BASECASE_THRESHOLD             3
-#define MULLO_DC_THRESHOLD                  40
-#define MULLO_MUL_N_THRESHOLD             6440
-
-#define DC_DIV_QR_THRESHOLD                 43
-#define DC_DIVAPPR_Q_THRESHOLD             166
-#define DC_BDIV_QR_THRESHOLD                47
-#define DC_BDIV_Q_THRESHOLD                112
-
-#define INV_MULMOD_BNM1_THRESHOLD           50
+    {    207, 9}, {    415,11}, {    111,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, 9}, \
+    {    767,11}, {    207,10}, {    415, 9}, {    831,11}, \
+    {    223,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}, {    351,10}, {    703,12}, \
+    {    191,11}, {    383,10}, {    767,11}, {    415,10}, \
+    {    831,12}, {    223,10}, {    895,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}, {    895,12}, {    479,14}, {    127,13}, \
+    {    255,12}, {    607,13}, {    319,12}, {    703,13}, \
+    {    383,12}, {    927,14}, {    255,13}, {    511,12}, \
+    {   1023,13}, {    575,12}, {   1151,13}, {    639,12}, \
+    {   1279,13}, {    703,14}, {    383,13}, {    895,12}, \
+    {   1791,15}, {    255,14}, {    511,13}, {   1023,12}, \
+    {   2047,13}, {   1087,12}, {   2175,13}, {   1151,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 162
+#define SQR_FFT_THRESHOLD                 6272
+
+#define MULLO_BASECASE_THRESHOLD             5
+#define MULLO_DC_THRESHOLD                  44
+#define MULLO_MUL_N_THRESHOLD            18087
+
+#define DC_DIV_QR_THRESHOLD                 42
+#define DC_DIVAPPR_Q_THRESHOLD             167
+#define DC_BDIV_QR_THRESHOLD                46
+#define DC_BDIV_Q_THRESHOLD                110
+
+#define INV_MULMOD_BNM1_THRESHOLD           30
 #define INV_NEWTON_THRESHOLD               181
-#define INV_APPR_THRESHOLD                 165
+#define INV_APPR_THRESHOLD                 173
 
 #define BINV_NEWTON_THRESHOLD              214
-#define REDC_1_TO_REDC_N_THRESHOLD          55
+#define REDC_1_TO_REDC_N_THRESHOLD          56
 
 #define MU_DIV_QR_THRESHOLD                998
 #define MU_DIVAPPR_Q_THRESHOLD            1017
-#define MUPI_DIV_QR_THRESHOLD               84
-#define MU_BDIV_QR_THRESHOLD               855
+#define MUPI_DIV_QR_THRESHOLD               92
+#define MU_BDIV_QR_THRESHOLD               889
 #define MU_BDIV_Q_THRESHOLD               1017
 
-#define POWM_SEC_TABLE  4,32,327,1100,2826
+#define POWM_SEC_TABLE  2,22,87,579,1925
 
-#define MATRIX22_STRASSEN_THRESHOLD         12
+#define MATRIX22_STRASSEN_THRESHOLD         15
 #define HGCD_THRESHOLD                     109
-#define HGCD_APPR_THRESHOLD                107
-#define HGCD_REDUCE_THRESHOLD             2121
-#define GCD_DC_THRESHOLD                   348
-#define GCDEXT_DC_THRESHOLD                246
+#define HGCD_APPR_THRESHOLD                115
+#define HGCD_REDUCE_THRESHOLD             4633
+#define GCD_DC_THRESHOLD                   318
+#define GCDEXT_DC_THRESHOLD                242
 #define JACOBI_BASE_METHOD                   4
 
 #define GET_STR_DC_THRESHOLD                11
 #define GET_STR_PRECOMPUTE_THRESHOLD        23
-#define SET_STR_DC_THRESHOLD               650
-#define SET_STR_PRECOMPUTE_THRESHOLD      1713
+#define SET_STR_DC_THRESHOLD               802
+#define SET_STR_PRECOMPUTE_THRESHOLD      1712
 
-#define FAC_DSC_THRESHOLD                  562
-#define FAC_ODD_THRESHOLD                   23
+#define FAC_DSC_THRESHOLD                  507
+#define FAC_ODD_THRESHOLD                   25
index c1670d7c8e47651530fd631ea1bd9fbef8cd4141..15b009c357a6b2cf5452afafca395c5526e8e309 100644 (file)
@@ -1,25 +1,36 @@
 /* POWER5 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2009, 2010 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2003, 2009, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 /* POWER5 (friggms.hpc.ntnu.no) */
 
index 4bd508488be674ebe50f2576e0577f4624ec4c37..5a85f84f4a8acc22fec18c1b1dde6945a7cc3c98 100644 (file)
@@ -1,22 +1,33 @@
 dnl  PowerPC-64 mpn_addmul_1 and mpn_submul_1 optimised for power6.
 
-dnl  Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2008, 2010, 2011
-dnl  Free Software Foundation, Inc.
+dnl  Copyright 1999-2001, 2003-2006, 2008, 2010, 2011 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -33,7 +44,7 @@ C  * Reduce register usage.
 C  * Schedule function entry code.
 C  * Unroll more.  8-way unrolling would bring us to 10 c/l, 16-way unrolling
 C    would bring us to 9 c/l.
-C  * Handle n = 1 and perhaps n = 2 seperately, without saving any registers.
+C  * Handle n = 1 and perhaps n = 2 separately, without saving any registers.
 
 C INPUT PARAMETERS
 define(`rp',  `r3')
index b6e10df2fb8c7423dba34cb2d9c12b6c2b64b63c..c7e2f894ad4e78555462c10532c31e3af72ed56a 100644 (file)
@@ -1,25 +1,35 @@
 /* POWER6 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2009, 2010, 2011
-Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2003, 2009-2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 /* 3500 MHz POWER6 (kolga.bibsys.no) */
 
index 52c5af8ff36e30d29ea6ab1fd78e741726aca691..3d32b46c353b50fd6acd33ba19a8a37babb991da 100644 (file)
@@ -1,22 +1,32 @@
 dnl  PowerPC-64 mpn_mul_basecase.
 
-dnl  Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2008, 2010 Free
-dnl  Software Foundation, Inc.
+dnl  Copyright 1999-2001, 2003-2006, 2008, 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/powerpc64/mode64/p7/aormul_2.asm b/mpn/powerpc64/mode64/p7/aormul_2.asm
new file mode 100644 (file)
index 0000000..8731e01
--- /dev/null
@@ -0,0 +1,135 @@
+dnl  PowerPC-64 mpn_mul_2 and mpn_addmul_2.
+
+dnl  Copyright 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    cycles/limb
+C                      mul_2         addmul_2
+C POWER3/PPC630                 ?               ?
+C POWER4/PPC970                 ?               ?
+C POWER5                ?               ?
+C POWER6                ?               ?
+C POWER7-SMT4           3               3
+C POWER7-SMT2           ?               ?
+C POWER7-SMT1           ?               ?
+
+C INPUT PARAMETERS
+define(`rp', `r3')
+define(`up', `r4')
+define(`n',  `r5')
+define(`vp', `r6')
+
+define(`cy0', `r10')
+ifdef(`EXTRA_REGISTER',
+` define(`cy1', EXTRA_REGISTER)',
+` define(`cy1', `r31')')
+
+ifdef(`OPERATION_mul_2',`
+  define(`AM',         `')
+  define(`ADDX',       `addc')
+  define(`func',       `mpn_mul_2')
+')
+ifdef(`OPERATION_addmul_2',`
+  define(`AM',         `$1')
+  define(`ADDX',       `adde')
+  define(`func',       `mpn_addmul_2')
+')
+
+MULFUNC_PROLOGUE(mpn_mul_2 mpn_addmul_2)
+
+ASM_START()
+PROLOGUE(func)
+
+ifdef(`EXTRA_REGISTER',,`
+       std     r31, -8(r1)
+')
+       andi.   r12, n, 1
+       addi    r0, n, 1
+       srdi    r0, r0, 1
+       mtctr   r0
+       ld      r11, 0(vp)              C v0
+       li      cy0, 0
+       ld      r12, 8(vp)              C v1
+       li      cy1, 0
+       ld      r5, 0(up)
+       beq     L(lo0)
+       addi    up, up, -8
+       addi    rp, rp, -8
+       b       L(lo1)
+
+       ALIGN(32)
+L(top):
+AM(`   ld      r0, -8(rp)')
+       ld      r5, 0(up)
+AM(`   addc    r6, r6, r0')
+       ADDX    r7, r7, r8
+       addze   r9, r9
+       addc    r6, r6, cy0
+       adde    cy0, r7, cy1
+       std     r6, -8(rp)
+       addze   cy1, r9
+L(lo0):        mulld   r6, r11, r5             C v0 * u[i]  weight 0
+       mulhdu  r7, r11, r5             C v0 * u[i]  weight 1
+       mulld   r8, r12, r5             C v1 * u[i]  weight 1
+       mulhdu  r9, r12, r5             C v1 * u[i]  weight 2
+AM(`   ld      r0, 0(rp)')
+       ld      r5, 8(up)
+AM(`   addc    r6, r6, r0')
+       ADDX    r7, r7, r8
+       addze   r9, r9
+       addc    r6, r6, cy0
+       adde    cy0, r7, cy1
+       std     r6, 0(rp)
+       addze   cy1, r9
+L(lo1):        mulld   r6, r11, r5             C v0 * u[i]  weight 0
+       mulhdu  r7, r11, r5             C v0 * u[i]  weight 1
+       addi    up, up, 16
+       addi    rp, rp, 16
+       mulld   r8, r12, r5             C v1 * u[i]  weight 1
+       mulhdu  r9, r12, r5             C v1 * u[i]  weight 2
+       bdnz    L(top)
+
+L(end):
+AM(`   ld      r0, -8(rp)')
+AM(`   addc    r6, r6, r0')
+       ADDX    r7, r7, r8
+       addze   r9, r9
+       addc    r6, r6, cy0
+       std     r6, -8(rp)
+       adde    cy0, r7, cy1
+       addze   cy1, r9
+       std     cy0, 0(rp)
+       mr      r3, cy1
+
+ifdef(`EXTRA_REGISTER',,`
+       ld      r31, -8(r1)
+')
+       blr
+EPILOGUE()
diff --git a/mpn/powerpc64/mode64/p7/aors_n.asm b/mpn/powerpc64/mode64/p7/aors_n.asm
new file mode 100644 (file)
index 0000000..857c701
--- /dev/null
@@ -0,0 +1,128 @@
+dnl  PowerPC-64 mpn_add_n, mpn_sub_n optimised for POWER7.
+
+dnl  Copyright 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 POWER3/PPC630                 ?
+C POWER4/PPC970                 ?
+C POWER5                ?
+C POWER6                ?
+C POWER7                2.18
+
+C This is a tad bit slower than the cnd_aors_n.asm code, which is of course an
+C anomaly.
+
+ifdef(`OPERATION_add_n',`
+  define(ADDSUBC,      adde)
+  define(ADDSUB,       addc)
+  define(func,         mpn_add_n)
+  define(func_nc,      mpn_add_nc)
+  define(GENRVAL,      `addi   r3, r3, 1')
+  define(SETCBR,       `addic  r0, $1, -1')
+  define(CLRCB,                `addic  r0, r0, 0')
+')
+ifdef(`OPERATION_sub_n',`
+  define(ADDSUBC,      subfe)
+  define(ADDSUB,       subfc)
+  define(func,         mpn_sub_n)
+  define(func_nc,      mpn_sub_nc)
+  define(GENRVAL,      `neg    r3, r3')
+  define(SETCBR,       `subfic r0, $1, 0')
+  define(CLRCB,                `addic  r0, r1, -1')
+')
+
+MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
+
+C INPUT PARAMETERS
+define(`rp',   `r3')
+define(`up',   `r4')
+define(`vp',   `r5')
+define(`n',    `r6')
+
+ASM_START()
+PROLOGUE(func_nc)
+       SETCBR(r7)
+       b       L(ent)
+EPILOGUE()
+
+PROLOGUE(func)
+       CLRCB
+L(ent):
+       andi.   r7, n, 1
+       beq     L(bx0)
+
+L(bx1):        ld      r7, 0(up)
+       ld      r9, 0(vp)
+       ADDSUBC r11, r9, r7
+       std     r11, 0(rp)
+       cmpldi  cr6, n, 1
+       beq     cr6, L(end)
+       addi    up, up, 8
+       addi    vp, vp, 8
+       addi    rp, rp, 8
+
+L(bx0):        addi    r0, n, 2        C compute branch...
+       srdi    r0, r0, 2       C ...count
+       mtctr   r0
+
+       andi.   r7, n, 2
+       bne     L(mid)
+
+       addi    up, up, 16
+       addi    vp, vp, 16
+       addi    rp, rp, 16
+
+       ALIGN(32)
+L(top):        ld      r6, -16(up)
+       ld      r7, -8(up)
+       ld      r8, -16(vp)
+       ld      r9, -8(vp)
+       ADDSUBC r10, r8, r6
+       ADDSUBC r11, r9, r7
+       std     r10, -16(rp)
+       std     r11, -8(rp)
+L(mid):        ld      r6, 0(up)
+       ld      r7, 8(up)
+       ld      r8, 0(vp)
+       ld      r9, 8(vp)
+       ADDSUBC r10, r8, r6
+       ADDSUBC r11, r9, r7
+       std     r10, 0(rp)
+       std     r11, 8(rp)
+       addi    up, up, 32
+       addi    vp, vp, 32
+       addi    rp, rp, 32
+       bdnz    L(top)
+
+L(end):        subfe   r3, r0, r0      C -cy
+       GENRVAL
+       blr
+EPILOGUE()
diff --git a/mpn/powerpc64/mode64/p7/aorsorrlsh1_n.asm b/mpn/powerpc64/mode64/p7/aorsorrlsh1_n.asm
new file mode 100644 (file)
index 0000000..ddf5fd8
--- /dev/null
@@ -0,0 +1,43 @@
+dnl  PowerPC-64 mpn_addlsh1_n, mpn_sublsh1_n, mpn_rsblsh1_n.
+
+dnl  Copyright 2003, 2005, 2009, 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')
+
+
+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(`powerpc64/mode64/p7/aorsorrlshC_n.asm')
diff --git a/mpn/powerpc64/mode64/p7/aorsorrlsh2_n.asm b/mpn/powerpc64/mode64/p7/aorsorrlsh2_n.asm
new file mode 100644 (file)
index 0000000..3f9d88d
--- /dev/null
@@ -0,0 +1,43 @@
+dnl  PowerPC-64 mpn_addlsh2_n, mpn_sublsh2_n, mpn_rsblsh2_n.
+
+dnl  Copyright 2003, 2005, 2009, 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')
+
+
+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(`powerpc64/mode64/p7/aorsorrlshC_n.asm')
diff --git a/mpn/powerpc64/mode64/p7/aorsorrlshC_n.asm b/mpn/powerpc64/mode64/p7/aorsorrlshC_n.asm
new file mode 100644 (file)
index 0000000..5251202
--- /dev/null
@@ -0,0 +1,129 @@
+dnl  PowerPC-64 mpn_addlshC_n, mpn_sublshC_n, mpn_rsblshC_n.
+
+dnl  Copyright 2003, 2005, 2009, 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/.
+
+C                  cycles/limb
+C POWER3/PPC630          ?
+C POWER4/PPC970          ?
+C POWER5                 ?
+C POWER6                 ?
+C POWER7                 2.5
+
+C INPUT PARAMETERS
+define(`rp', `r3')
+define(`up', `r4')
+define(`vp', `r5')
+define(`n',  `r6')
+
+ifdef(`DO_add', `
+  define(`ADDSUBC',    `addc   $1, $2, $3')
+  define(`ADDSUBE',    `adde   $1, $2, $3')
+  define(INITCY,       `addic  $1, r1, 0')
+  define(RETVAL,       `addze  r3, $1')
+  define(`func',       mpn_addlsh`'LSH`'_n)')
+ifdef(`DO_sub', `
+  define(`ADDSUBC',    `subfc  $1, $2, $3')
+  define(`ADDSUBE',    `subfe  $1, $2, $3')
+  define(INITCY,       `addic  $1, r1, -1')
+  define(RETVAL,       `subfze r3, $1
+                       neg     r3, r3')
+  define(`func',       mpn_sublsh`'LSH`'_n)')
+ifdef(`DO_rsb', `
+  define(`ADDSUBC',    `subfc  $1, $3, $2')
+  define(`ADDSUBE',    `subfe  $1, $3, $2')
+  define(INITCY,       `addic  $1, r1, -1')
+  define(RETVAL,       `addme  r3, $1')
+  define(`func',       mpn_rsblsh`'LSH`'_n)')
+
+define(`s0', `r0')  define(`s1', `r9')
+define(`u0', `r6')  define(`u1', `r7')
+define(`v0', `r10') define(`v1', `r11')
+
+
+ASM_START()
+PROLOGUE(func)
+       rldic   r7, n, 3, 59
+       add     up, up, r7
+       add     vp, vp, r7
+       add     rp, rp, r7
+
+ifdef(`DO_add', `
+       addic   r0, n, 3        C set cy flag as side effect
+',`
+       subfc   r0, r0, r0      C set cy flag
+       addi    r0, n, 3
+')
+       srdi    r0, r0, 2
+       mtctr   r0
+
+       andi.   r0, n, 1
+       beq     L(bx0)
+
+L(bx1):        andi.   r0, n, 2
+       li      s0, 0
+       bne     L(lo3)
+       b       L(lo1)
+
+L(bx0):        andi.   r0, n, 2
+       li      s1, 0
+       bne     L(lo2)
+
+       ALIGN(32)
+L(top):        addi    rp, rp, 32
+       ld      v0, 0(vp)
+       addi    vp, vp, 32
+       rldimi  s1, v0, LSH, 0
+       ld      u0, 0(up)
+       addi    up, up, 32
+       srdi    s0, v0, RSH
+       ADDSUBE(s1, s1, u0)
+       std     s1, -32(rp)
+L(lo3):        ld      v1, -24(vp)
+       rldimi  s0, v1, LSH, 0
+       ld      u1, -24(up)
+       srdi    s1, v1, RSH
+       ADDSUBE(s0, s0, u1)
+       std     s0, -24(rp)
+L(lo2):        ld      v0, -16(vp)
+       rldimi  s1, v0, LSH, 0
+       ld      u0, -16(up)
+       srdi    s0, v0, RSH
+       ADDSUBE(s1, s1, u0)
+       std     s1, -16(rp)
+L(lo1):        ld      v1, -8(vp)
+       rldimi  s0, v1, LSH, 0
+       ld      u1, -8(up)
+       srdi    s1, v1, RSH
+       ADDSUBE(s0, s0, u1)
+       std     s0, -8(rp)
+       bdnz    L(top)          C decrement CTR and loop back
+
+       RETVAL( s1)
+       blr
+EPILOGUE()
diff --git a/mpn/powerpc64/mode64/p7/gcd_1.asm b/mpn/powerpc64/mode64/p7/gcd_1.asm
new file mode 100644 (file)
index 0000000..47cb40b
--- /dev/null
@@ -0,0 +1,110 @@
+dnl  PowerPC-64 mpn_gcd_1.
+
+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')
+
+C                  cycles/bit (approx)
+C POWER3/PPC630                 -
+C POWER4/PPC970                 -
+C POWER5                -
+C POWER6                -
+C POWER7                7.6
+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(`cnt',  `r9')dnl
+
+       neg.    r6, r3
+       and     r6, r6, r3
+       cntlzd  cnt, r6
+       li      r12, 63
+       bne     L(mid)
+       b       L(end)
+
+       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
+       cntlzd  cnt, r8
+       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
+EPILOGUE()
index a2a8f7317506e4c3daa5d7229a6b13e2ae3b9bbd..7e719e8aac8d47d9d66f48eaeee1b7ca864850f1 100644 (file)
@@ -1,71 +1,86 @@
 /* POWER7 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2009, 2010, 2011
-Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2003, 2009-2011, 2013, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
-/* 3550 MHz POWER7 (gcc110.fsffrance.org) */
+/* 3700 MHz POWER7/SMT4 (gcc111.fsffrance.org) */
+/* FFT tuning limit = 40000000 */
+/* Generated by tuneup.c, 2014-03-13, 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          8
+#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        12
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD        33
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD     17
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD         8
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD        24
+#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              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           38
+#define BMOD_1_TO_MOD_1_THRESHOLD           28
 
 #define MUL_TOOM22_THRESHOLD                22
-#define MUL_TOOM33_THRESHOLD                73
-#define MUL_TOOM44_THRESHOLD               154
-#define MUL_TOOM6H_THRESHOLD               270
-#define MUL_TOOM8H_THRESHOLD               369
+#define MUL_TOOM33_THRESHOLD                72
+#define MUL_TOOM44_THRESHOLD               200
+#define MUL_TOOM6H_THRESHOLD               298
+#define MUL_TOOM8H_THRESHOLD               406
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD      81
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     122
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD     105
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD     105
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD     112
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD      69
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD     140
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD     132
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD     138
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     124
 
 #define SQR_BASECASE_THRESHOLD               0  /* always (native) */
-#define SQR_TOOM2_THRESHOLD                 30
+#define SQR_TOOM2_THRESHOLD                 36
 #define SQR_TOOM3_THRESHOLD                109
-#define SQR_TOOM4_THRESHOLD                178
-#define SQR_TOOM6_THRESHOLD                303
-#define SQR_TOOM8_THRESHOLD                357
+#define SQR_TOOM4_THRESHOLD                196
+#define SQR_TOOM6_THRESHOLD                414
+#define SQR_TOOM8_THRESHOLD                547
 
-#define MULMID_TOOM42_THRESHOLD             62
+#define MULMID_TOOM42_THRESHOLD             58
 
-#define MULMOD_BNM1_THRESHOLD               16
-#define SQRMOD_BNM1_THRESHOLD               18
+#define MULMOD_BNM1_THRESHOLD               15
+#define SQRMOD_BNM1_THRESHOLD               20
 
-#define MUL_FFT_MODF_THRESHOLD             444  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             412  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    436, 5}, {     19, 6}, {     10, 5}, {     21, 6}, \
+  { {    412, 5}, {     19, 6}, {     10, 5}, {     21, 6}, \
     {     21, 7}, {     11, 6}, {     23, 7}, {     12, 6}, \
-    {     25, 7}, {     13, 6}, {     27, 7}, {     15, 6}, \
-    {     31, 7}, {     21, 8}, {     11, 7}, {     25, 8}, \
-    {     13, 7}, {     28, 8}, {     15, 7}, {     32, 8}, \
+    {     25, 7}, {     21, 8}, {     11, 7}, {     25, 8}, \
+    {     13, 7}, {     28, 8}, {     15, 7}, {     33, 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}, \
@@ -75,89 +90,154 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
     {     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,11}, {    111,12}, \
-    {     63,11}, {    127,10}, {    255,11}, {    143,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, 9}, {   1087,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,10}, \
-    {    831,12}, {    223,11}, {    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 106
-#define MUL_FFT_THRESHOLD                 5248
+    {    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, 9}, {    767,13}, {     63,12}, {    127,11}, \
+    {    255,10}, {    511,11}, {    271,10}, {    543, 9}, \
+    {   1087,11}, {    287,10}, {    575,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,12}, \
+    {    287,11}, {    575,10}, {   1151,11}, {    607,12}, \
+    {    319,11}, {    639,10}, {   1279,11}, {    671,12}, \
+    {    351,11}, {    703,12}, {    383,11}, {    767,12}, \
+    {    415,11}, {    831,10}, {   1663,12}, {    447,11}, \
+    {    895,12}, {    479,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,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,12}, {    959,11}, \
+    {   1919,14}, {    255,13}, {    511,12}, {   1087,11}, \
+    {   2175,13}, {    575,12}, {   1215,11}, {   2431,13}, \
+    {    639,12}, {   1343,11}, {   2687,13}, {    703,12}, \
+    {   1407,11}, {   2815,14}, {    383,13}, {    767,12}, \
+    {   1599,13}, {    831,12}, {   1663,13}, {    895,12}, \
+    {   1791,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}, {   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,12}, {   3839,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}, {   1919,13}, {   3839,16}, \
+    {    511,15}, {   1023,14}, {   2175,13}, {   4351,14}, \
+    {   2431,13}, {   4863,15}, {  32768,16}, {  65536,17}, \
+    { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
+    {2097152,22}, {4194304,23}, {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 231
+#define MUL_FFT_THRESHOLD                 4288
 
-#define SQR_FFT_MODF_THRESHOLD             380  /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD             368  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    308, 5}, {     17, 6}, {      9, 5}, {     19, 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}, \
-    {     41, 9}, {     23, 8}, {     47, 9}, {     27,10}, \
-    {     15, 9}, {     39,10}, {     23, 9}, {     47,11}, \
+  { {    368, 5}, {     19, 6}, {     10, 5}, {     21, 6}, \
+    {     21, 7}, {     11, 6}, {     23, 7}, {     12, 6}, \
+    {     25, 7}, {     15, 6}, {     31, 7}, {     21, 8}, \
+    {     11, 7}, {     25, 8}, {     13, 7}, {     28, 8}, \
+    {     15, 7}, {     32, 8}, {     17, 7}, {     35, 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}, {     47,11}, {     31,10}, {     79,11}, \
-    {     47,10}, {     95,12}, {     31,11}, {     63,10}, \
-    {    127, 9}, {    255,10}, {    135,11}, {     79,10}, \
+    {     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,12}, {     63,11}, {    127,10}, {    255, 9}, \
-    {    511,10}, {    271, 9}, {    543,11}, {    143,10}, \
-    {    287, 9}, {    575,11}, {    159,10}, {    319, 9}, \
-    {    639,11}, {    175,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,12}, \
-    {    159,11}, {    319,10}, {    639, 9}, {   1279,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}, \
-    {   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 103
-#define SQR_FFT_THRESHOLD                 3712
+    {    511,10}, {    271,11}, {    143,10}, {    287, 9}, \
+    {    575,10}, {    303,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, 9}, {   1087,11}, \
+    {    287,10}, {    575, 9}, {   1151,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,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,10}, \
+    {   1663,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}, \
+    {    703,11}, {   1407,10}, {   2815,13}, {    383,12}, \
+    {    767,11}, {   1535,12}, {    799,11}, {   1599,12}, \
+    {    831,11}, {   1663,13}, {    447,12}, {    895,11}, \
+    {   1791,12}, {    959,11}, {   1919,10}, {   3839,14}, \
+    {    255,13}, {    511,12}, {   1087,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}, {   1663,13}, \
+    {    895,12}, {   1791,13}, {    959,12}, {   1919,14}, \
+    {    511,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,14}, {    767,13}, \
+    {   1663,12}, {   3327,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}, {   1535,13}, {   3199,14}, \
+    {   1663,13}, {   3455,14}, {   1791,13}, {   3583,14}, \
+    {   1919,13}, {   3839,16}, {    511,15}, {   1023,14}, \
+    {   2175,13}, {   4479,14}, {   2303,13}, {   4607,14}, \
+    {   2431,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             5
-#define MULLO_DC_THRESHOLD                  33
-#define MULLO_MUL_N_THRESHOLD            10323
+#define MULLO_BASECASE_THRESHOLD             3
+#define MULLO_DC_THRESHOLD                  34
+#define MULLO_MUL_N_THRESHOLD             9174
 
-#define DC_DIV_QR_THRESHOLD                 57
-#define DC_DIVAPPR_Q_THRESHOLD             185
+#define DC_DIV_QR_THRESHOLD                 33
+#define DC_DIVAPPR_Q_THRESHOLD             126
 #define DC_BDIV_QR_THRESHOLD                63
-#define DC_BDIV_Q_THRESHOLD                158
+#define DC_BDIV_Q_THRESHOLD                152
 
-#define INV_MULMOD_BNM1_THRESHOLD           58
-#define INV_NEWTON_THRESHOLD               212
-#define INV_APPR_THRESHOLD                 187
+#define INV_MULMOD_BNM1_THRESHOLD           54
+#define INV_NEWTON_THRESHOLD               155
+#define INV_APPR_THRESHOLD                 125
 
-#define BINV_NEWTON_THRESHOLD              276
-#define REDC_1_TO_REDC_N_THRESHOLD          63
+#define BINV_NEWTON_THRESHOLD              294
+#define REDC_1_TO_REDC_2_THRESHOLD          17
+#define REDC_2_TO_REDC_N_THRESHOLD         115
 
-#define MU_DIV_QR_THRESHOLD               1442
-#define MU_DIVAPPR_Q_THRESHOLD            1442
-#define MUPI_DIV_QR_THRESHOLD               91
+#define MU_DIV_QR_THRESHOLD               1334
+#define MU_DIVAPPR_Q_THRESHOLD            1334
+#define MUPI_DIV_QR_THRESHOLD               54
 #define MU_BDIV_QR_THRESHOLD              1142
-#define MU_BDIV_Q_THRESHOLD               1442
+#define MU_BDIV_Q_THRESHOLD               1470
 
-#define POWM_SEC_TABLE  3,38,270,1487
+#define POWM_SEC_TABLE  1,14,62,642,960
 
 #define MATRIX22_STRASSEN_THRESHOLD         14
-#define HGCD_THRESHOLD                     138
-#define HGCD_APPR_THRESHOLD                157
-#define HGCD_REDUCE_THRESHOLD             2578
-#define GCD_DC_THRESHOLD                   573
-#define GCDEXT_DC_THRESHOLD                440
+#define HGCD_THRESHOLD                     126
+#define HGCD_APPR_THRESHOLD                184
+#define HGCD_REDUCE_THRESHOLD             3014
+#define GCD_DC_THRESHOLD                   440
+#define GCDEXT_DC_THRESHOLD                386
 #define JACOBI_BASE_METHOD                   4
 
-#define GET_STR_DC_THRESHOLD                14
-#define GET_STR_PRECOMPUTE_THRESHOLD        32
-#define SET_STR_DC_THRESHOLD              1517
-#define SET_STR_PRECOMPUTE_THRESHOLD      3007
+#define GET_STR_DC_THRESHOLD                11
+#define GET_STR_PRECOMPUTE_THRESHOLD        17
+#define SET_STR_DC_THRESHOLD              1655
+#define SET_STR_PRECOMPUTE_THRESHOLD      3417
 
-#define FAC_DSC_THRESHOLD                  680
-#define FAC_ODD_THRESHOLD                   24
+#define FAC_DSC_THRESHOLD                 1138
+#define FAC_ODD_THRESHOLD                   27
diff --git a/mpn/powerpc64/mode64/rsh1add_n.asm b/mpn/powerpc64/mode64/rsh1add_n.asm
deleted file mode 100644 (file)
index 2a5ef30..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-dnl  PowerPC-64 mpn_rsh1add_n -- rp[] = (up[] + vp[]) >> 1
-
-dnl  Copyright 2003, 2005, 2010 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 POWER3/PPC630          2              (1.5 c/l should be possible)
-C POWER4/PPC970          4              (2.0 c/l should be possible)
-C POWER5                 3.5            (2.0 c/l should be possible)
-C POWER6                 4.5
-C POWER7                 3.5
-
-define(`rp',`r3')
-define(`up',`r4')
-define(`vp',`r5')
-
-define(`s0',`r6')
-define(`s1',`r7')
-define(`x',`r0')
-define(`u0',`r8')
-define(`u1',`r9')
-define(`v0',`r10')
-define(`v1',`r11')
-
-
-ASM_START()
-PROLOGUE(mpn_rsh1add_n)
-       mtctr   r6              C copy size to count register
-       addi    rp, rp, -8
-
-       ld      u1, 0(up)
-       ld      v1, 0(vp)
-       addc    x, v1, u1
-       rldicl  r12, x, 0, 63   C return value
-       srdi    s1, x, 1
-
-       bdz     L(1)
-
-       ld      u0, 8(up)
-       ld      v0, 8(vp)
-
-       bdz     L(end)
-
-       ALIGN(32)
-L(top):        ldu     u1, 16(up)
-       ldu     v1, 16(vp)
-       adde    x, v0, u0
-       srdi    s0, x, 1
-       rldimi  s1, x, 63, 0
-       std     s1, 8(rp)
-
-       bdz     L(exi)
-
-       ld      u0, 8(up)
-       ld      v0, 8(vp)
-       adde    x, v1, u1
-       srdi    s1, x, 1
-       rldimi  s0, x, 63, 0
-       stdu    s0, 16(rp)
-
-       bdnz    L(top)
-
-L(end):        adde    x, v0, u0
-       srdi    s0, x, 1
-       rldimi  s1, x, 63, 0
-       std     s1, 8(rp)
-
-       li      x, 0
-       addze   x, x
-       rldimi  s0, x, 63, 0
-       std     s0, 16(rp)
-       mr      r3, r12
-       blr
-
-L(exi):        adde    x, v1, u1
-       srdi    s1, x, 1
-       rldimi  s0, x, 63, 0
-       stdu    s0, 16(rp)
-
-L(1):  li      x, 0
-       addze   x, x
-       rldimi  s1, x, 63, 0
-       std     s1, 8(rp)
-       mr      r3, r12
-       blr
-EPILOGUE()
diff --git a/mpn/powerpc64/mode64/rsh1aors_n.asm b/mpn/powerpc64/mode64/rsh1aors_n.asm
new file mode 100644 (file)
index 0000000..7f7734b
--- /dev/null
@@ -0,0 +1,172 @@
+dnl  PowerPC-64 mpn_rsh1add_n, mpn_rsh1sub_n
+
+dnl  Copyright 2003, 2005, 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 POWER3/PPC630                 ?
+C POWER4/PPC970                 2.9
+C POWER5                ?
+C POWER6                3.5
+C POWER7                2.25
+
+define(`rp', `r3')
+define(`up', `r4')
+define(`vp', `r5')
+define(`n',  `r6')
+
+ifdef(`OPERATION_rsh1add_n', `
+  define(`ADDSUBC',    `addc')
+  define(`ADDSUBE',    `adde')
+  define(INITCY,       `addic  $1, r1, 0')
+  define(`func',       mpn_rsh1add_n)')
+ifdef(`OPERATION_rsh1sub_n', `
+  define(`ADDSUBC',    `subfc')
+  define(`ADDSUBE',    `subfe')
+  define(INITCY,       `addic  $1, r1, -1')
+  define(`func',       mpn_rsh1sub_n)')
+
+define(`s0', `r9')
+define(`s1', `r7')
+define(`x0', `r0')
+define(`x1', `r12')
+define(`u0', `r8')
+define(`v0', `r10')
+
+
+ASM_START()
+PROLOGUE(func)
+       ld      u0, 0(up)
+       ld      v0, 0(vp)
+
+       cmpdi   cr6, n, 2
+
+       addi    r0, n, 1
+       srdi    r0, r0, 2
+       mtctr   r0                      C copy size to count register
+
+       andi.   r0, n, 1
+       bne     cr0, L(bx1)
+
+L(bx0):        ADDSUBC x1, v0, u0
+       ld      u0, 8(up)
+       ld      v0, 8(vp)
+       ADDSUBE x0, v0, u0
+       ble     cr6, L(n2)
+       ld      u0, 16(up)
+       ld      v0, 16(vp)
+       srdi    s0, x1, 1
+       rldicl  r11, x1, 0, 63          C return value
+       ADDSUBE x1, v0, u0
+       andi.   n, n, 2
+       bne     cr0, L(b10)
+L(b00):        addi    rp, rp, -24
+       b       L(lo0)
+L(b10):        addi    up, up, 16
+       addi    vp, vp, 16
+       addi    rp, rp, -8
+       b       L(lo2)
+
+       ALIGN(16)
+L(bx1):        ADDSUBC x0, v0, u0
+       ble     cr6, L(n1)
+       ld      u0, 8(up)
+       ld      v0, 8(vp)
+       ADDSUBE x1, v0, u0
+       ld      u0, 16(up)
+       ld      v0, 16(vp)
+       srdi    s1, x0, 1
+       rldicl  r11, x0, 0, 63          C return value
+       ADDSUBE x0, v0, u0
+       andi.   n, n, 2
+       bne     cr0, L(b11)
+L(b01):        addi    up, up, 8
+       addi    vp, vp, 8
+       addi    rp, rp, -16
+       b       L(lo1)
+L(b11):        addi    up, up, 24
+       addi    vp, vp, 24
+       bdz     L(end)
+
+       ALIGN(32)
+L(top):        ld      u0, 0(up)
+       ld      v0, 0(vp)
+       srdi    s0, x1, 1
+       rldimi  s1, x1, 63, 0
+       std     s1, 0(rp)
+       ADDSUBE x1, v0, u0
+L(lo2):        ld      u0, 8(up)
+       ld      v0, 8(vp)
+       srdi    s1, x0, 1
+       rldimi  s0, x0, 63, 0
+       std     s0, 8(rp)
+       ADDSUBE x0, v0, u0
+L(lo1):        ld      u0, 16(up)
+       ld      v0, 16(vp)
+       srdi    s0, x1, 1
+       rldimi  s1, x1, 63, 0
+       std     s1, 16(rp)
+       ADDSUBE x1, v0, u0
+L(lo0):        ld      u0, 24(up)
+       ld      v0, 24(vp)
+       srdi    s1, x0, 1
+       rldimi  s0, x0, 63, 0
+       std     s0, 24(rp)
+       ADDSUBE x0, v0, u0
+       addi    up, up, 32
+       addi    vp, vp, 32
+       addi    rp, rp, 32
+       bdnz    L(top)
+
+L(end):        srdi    s0, x1, 1
+       rldimi  s1, x1, 63, 0
+       std     s1, 0(rp)
+L(cj2):        srdi    s1, x0, 1
+       rldimi  s0, x0, 63, 0
+       std     s0, 8(rp)
+L(cj1):        ADDSUBE x1, x1, x1              C pseudo-depends on x1
+       rldimi  s1, x1, 63, 0
+       std     s1, 16(rp)
+       mr      r3, r11
+       blr
+
+L(n1): srdi    s1, x0, 1
+       rldicl  r11, x0, 0, 63          C return value
+       ADDSUBE x1, x1, x1              C pseudo-depends on x1
+       rldimi  s1, x1, 63, 0
+       std     s1, 0(rp)
+       mr      r3, r11
+       blr
+
+L(n2): addi    rp, rp, -8
+       srdi    s0, x1, 1
+       rldicl  r11, x1, 0, 63          C return value
+       b       L(cj2)
+EPILOGUE()
diff --git a/mpn/powerpc64/mode64/rsh1sub_n.asm b/mpn/powerpc64/mode64/rsh1sub_n.asm
deleted file mode 100644 (file)
index b10eb8a..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-dnl  PowerPC-64 mpn_rsh1sub_n -- rp[] = (up[] - vp[]) >> 1
-
-dnl  Copyright 2003, 2005, 2010 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 POWER3/PPC630          2              (1.5 c/l should be possible)
-C POWER4/PPC970          4              (2.0 c/l should be possible)
-C POWER5                 3.5            (2.0 c/l should be possible)
-C POWER6                 4.5
-C POWER7                 3.5
-
-define(`rp',`r3')
-define(`up',`r4')
-define(`vp',`r5')
-
-define(`s0',`r6')
-define(`s1',`r7')
-define(`x',`r0')
-define(`u0',`r8')
-define(`u1',`r9')
-define(`v0',`r10')
-define(`v1',`r11')
-
-
-ASM_START()
-PROLOGUE(mpn_rsh1sub_n)
-       mtctr   r6              C copy size to count register
-       addi    rp, rp, -8
-
-       ld      u1, 0(up)
-       ld      v1, 0(vp)
-       subfc   x, v1, u1
-       rldicl  r12, x, 0, 63   C return value
-       srdi    s1, x, 1
-
-       bdz     L(1)
-
-       ld      u0, 8(up)
-       ld      v0, 8(vp)
-
-       bdz     L(end)
-
-       ALIGN(32)
-L(top):        ldu     u1, 16(up)
-       ldu     v1, 16(vp)
-       subfe   x, v0, u0
-       srdi    s0, x, 1
-       rldimi  s1, x, 63, 0
-       std     s1, 8(rp)
-
-       bdz     L(exi)
-
-       ld      u0, 8(up)
-       ld      v0, 8(vp)
-       subfe   x, v1, u1
-       srdi    s1, x, 1
-       rldimi  s0, x, 63, 0
-       stdu    s0, 16(rp)
-
-       bdnz    L(top)
-
-L(end):        subfe   x, v0, u0
-       srdi    s0, x, 1
-       rldimi  s1, x, 63, 0
-       std     s1, 8(rp)
-
-       subfe   x, x, x
-       rldimi  s0, x, 63, 0
-       std     s0, 16(rp)
-       mr      r3, r12
-       blr
-
-L(exi):        subfe   x, v1, u1
-       srdi    s1, x, 1
-       rldimi  s0, x, 63, 0
-       stdu    s0, 16(rp)
-
-L(1):  subfe   x, x, x
-       rldimi  s1, x, 63, 0
-       std     s1, 8(rp)
-       mr      r3, r12
-       blr
-EPILOGUE()
index d32ef7e35dc8e1e8265e1cdddb9f270d9e58d417..e76bb8878d81527c55928fb94d47930ee4d450e1 100644 (file)
@@ -2,23 +2,34 @@ dnl  PowerPC-64 mpn_sqr_basecase.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2008, 2010, 2011 Free
-dnl  Software Foundation, Inc.
+dnl  Copyright 1999-2001, 2003-2006, 2008, 2010, 2011 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 15283d0cab9f74ee55d04627d4ed9b22f8e6f34e..1a200fb3463669b5875fa06aebd12b68248911cc 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-64 mpn_lshift -- rp[] = up[] << cnt
 dnl  Copyright 2003, 2005, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -41,7 +52,7 @@ define(`retval',`r3')
 define(`rp',  `r7')
 
 ASM_START()
-PROLOGUE(mpn_lshift)
+PROLOGUE(mpn_lshift,toc)
 
 ifdef(`HAVE_ABI_mode32',`
        rldicl  n, n, 0,32              C FIXME: avoid this zero extend
index 146579afdd310eefbdb10480e0e278fad478c52b..e4b3caaab8a5d78c659380541233daf9b792c92a 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-64 mpn_lshiftc -- rp[] = ~up[] << cnt
 dnl  Copyright 2003, 2005, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -41,7 +52,7 @@ define(`retval',`r3')
 define(`rp',  `r7')
 
 ASM_START()
-PROLOGUE(mpn_lshiftc)
+PROLOGUE(mpn_lshiftc,toc)
 
 ifdef(`HAVE_ABI_mode32',`
        rldicl  n, n, 0,32              C FIXME: avoid this zero extend
index 6a1e0c2a83b0f8a3b88e4241c6bdb378d66f5997..9e848c1fc78ca56b4b3a02a762470c89b1f8c97f 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-64 mpn_rshift -- rp[] = up[] << cnt
 dnl  Copyright 2003, 2005, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -41,7 +52,7 @@ define(`retval',`r3')
 define(`rp',  `r7')
 
 ASM_START()
-PROLOGUE(mpn_rshift)
+PROLOGUE(mpn_rshift,toc)
 
 ifdef(`HAVE_ABI_mode32',`
        rldicl  n, n, 0,32              C FIXME: avoid this zero extend
diff --git a/mpn/powerpc64/p7/copyd.asm b/mpn/powerpc64/p7/copyd.asm
new file mode 100644 (file)
index 0000000..f04ca58
--- /dev/null
@@ -0,0 +1,128 @@
+dnl  PowerPC-64 mpn_copyd.
+
+dnl  Copyright 2004, 2005, 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 POWER3/PPC630          ?
+C POWER4/PPC970          ?
+C POWER5                 ?
+C POWER6                 1.25
+C POWER7                 1.09
+
+C INPUT PARAMETERS
+define(`rp',   `r3')
+define(`up',   `r4')
+define(`n',    `r5')
+
+ASM_START()
+PROLOGUE(mpn_copyd)
+
+ifdef(`HAVE_ABI_mode32',
+`      rldicl  n, n, 0,32')
+
+       sldi    r0, n, 3
+       add     up, up, r0              C point at u[] end
+       add     rp, rp, r0              C point at r[] end
+
+       cmpdi   cr0, n, 4
+       blt     L(sml)
+
+       addi    r10, n, 4
+       srdi    r10, r10, 3
+       mtctr   r10
+
+       andi.   r0, n, 1
+       rlwinm  r11, n, 0,30,30
+       rlwinm  r12, n, 0,29,29
+       cmpdi   cr6, r11, 0
+       cmpdi   cr7, r12, 0
+
+       beq     cr0, L(xx0)
+L(xx1):        ld      r6, -8(up)
+       addi    up, up, -8
+       std     r6, -8(rp)
+       addi    rp, rp, -8
+
+L(xx0):        bne     cr6, L(x10)
+L(x00):        ld      r6, -8(up)
+       ld      r7, -16(up)
+       bne     cr7, L(100)
+L(000):        addi    rp, rp, 32
+       b       L(lo0)
+L(100):        addi    up, up, 32
+       b       L(lo4)
+L(x10):        ld      r8, -8(up)
+       ld      r9, -16(up)
+       bne     cr7, L(110)
+L(010):        addi    up, up, -16
+       addi    rp, rp, 16
+       b       L(lo2)
+L(110):        addi    up, up, 16
+       addi    rp, rp, 48
+       b       L(lo6)
+
+L(sml):        cmpdi   cr0, n, 0
+       beqlr-  cr0
+       mtctr   n
+L(t):  ld      r6, -8(up)
+       addi    up, up, -8
+       std     r6, -8(rp)
+       addi    rp, rp, -8
+       bdnz    L(t)
+       blr
+
+       ALIGN(32)
+L(top):        std     r6, -8(rp)
+       std     r7, -16(rp)
+L(lo2):        ld      r6, -8(up)
+       ld      r7, -16(up)
+       std     r8, -24(rp)
+       std     r9, -32(rp)
+L(lo0):        ld      r8, -24(up)
+       ld      r9, -32(up)
+       std     r6, -40(rp)
+       std     r7, -48(rp)
+L(lo6):        ld      r6, -40(up)
+       ld      r7, -48(up)
+       std     r8, -56(rp)
+       std     r9, -64(rp)
+       addi    rp, rp, -64
+L(lo4):        ld      r8, -56(up)
+       ld      r9, -64(up)
+       addi    up, up, -64
+       bdnz    L(top)
+
+L(end):        std     r6, -8(rp)
+       std     r7, -16(rp)
+       std     r8, -24(rp)
+       std     r9, -32(rp)
+       blr
+EPILOGUE()
diff --git a/mpn/powerpc64/p7/copyi.asm b/mpn/powerpc64/p7/copyi.asm
new file mode 100644 (file)
index 0000000..854cf9f
--- /dev/null
@@ -0,0 +1,129 @@
+dnl  PowerPC-64 mpn_copyi.
+
+dnl  Copyright 2004, 2005, 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 POWER3/PPC630          ?
+C POWER4/PPC970          ?
+C POWER5                 ?
+C POWER6                 1.25
+C POWER7                 1.09
+
+C INPUT PARAMETERS
+define(`rp',   `r3')
+define(`up',   `r4')
+define(`n',    `r5')
+
+C TODO
+C  * Try rolling the two loop leading std to the end, allowing the code to
+C    handle also n = 2.
+C  * Consider using 4 pointers, schedule ptr update early wrt use.
+
+ASM_START()
+PROLOGUE(mpn_copyi)
+
+ifdef(`HAVE_ABI_mode32',
+`      rldicl  n, n, 0,32')
+
+       cmpdi   cr0, n, 4
+       blt     L(sml)
+
+       addi    r10, n, 4
+       srdi    r10, r10, 3
+       mtctr   r10
+
+       andi.   r0, n, 1
+       rlwinm  r11, n, 0,30,30
+       rlwinm  r12, n, 0,29,29
+       cmpdi   cr6, r11, 0
+       cmpdi   cr7, r12, 0
+
+       beq     cr0, L(xx0)
+L(xx1):        ld      r6, 0(up)
+       addi    up, up, 8
+       std     r6, 0(rp)
+       addi    rp, rp, 8
+
+L(xx0):        bne     cr6, L(x10)
+L(x00):        ld      r6, 0(up)
+       ld      r7, 8(up)
+       bne     cr7, L(100)
+L(000):        addi    rp, rp, -32
+       b       L(lo0)
+L(100):        addi    up, up, -32
+       b       L(lo4)
+L(x10):        ld      r8, 0(up)
+       ld      r9, 8(up)
+       bne     cr7, L(110)
+L(010):        addi    up, up, 16
+       addi    rp, rp, -16
+       b       L(lo2)
+L(110):        addi    up, up, -16
+       addi    rp, rp, -48
+       b       L(lo6)
+
+L(sml):        cmpdi   cr0, n, 0
+       beqlr-  cr0
+       mtctr   n
+L(t):  ld      r6, 0(up)
+       addi    up, up, 8
+       std     r6, 0(rp)
+       addi    rp, rp, 8
+       bdnz    L(t)
+       blr
+
+       ALIGN(32)
+L(top):        std     r6, 0(rp)
+       std     r7, 8(rp)
+L(lo2):        ld      r6, 0(up)
+       ld      r7, 8(up)
+       std     r8, 16(rp)
+       std     r9, 24(rp)
+L(lo0):        ld      r8, 16(up)
+       ld      r9, 24(up)
+       std     r6, 32(rp)
+       std     r7, 40(rp)
+L(lo6):        ld      r6, 32(up)
+       ld      r7, 40(up)
+       std     r8, 48(rp)
+       std     r9, 56(rp)
+       addi    rp, rp, 64
+L(lo4):        ld      r8, 48(up)
+       ld      r9, 56(up)
+       addi    up, up, 64
+       bdnz    L(top)
+
+L(end):        std     r6, 0(rp)
+       std     r7, 8(rp)
+       std     r8, 16(rp)
+       std     r9, 24(rp)
+       blr
+EPILOGUE()
index 07fe41fceb2dca0555738af13b50afc2c166bcb4..5af98946f7534651f402ff323622a454e0f18783 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-64 mpn_hamdist.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 9a11309a0d5923ed7bc027893eeb3f1a2061ded3..eac72a64935797c8141047476e832f91097278b6 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-64 mpn_popcount.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 18406c57e92f9bff9222f27faabd2743ecef707c..7654a16ae8c8d9a691cc1ba9ae18fcf9564810a0 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-64 mpn_rshift -- rp[] = up[] >> cnt
 dnl  Copyright 2003, 2005, 2010, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/powerpc64/sec_tabselect.asm b/mpn/powerpc64/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..085577c
--- /dev/null
@@ -0,0 +1,147 @@
+dnl  PowerPC-64 mpn_sec_tabselect.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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')
+
+C                   cycles/limb
+C POWER3/PPC630                 1.75
+C POWER4/PPC970                 2.0
+C POWER5                ?
+C POWER6                5.0
+C POWER7                1.75
+
+define(`rp',     `r3')
+define(`tp',     `r4')
+define(`n',      `r5')
+define(`nents',  `r6')
+define(`which',  `r7')
+
+define(`i',      `r8')
+define(`j',      `r9')
+define(`stride', `r12')
+define(`mask',   `r11')
+
+
+ASM_START()
+PROLOGUE(mpn_sec_tabselect)
+       addic.  j, n, -4                C outer loop induction variable
+       std     r31, -8(r1)
+       std     r30, -16(r1)
+       std     r29, -24(r1)
+       std     r28, -32(r1)
+       std     r27, -40(r1)
+       sldi    stride, n, 3
+
+       blt     cr0, L(outer_end)
+L(outer_top):
+       mtctr   nents
+       mr      r10, tp
+       li      r28, 0
+       li      r29, 0
+       li      r30, 0
+       li      r31, 0
+       addic.  j, j, -4                C outer loop induction variable
+       mr      i, which
+
+       ALIGN(16)
+L(top):        addic   i, i, -1                C set carry iff i != 0
+       subfe   mask, mask, mask
+       ld      r0, 0(tp)
+       ld      r27, 8(tp)
+       and     r0, r0, mask
+       and     r27, r27, mask
+       or      r28, r28, r0
+       or      r29, r29, r27
+       ld      r0, 16(tp)
+       ld      r27, 24(tp)
+       and     r0, r0, mask
+       and     r27, r27, mask
+       or      r30, r30, r0
+       or      r31, r31, r27
+       add     tp, tp, stride
+       bdnz    L(top)
+
+       std     r28, 0(rp)
+       std     r29, 8(rp)
+       std     r30, 16(rp)
+       std     r31, 24(rp)
+       addi    tp, r10, 32
+       addi    rp, rp, 32
+       bge     cr0, L(outer_top)
+L(outer_end):
+
+       rldicl. r0, n, 63, 63
+       beq     cr0, L(b0x)
+L(b1x):        mtctr   nents
+       mr      r10, tp
+       li      r28, 0
+       li      r29, 0
+       mr      i, which
+       ALIGN(16)
+L(tp2):        addic   i, i, -1
+       subfe   mask, mask, mask
+       ld      r0, 0(tp)
+       ld      r27, 8(tp)
+       and     r0, r0, mask
+       and     r27, r27, mask
+       or      r28, r28, r0
+       or      r29, r29, r27
+       add     tp, tp, stride
+       bdnz    L(tp2)
+       std     r28, 0(rp)
+       std     r29, 8(rp)
+       addi    tp, r10, 16
+       addi    rp, rp, 16
+
+L(b0x):        rldicl. r0, n, 0, 63
+       beq     cr0, L(b00)
+L(b01):        mtctr   nents
+       mr      r10, tp
+       li      r28, 0
+       mr      i, which
+       ALIGN(16)
+L(tp1):        addic   i, i, -1
+       subfe   mask, mask, mask
+       ld      r0, 0(tp)
+       and     r0, r0, mask
+       or      r28, r28, r0
+       add     tp, tp, stride
+       bdnz    L(tp1)
+       std     r28, 0(rp)
+
+L(b00):        ld      r31, -8(r1)
+       ld      r30, -16(r1)
+       ld      r29, -24(r1)
+       ld      r28, -32(r1)
+       ld      r27, -40(r1)
+       blr
+EPILOGUE()
diff --git a/mpn/powerpc64/tabselect.asm b/mpn/powerpc64/tabselect.asm
deleted file mode 100644 (file)
index 7d18938..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-dnl  PowerPC-64 mpn_tabselect.
-
-dnl  Copyright 2011 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 POWER3/PPC630          ?
-C POWER4/PPC970          3.3
-C POWER5                 ?
-C POWER6                 ?
-C POWER7                 2.5
-
-C NOTES
-C  * This has not been tuned for any specific processor.  Its speed should not
-C    be too bad, though.
-C  * Using VMX could result in significant speedup for certain CPUs.
-
-C mpn_tabselect (mp_limb_t *rp, mp_limb_t *tp, mp_size_t n, mp_size_t nents, mp_size_t which)
-define(`rp',     `r3')
-define(`tp',     `r4')
-define(`n',      `r5')
-define(`nents',  `r6')
-define(`which',  `r7')
-
-define(`mask',   `r8')
-
-ASM_START()
-       TEXT
-       ALIGN(16)
-PROLOGUE(mpn_tabselect)
-       addi    r0, n, 1
-       srdi    r0, r0, 1               C inner loop count
-       andi.   r9, n, 1                C set cr0 for use in inner loop
-       subf    which, nents, which
-       sldi    n, n, 3
-
-L(outer):
-       mtctr   r0                      C put inner loop count in ctr
-
-       add     r9, which, nents        C are we at the selected table entry?
-       addic   r9, r9, -1              C set CF iff not selected entry
-       subfe   mask, r0, r0
-
-       beq     cr0, L(top)             C branch to loop entry if n even
-
-       ld      r9, 0(tp)
-       addi    tp, tp, 8
-       and     r9, r9, mask
-       ld      r11, 0(rp)
-       andc    r11, r11, mask
-       or      r9, r9, r11
-       std     r9, 0(rp)
-       addi    rp, rp, 8
-       bdz     L(end)
-
-       ALIGN(16)
-L(top):        ld      r9, 0(tp)
-       ld      r10, 8(tp)
-       addi    tp, tp, 16
-       nop
-       and     r9, r9, mask
-       and     r10, r10, mask
-       ld      r11, 0(rp)
-       ld      r12, 8(rp)
-       andc    r11, r11, mask
-       andc    r12, r12, mask
-       or      r9, r9, r11
-       or      r10, r10, r12
-       std     r9, 0(rp)
-       std     r10, 8(rp)
-       addi    rp, rp, 16
-       bdnz    L(top)
-
-L(end):        subf    rp, n, rp               C move rp back to beginning
-       cmpdi   cr6, nents, 1
-       addi    nents, nents, -1
-       bne     cr6, L(outer)
-
-       blr
-EPILOGUE()
index 516be3d98bbcf33adc8933671c73684de0ed70de..7fcc72f18f562b9dee899094f5edb908a0f04927 100644 (file)
@@ -1,21 +1,32 @@
-dnl PowerPC-64 umul_ppmm -- support for longlong.h
+dnl  PowerPC-64 umul_ppmm -- support for longlong.h
 
-dnl Copyright 2000, 2001, 2005 Free Software Foundation, Inc.
+dnl  Copyright 2000, 2001, 2005 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 This file is part of the GNU MP Library.
+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 The GNU MP Library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public License as
-dnl published by the Free Software Foundation; either version 3 of the
-dnl License, or (at your option) any later version.
+dnl  or both in parallel, as here.
 dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
-dnl General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 9734f8c48943c2873bc6051ab04c3b4a20d27e5e..b95fb88b1ae0cd38ca6f0d1e6d3f6f41d23da9d4 100644 (file)
@@ -3,19 +3,30 @@ dnl  PowerPC-32/VMX and PowerPC-64/VMX mpn_popcount.
 dnl  Copyright 2006, 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -55,7 +66,7 @@ define(`LIMBS_PER_CHUNK', 0x1000)
 define(`LIMBS_CHUNK_THRES', 0x1001)
 
 ASM_START()
-PROLOGUE(mpn_popcount)
+PROLOGUE(mpn_popcount,toc)
        mfspr   r10, 256
        oris    r0, r10, 0xfffc         C Set VRSAVE bit 0-13
        mtspr   256, r0
diff --git a/mpn/pyr/add_n.s b/mpn/pyr/add_n.s
deleted file mode 100644 (file)
index 7ac02e6..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-# Pyramid __gmpn_add_n -- Add two limb vectors of the same length > 0 and store
-# sum in a third limb vector.
-
-# Copyright 1995, 2000 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 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.
-
-# 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 Lesser General Public
-# License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-.text
-       .align  2
-.globl ___gmpn_add_n
-___gmpn_add_n:
-       movw    $-1,tr0         # representation for carry clear
-
-       movw    pr3,tr2
-       andw    $3,tr2
-       beq     Lend0
-       subw    tr2,pr3
-
-Loop0: rsubw   $0,tr0          # restore carry bit from carry-save register
-
-       movw    (pr1),tr1
-       addwc   (pr2),tr1
-       movw    tr1,(pr0)
-
-       subwb   tr0,tr0
-       addw    $4,pr0
-       addw    $4,pr1
-       addw    $4,pr2
-       addw    $-1,tr2
-       bne     Loop0
-
-       mtstw   pr3,pr3
-       beq     Lend
-Lend0:
-Loop:  rsubw   $0,tr0          # restore carry bit from carry-save register
-
-       movw    (pr1),tr1
-       addwc   (pr2),tr1
-       movw    tr1,(pr0)
-
-       movw    4(pr1),tr1
-       addwc   4(pr2),tr1
-       movw    tr1,4(pr0)
-
-       movw    8(pr1),tr1
-       addwc   8(pr2),tr1
-       movw    tr1,8(pr0)
-
-       movw    12(pr1),tr1
-       addwc   12(pr2),tr1
-       movw    tr1,12(pr0)
-
-       subwb   tr0,tr0
-       addw    $16,pr0
-       addw    $16,pr1
-       addw    $16,pr2
-       addw    $-4,pr3
-       bne     Loop
-Lend:
-       mnegw   tr0,pr0
-       ret
diff --git a/mpn/pyr/addmul_1.s b/mpn/pyr/addmul_1.s
deleted file mode 100644 (file)
index d40a9e7..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-# Pyramid __gmpn_addmul_1 -- Multiply a limb vector with a limb and add
-# the result to a second limb vector.
-
-# Copyright 1995, 2000 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 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.
-
-# 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 Lesser General Public
-# License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-.text
-       .align  2
-.globl ___gmpn_addmul_1
-___gmpn_addmul_1:
-       mova    (pr0)[pr2*4],pr0
-       mova    (pr1)[pr2*4],pr1
-       mnegw   pr2,pr2
-       movw    $0,tr3
-
-Loop:  movw    (pr1)[pr2*4],tr1
-       uemul   pr3,tr0
-       addw    tr3,tr1
-       movw    $0,tr3
-       addwc   tr0,tr3
-       movw    (pr0)[pr2*0x4],tr0
-       addw    tr0,tr1
-       addwc   $0,tr3
-       movw    tr1,(pr0)[pr2*4]
-       addw    $1,pr2
-       bne     Loop
-
-       movw    tr3,pr0
-       ret
diff --git a/mpn/pyr/mul_1.s b/mpn/pyr/mul_1.s
deleted file mode 100644 (file)
index 453727f..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# Pyramid __gmpn_mul_1 -- Multiply a limb vector with a limb and store
-# the result in a second limb vector.
-
-# Copyright 1995, 2000 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 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.
-
-# 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 Lesser General Public
-# License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-.text
-       .align  2
-.globl ___gmpn_mul_1
-___gmpn_mul_1:
-       mova    (pr0)[pr2*4],pr0
-       mova    (pr1)[pr2*4],pr1
-       mnegw   pr2,pr2
-       movw    $0,tr3
-
-Loop:  movw    (pr1)[pr2*4],tr1
-       uemul   pr3,tr0
-       addw    tr3,tr1
-       movw    $0,tr3
-       addwc   tr0,tr3
-       movw    tr1,(pr0)[pr2*4]
-       addw    $1,pr2
-       bne     Loop
-
-       movw    tr3,pr0
-       ret
diff --git a/mpn/pyr/sub_n.s b/mpn/pyr/sub_n.s
deleted file mode 100644 (file)
index 11f185a..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-# Pyramid __gmpn_sub_n -- Subtract two limb vectors of the same length > 0 and
-# store difference in a third limb vector.
-
-# Copyright 1995, 2000 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 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.
-
-# 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 Lesser General Public
-# License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-.text
-       .align  2
-.globl ___gmpn_sub_n
-___gmpn_sub_n:
-       movw    $-1,tr0         # representation for carry clear
-
-       movw    pr3,tr2
-       andw    $3,tr2
-       beq     Lend0
-       subw    tr2,pr3
-
-Loop0: rsubw   $0,tr0          # restore carry bit from carry-save register
-
-       movw    (pr1),tr1
-       subwb   (pr2),tr1
-       movw    tr1,(pr0)
-
-       subwb   tr0,tr0
-       addw    $4,pr0
-       addw    $4,pr1
-       addw    $4,pr2
-       addw    $-1,tr2
-       bne     Loop0
-
-       mtstw   pr3,pr3
-       beq     Lend
-Lend0:
-Loop:  rsubw   $0,tr0          # restore carry bit from carry-save register
-
-       movw    (pr1),tr1
-       subwb   (pr2),tr1
-       movw    tr1,(pr0)
-
-       movw    4(pr1),tr1
-       subwb   4(pr2),tr1
-       movw    tr1,4(pr0)
-
-       movw    8(pr1),tr1
-       subwb   8(pr2),tr1
-       movw    tr1,8(pr0)
-
-       movw    12(pr1),tr1
-       subwb   12(pr2),tr1
-       movw    tr1,12(pr0)
-
-       subwb   tr0,tr0
-       addw    $16,pr0
-       addw    $16,pr1
-       addw    $16,pr2
-       addw    $-4,pr3
-       bne     Loop
-Lend:
-       mnegw   tr0,pr0
-       ret
index 71d49bbfca3a313f089773f6253fe6ccef688df7..97189a8e765fa014f19a9d3c01865ee25b827071 100644 (file)
@@ -4,19 +4,30 @@ dnl  result to a second limb vector.
 dnl  Copyright 2001 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index dbfde3531aa9fbaa12488f50783cbb3a984ab264..ff252bc1a6e1ae2acb21f606e22b20b500e94040 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-32 mpn_copyd
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index f3f2399e1ff1d9e8f2a3df5d2a2e644cc1939ecf..1df32f100e5af28e68980cad7aa941733ebdccb4 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-32 mpn_copyi
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index b9a57ac928cc7620f4cb3803e0bba77d3ffa9a4c..4375b74ae0961db76c6216f0563c654a0d603d2c 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-32 mpn_addmul_1 for systems with MLR instruction
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -37,7 +48,7 @@ define(`z',   `%r9')
 ASM_START()
 PROLOGUE(mpn_addmul_1)
        stm     %r9, %r12, 36(%r15)
-       lhi     %r12, 0                 C zero index reister
+       lhi     %r12, 0                 C zero index register
        ahi     %r12, 0                 C clear carry fla
        lhi     %r11, 0                 C clear carry limb
        lhi     z, 0                    C clear carry limb
index 2e09ed44d20274826ab7a0a36349afb491248312..98b0dbc7b08dfb345488e24e775d050687751d62 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-32 mpn_add_n and mpn_sub_n.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index c152433a344a37a68739349e3ca8d6c233025dc8..f2b222b121d08822ff9b81814fdc115bbd651053 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-32 mpn_addlsh1_n
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index c4e28375932aba302e3e181f073e3aa77ffe47d6..568a2a44e8f6df2cea83f3188cb0c312a961bd84 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-32 mpn_bdiv_dbm1c for systems with MLR instruction.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index a6508be1af32ff2bb70c3ac9bd2c496fbae35d36..a805fa1492d3e122d4a20870ce02baa50344cb1b 100644 (file)
 /* S/390-32 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2008-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
-
-/* 1200 MHz IBM z990 running in 32-bit mode */
-
-#define DIVREM_1_NORM_THRESHOLD              0  /* always */
-#define DIVREM_1_UNNORM_THRESHOLD            4
-#define MOD_1_1P_METHOD                      2
-#define MOD_1_NORM_THRESHOLD                 0  /* always */
-#define MOD_1_UNNORM_THRESHOLD               3
-#define MOD_1N_TO_MOD_1_1_THRESHOLD         17
+#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 */
+
+#define DIVREM_1_NORM_THRESHOLD              3
+#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_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     42
+#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 DIV_QR_1N_PI1_METHOD                 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 DIVEXACT_1_THRESHOLD                 0  /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD           30
+#define BMOD_1_TO_MOD_1_THRESHOLD           56
 
-#define MUL_TOOM22_THRESHOLD                16
-#define MUL_TOOM33_THRESHOLD                57
-#define MUL_TOOM44_THRESHOLD               147
-#define MUL_TOOM6H_THRESHOLD               226
-#define MUL_TOOM8H_THRESHOLD               333
+#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 MUL_TOOM32_TO_TOOM43_THRESHOLD      65
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     100
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD      97
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD     102
+#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 SQR_BASECASE_THRESHOLD               0  /* always (native) */
-#define SQR_TOOM2_THRESHOLD                 26
-#define SQR_TOOM3_THRESHOLD                 81
-#define SQR_TOOM4_THRESHOLD                154
-#define SQR_TOOM6_THRESHOLD                318
-#define SQR_TOOM8_THRESHOLD                478
-
-#define MULMID_TOOM42_THRESHOLD             38
+#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 MULMOD_BNM1_THRESHOLD               13
-#define SQRMOD_BNM1_THRESHOLD               15
+#define MULMID_TOOM42_THRESHOLD             24
 
-#define POWM_SEC_TABLE  4,23,262,892,2500
+#define MULMOD_BNM1_THRESHOLD               12
+#define SQRMOD_BNM1_THRESHOLD               10
 
-#define MUL_FFT_MODF_THRESHOLD             336  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             252  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    336, 5}, {     19, 6}, {     11, 5}, {     23, 6}, \
-    {     17, 7}, {      9, 6}, {     21, 7}, {     11, 6}, \
-    {     24, 7}, {     13, 6}, {     27, 7}, {     15, 6}, \
-    {     31, 7}, {     27, 8}, {     15, 7}, {     33, 8}, \
-    {     19, 7}, {     39, 8}, {     23, 7}, {     47, 8}, \
-    {     27, 9}, {     15, 8}, {     31, 7}, {     63, 8}, \
-    {     39, 9}, {     23, 8}, {     51,10}, {     15, 9}, \
-    {     31, 8}, {     63, 9}, {     39, 8}, {     79, 9}, \
-    {     47,10}, {     31, 9}, {     79,10}, {     47,11}, \
-    {   2048,12}, {   4096,13}, {   8192,14}, {  16384,15}, \
+  { {    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}, \
     {  32768,16} }
-#define MUL_FFT_TABLE3_SIZE 41
-#define MUL_FFT_THRESHOLD                 2752
+#define MUL_FFT_TABLE3_SIZE 149
+#define MUL_FFT_THRESHOLD                 2240
 
-#define SQR_FFT_MODF_THRESHOLD             308  /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD             244  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    308, 5}, {     20, 6}, {     11, 5}, {     23, 6}, \
-    {     21, 7}, {     11, 6}, {     24, 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}, {     47,10}, {     31, 9}, \
-    {     79,10}, {     47,11}, {   2048,12}, {   4096,13}, \
-    {   8192,14}, {  16384,15}, {  32768,16} }
-#define SQR_FFT_TABLE3_SIZE 35
-#define SQR_FFT_THRESHOLD                 2368
-
-#define MULLO_BASECASE_THRESHOLD             5
-#define MULLO_DC_THRESHOLD                  49
-#define MULLO_MUL_N_THRESHOLD             5397
-
-#define DC_DIV_QR_THRESHOLD                 42
-#define DC_DIVAPPR_Q_THRESHOLD             146
-#define DC_BDIV_QR_THRESHOLD                51
-#define DC_BDIV_Q_THRESHOLD                124
-
-#define INV_MULMOD_BNM1_THRESHOLD           46
-#define INV_NEWTON_THRESHOLD               179
-#define INV_APPR_THRESHOLD                 153
-
-#define BINV_NEWTON_THRESHOLD              214
-#define REDC_1_TO_REDC_N_THRESHOLD          55
-
-#define MU_DIV_QR_THRESHOLD               1078
-#define MU_DIVAPPR_Q_THRESHOLD            1078
-#define MUPI_DIV_QR_THRESHOLD               74
-#define MU_BDIV_QR_THRESHOLD               872
-#define MU_BDIV_Q_THRESHOLD               1078
-
-#define MATRIX22_STRASSEN_THRESHOLD         14
-#define HGCD_THRESHOLD                      90
-#define HGCD_APPR_THRESHOLD                111
-#define HGCD_REDUCE_THRESHOLD             1962
-#define GCD_DC_THRESHOLD                   225
-#define GCDEXT_DC_THRESHOLD                217
-#define JACOBI_BASE_METHOD                   2
-
-#define GET_STR_DC_THRESHOLD                13
-#define GET_STR_PRECOMPUTE_THRESHOLD        27
-#define SET_STR_DC_THRESHOLD               274
-#define SET_STR_PRECOMPUTE_THRESHOLD       824
+  { {    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}, \
+    {    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
+
+#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 FAC_ODD_THRESHOLD                   24
index 91e5d3b42b7e2d25058bb00ea581239499667c22..04be96365182fc4250ad892a27c70377b1f9b41d 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-32 mpn_mul_1 for systems with MLR instruction
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index c8ef70ade48a29a8fde69a0c90ed485d81c7baee..2c8138d8d2826692d96ffb8ec8cb8d39c02516c4 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-32/esame mpn_mul_basecase.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 01a81b1b5b277850996a40d5aaa5fcd471eb978b..dcc13112bf3b28a95abcb7e4afeede02bef01dcd 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-32 mpn_sqr_basecase.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 3fd6d5677a1dce98770679b0d63b4b49a453ddc1..a71e57e2307d8614d613cb8c629299cb7019c408 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-32 mpn_submul_1 for systems with MLR instruction.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 795ae9e4b996e020bd8a68c8f4c23163cbd6491e..1aca74a8188b0f863b1787fe5a4f55327e56649c 100644 (file)
@@ -1,25 +1,35 @@
 /* S/390-32 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 /* 770 MHz IBM z900 running in 32-bit mode, using just traditional insns */
 
index 61472acf2cb4cf1c23874ac529c1ede44c651a07..1f2cd2a8f6384bf51f6325c2eae82ef2d9f901de 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-32 logops.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 17e52655f7648fced9ffe5b4a3c3f7d0540ffbd1..da7d76e844aff7a76ba857990119c3b855901ed2 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-32 mpn_lshift.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 9bdd0d79815e0747b68f1573956ca758ef6fc27e..f6016732494a607c2663e6fa5230edaa290efa6c 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-32 mpn_lshiftc.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 649671b45c4c4d9c4ebf653f2b7d2ca5f1bdb443..e3ad0c59d8ce364aad70ef7ccec8cb456db64ee1 100644 (file)
@@ -4,19 +4,30 @@ dnl  result in a second limb vector.
 dnl  Copyright 2001 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index becbe1893dca045a7e16f9f59d7588384c2c0d1e..5f2cf37ca0a6928bbbfd1f4c18c721697d66381b 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-32 mpn_rshift.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 5301096da2efd398ab28b5d6af91a79d73389497..da7d849d5d379bba4e82816d54d0dc571292d1ba 100644 (file)
@@ -4,19 +4,30 @@ dnl  result from a second limb vector.
 dnl  Copyright 2001 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 82b68a08061b70821d585cc14f7fae230be0af3b..8f482a9cd296500e844a525ff1a2bbea4d38838a 100644 (file)
@@ -3,17 +3,28 @@ Copyright 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
@@ -69,7 +80,7 @@ mpn_mul_2, mpn_addmul_2
 
 At least for older machines (z900, z990) with very slow MLGR, we
 should use Karatsuba's algorithm on 2-limb units, making mul_2 and
-addmul_2 the main multiplicaton primitives.  The newer machines might
+addmul_2 the main multiplication primitives.  The newer machines might
 benefit less from this approach, perhaps in particular z10, where MLGR
 clustering is more important.
 
index ad4c74c8236485500ea63be1dca234d6b66cd5b6..84cca123613637b57c9872c214b7bd1a5cf110d5 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-64 mpn_addmul_1
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -23,7 +34,7 @@ C            cycles/limb
 C z900         34
 C z990         23
 C z9            ?
-C z10           ?
+C z10          28
 C z196          ?
 
 C INPUT PARAMETERS
index 3bd9b11341219f18cbf5e47a244c60634f4d3b8c..697259efefbbe1c027804659e647798f16d2b70f 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-64 mpn_addlsh1_n and mpn_rsblsh1_n.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -23,7 +34,7 @@ C            cycles/limb
 C z900          9
 C z990          4.75
 C z9            ?
-C z10           ?
+C z10          11
 C z196          ?
 
 C TODO
index 6d22ff9ea3ca28b2481f84927e74479d8d0d5768..a3c3ca791c2345f5831a7dbc9e0f8e13b126cc1f 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-64 mpn_add_n and mpn_sub_n.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -23,7 +34,7 @@ C            cycles/limb
 C z900          5.5
 C z990          3
 C z9            ?
-C z10           ?
+C z10           6
 C z196          ?
 
 C TODO
index 21b0a0db036a0e12c540cfc9cdf20e241ba0fe5a..35e900a27975a95caceb749b272c7006ff16326b 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-64 mpn_bdiv_dbm1c
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -23,7 +34,7 @@ C            cycles/limb
 C z900         29
 C z990         22
 C z9            ?
-C z10           ?
+C z10          19
 C z196          ?
 
 C INPUT PARAMETERS
index 4873a44adc2519e084c7cb6d8f7e744407e45f74..8631e19f00850145a2842f7bdd046a16be35741d 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-64 mpn_copyd
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
@@ -24,7 +35,7 @@ C            cycles/limb
 C z900          2.67
 C z990           1.5
 C z9            ?
-C z10           ?
+C z10           1.8
 C z196          ?
 
 C FIXME:
index a566968cd3ae41c8e0e4b3bc1e1e69e9287d278f..bfb88814eaac1ebc8693ca455dae35bb3835750f 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-64 mpn_copyi
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
@@ -24,7 +35,7 @@ C            cycles/limb
 C z900          1.25
 C z990           0.75
 C z9            ?
-C z10           ?
+C z10           1
 C z196          ?
 
 C NOTE
index c0ade71c270b8fdbf3037de1cf82e6c61221fbd5..dacd9966a4be215414f85f08d77972f0fd4cc821 100644 (file)
@@ -1,25 +1,35 @@
 /* S/390-64 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 /* 1200 MHz z990 */
 
@@ -28,140 +38,138 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #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          8
-#define MOD_1U_TO_MOD_1_1_THRESHOLD          5
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD        38
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD         0
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD     19
+#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 DIV_QR_1N_PI1_METHOD                 1
+#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 */
-#define BMOD_1_TO_MOD_1_THRESHOLD           88
+#define BMOD_1_TO_MOD_1_THRESHOLD           98
 
 #define MUL_TOOM22_THRESHOLD                10
 #define MUL_TOOM33_THRESHOLD                41
-#define MUL_TOOM44_THRESHOLD               104
+#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      73
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD      66
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD      72
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD      64
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD      55
 
-#define SQR_BASECASE_THRESHOLD               0
+#define SQR_BASECASE_THRESHOLD               0  /* always (native) */
 #define SQR_TOOM2_THRESHOLD                 16
 #define SQR_TOOM3_THRESHOLD                 57
-#define SQR_TOOM4_THRESHOLD                154
-#define SQR_TOOM6_THRESHOLD                206
+#define SQR_TOOM4_THRESHOLD                153
+#define SQR_TOOM6_THRESHOLD                204
 #define SQR_TOOM8_THRESHOLD                309
 
 #define MULMID_TOOM42_THRESHOLD             20
 
-#define MULMOD_BNM1_THRESHOLD                9
+#define MULMOD_BNM1_THRESHOLD               10
 #define SQRMOD_BNM1_THRESHOLD               11
 
-#define POWM_SEC_TABLE  4,23,128,598
-
 #define MUL_FFT_MODF_THRESHOLD             220  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    220, 5}, {      7, 4}, {     15, 5}, {      8, 4}, \
-    {     17, 5}, {     11, 6}, {      6, 5}, {     13, 6}, \
+  { {    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}, {     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,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,11}, {     79,10}, \
-    {    159, 9}, {    319,10}, {    175, 9}, {    351, 8}, \
-    {    703,11}, {     95,10}, {    191, 9}, {    383,10}, \
+    {      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, 9}, {    831,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, 9}, {   1407, 8}, \
-    {   2815,11}, {    383,10}, {    767,11}, {    415,10}, \
-    {    831,12}, {    223,11}, {    447, 9}, {   1791,11}, \
-    {    479,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 124
-#define MUL_FFT_THRESHOLD                 2240
-
-#define SQR_FFT_MODF_THRESHOLD             184  /* k = 5 */
+    {    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                                      \
-  { {    184, 5}, {      6, 4}, {     13, 5}, {     13, 6}, \
+  { {    212, 5}, {      7, 4}, {     15, 5}, {     13, 6}, \
     {      7, 5}, {     15, 6}, {     15, 7}, {      8, 6}, \
-    {     17, 7}, {     16, 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}, {     23,10}, {     15, 9}, \
+    {     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,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, 7}, {    575,10}, {     79,11}, {     47,12}, \
-    {     31,11}, {     63,10}, {    127, 9}, {    255,10}, \
+    {    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, 8}, {    639,10}, {    175, 9}, {    351,11}, \
-    {     95,10}, {    191, 9}, {    383, 8}, {    767,11}, \
-    {    111,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,12}, {     95,11}, {    191,10}, \
-    {    383, 9}, {    767,11}, {    207,10}, {    415, 9}, \
-    {    831,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}, {    383,10}, {    767,11}, \
-    {    415,12}, {    223,11}, {    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 106
+    {    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             3
+#define MULLO_BASECASE_THRESHOLD             2
 #define MULLO_DC_THRESHOLD                  33
-#define MULLO_MUL_N_THRESHOLD             5240
+#define MULLO_MUL_N_THRESHOLD             3176
 
 #define DC_DIV_QR_THRESHOLD                 28
-#define DC_DIVAPPR_Q_THRESHOLD             106
+#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               130
+#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                680
+#define MU_DIV_QR_THRESHOLD                748
 #define MU_DIVAPPR_Q_THRESHOLD             748
-#define MUPI_DIV_QR_THRESHOLD               66
+#define MUPI_DIV_QR_THRESHOLD               65
 #define MU_BDIV_QR_THRESHOLD               562
-#define MU_BDIV_Q_THRESHOLD                680
+#define MU_BDIV_Q_THRESHOLD                734
+
+#define POWM_SEC_TABLE  4,23,274,961,2783
 
 #define MATRIX22_STRASSEN_THRESHOLD         11
-#define HGCD_THRESHOLD                      75
-#define HGCD_APPR_THRESHOLD                 59
-#define HGCD_REDUCE_THRESHOLD              901
-#define GCD_DC_THRESHOLD                   186
-#define GCDEXT_DC_THRESHOLD                150
-#define JACOBI_BASE_METHOD                   3
-
-#define GET_STR_DC_THRESHOLD                27
-#define GET_STR_PRECOMPUTE_THRESHOLD        40
-#define SET_STR_DC_THRESHOLD               418
-#define SET_STR_PRECOMPUTE_THRESHOLD      1111
+#define HGCD_THRESHOLD                      79
+#define HGCD_APPR_THRESHOLD                 70
+#define HGCD_REDUCE_THRESHOLD             1094
+#define GCD_DC_THRESHOLD                   183
+#define GCDEXT_DC_THRESHOLD                148
+#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 */
index 4d858d1c58c25c2f205b6080afe3e1d68d23f8ab..edcebddf1c03f80df87e1b73aa61747b9b0fd5e7 100644 (file)
@@ -2,22 +2,33 @@ dnl  S/390-64 mpn_invert_limb
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2011 Free Software Foundation, Inc.
+dnl  Copyright 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -25,7 +36,7 @@ C            cycles/limb
 C z900        142
 C z990          86
 C z9            ?
-C z10           ?
+C z10         120
 C z196          ?
 
 ASM_START()
@@ -77,36 +88,7 @@ EPILOGUE()
        RODATA
        ALIGN(2)
 approx_tab:
-       .word   0x7fd,0x7f5,0x7ed,0x7e5,0x7dd,0x7d5,0x7ce,0x7c6
-       .word   0x7bf,0x7b7,0x7b0,0x7a8,0x7a1,0x79a,0x792,0x78b
-       .word   0x784,0x77d,0x776,0x76f,0x768,0x761,0x75b,0x754
-       .word   0x74d,0x747,0x740,0x739,0x733,0x72c,0x726,0x720
-       .word   0x719,0x713,0x70d,0x707,0x700,0x6fa,0x6f4,0x6ee
-       .word   0x6e8,0x6e2,0x6dc,0x6d6,0x6d1,0x6cb,0x6c5,0x6bf
-       .word   0x6ba,0x6b4,0x6ae,0x6a9,0x6a3,0x69e,0x698,0x693
-       .word   0x68d,0x688,0x683,0x67d,0x678,0x673,0x66e,0x669
-       .word   0x664,0x65e,0x659,0x654,0x64f,0x64a,0x645,0x640
-       .word   0x63c,0x637,0x632,0x62d,0x628,0x624,0x61f,0x61a
-       .word   0x616,0x611,0x60c,0x608,0x603,0x5ff,0x5fa,0x5f6
-       .word   0x5f1,0x5ed,0x5e9,0x5e4,0x5e0,0x5dc,0x5d7,0x5d3
-       .word   0x5cf,0x5cb,0x5c6,0x5c2,0x5be,0x5ba,0x5b6,0x5b2
-       .word   0x5ae,0x5aa,0x5a6,0x5a2,0x59e,0x59a,0x596,0x592
-       .word   0x58e,0x58a,0x586,0x583,0x57f,0x57b,0x577,0x574
-       .word   0x570,0x56c,0x568,0x565,0x561,0x55e,0x55a,0x556
-       .word   0x553,0x54f,0x54c,0x548,0x545,0x541,0x53e,0x53a
-       .word   0x537,0x534,0x530,0x52d,0x52a,0x526,0x523,0x520
-       .word   0x51c,0x519,0x516,0x513,0x50f,0x50c,0x509,0x506
-       .word   0x503,0x500,0x4fc,0x4f9,0x4f6,0x4f3,0x4f0,0x4ed
-       .word   0x4ea,0x4e7,0x4e4,0x4e1,0x4de,0x4db,0x4d8,0x4d5
-       .word   0x4d2,0x4cf,0x4cc,0x4ca,0x4c7,0x4c4,0x4c1,0x4be
-       .word   0x4bb,0x4b9,0x4b6,0x4b3,0x4b0,0x4ad,0x4ab,0x4a8
-       .word   0x4a5,0x4a3,0x4a0,0x49d,0x49b,0x498,0x495,0x493
-       .word   0x490,0x48d,0x48b,0x488,0x486,0x483,0x481,0x47e
-       .word   0x47c,0x479,0x477,0x474,0x472,0x46f,0x46d,0x46a
-       .word   0x468,0x465,0x463,0x461,0x45e,0x45c,0x459,0x457
-       .word   0x455,0x452,0x450,0x44e,0x44b,0x449,0x447,0x444
-       .word   0x442,0x440,0x43e,0x43b,0x439,0x437,0x435,0x432
-       .word   0x430,0x42e,0x42c,0x42a,0x428,0x425,0x423,0x421
-       .word   0x41f,0x41d,0x41b,0x419,0x417,0x414,0x412,0x410
-       .word   0x40e,0x40c,0x40a,0x408,0x406,0x404,0x402,0x400
+forloop(i,256,512-1,dnl
+`      .word   eval(0x7fd00/i)
+')dnl
 ASM_END()
index ae1a1abab9b4656b4b6036122d061d3e6ddb00d5..914cfb6a41503e709bfd82b70ba86508b783451d 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-64 logops.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -24,7 +35,7 @@ C             rp!=up  rp=up
 C z900          4.5     2.25            5.5             5.5
 C z990          2.75    2               3.25            3.25
 C z9            ?                       ?               ?
-C z10           ?                       ?               ?
+C z10           3.25                    3.75            3.75
 C z196          ?                       ?               ?
 
 C INPUT PARAMETERS
index 210a964f2e39c3117990e32041a340667eb8972e..4dae035a62fae333a49510fb44ee3dbdaee365d5 100644 (file)
@@ -1,21 +1,32 @@
 dnl  S/390-64 mpn_lshift.
 
-dnl  Copyright 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2011, 2012, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -23,7 +34,7 @@ C            cycles/limb
 C z900          7
 C z990           3
 C z9            ?
-C z10           ?
+C z10           6
 C z196          ?
 
 C NOTES
@@ -143,7 +154,7 @@ L(b0):      lg      %r8, 48(up)
        la      up, 24(up)
        j       L(lm0)
 
-C      ALIGN(16)
+       ALIGN(8)
 L(top):        srlg    %r4, %r8, 0(tnc)
        sllg    %r13, %r8, 0(cnt)
        ogr     %r11, %r4
index 1fbc7fcbdfa119f00fa18959fd1a84882eaddbee..92552d529a31942117379f22289f1ad987abb9dc 100644 (file)
@@ -1,21 +1,32 @@
 dnl  S/390-64 mpn_lshiftc.
 
-dnl  Copyright 2011 Free Software Foundation, Inc.
+dnl  Copyright 2011, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -23,7 +34,7 @@ C            cycles/limb
 C z900          9
 C z990           3.5
 C z9            ?
-C z10           ?
+C z10           7
 C z196          ?
 
 C NOTES
@@ -146,7 +157,7 @@ L(b0):      lg      %r8, 48(up)
        la      up, 24(up)
        j       L(lm0)
 
-C      ALIGN(16)
+       ALIGN(8)
 L(top):        srlg    %r4, %r8, 0(tnc)
        sllg    %r13, %r8, 0(cnt)
        ogr     %r11, %r4
index b95c30045059c9a1e3ca9ba7a092e5b6cdab1038..fd40011a8c7ce5b1688f1d15a4d9fde6a9cae00b 100644 (file)
@@ -1,21 +1,32 @@
-dnl  S/390-64 mpn_addmul_1
+dnl  S/390-64 mpn_mod_34lsub1
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -23,7 +34,7 @@ C            cycles/limb
 C z900          5.8
 C z990           2
 C z9            ?
-C z10           ?
+C z10           4.5
 C z196          ?
 
 C TODO
index 03df8cb0b84fbc3969f5e982745dd0119fd4d00b..a8f6da9a0fb6687228876d46d5f268520530b3ec 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-64 mpn_mul_1
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -23,7 +34,7 @@ C            cycles/limb
 C z900         29
 C z990         22
 C z9            ?
-C z10           ?
+C z10          20
 C z196          ?
 
 C INPUT PARAMETERS
index cd7a3ee2bffbc8a9cdfbd75a5b332c5b59295813..7d14ea98d262bc9e011615b0fbf319e83096b51c 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-64 mpn_mul_basecase.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -23,7 +34,7 @@ C            cycles/limb
 C z900          ?
 C z990         23
 C z9            ?
-C z10           ?
+C z10          28
 C z196          ?
 
 C TODO
index 736c485a26ceb126f3a8aa1a6984f2159bb28192..e870971650c139eef764e0f7e12a02135802c9a3 100644 (file)
@@ -1,21 +1,32 @@
 dnl  S/390-64 mpn_rshift.
 
-dnl  Copyright 2011 Free Software Foundation, Inc.
+dnl  Copyright 2011, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -23,7 +34,7 @@ C            cycles/limb
 C z900          7
 C z990           3
 C z9            ?
-C z10           ?
+C z10           6
 C z196          ?
 
 C NOTES
@@ -142,7 +153,7 @@ L(b0):      aghi    rp, -32
        srlg    %r10, %r8, 0(cnt)
        j       L(lm0)
 
-C      ALIGN(16)
+       ALIGN(8)
 L(top):        sllg    %r4, %r8, 0(tnc)
        srlg    %r13, %r8, 0(cnt)
        ogr     %r11, %r4
index 7df0ab153961048f207b94e3a05a2f06e63546e5..bf31bd5546856d77d782aa7a2793c71712671de7 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-64 mpn_sqr_basecase.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -23,7 +34,7 @@ C            cycles/limb
 C z900          ?
 C z990         23
 C z9            ?
-C z10           ?
+C z10          28
 C z196          ?
 
 C TODO
index d33d9bfe549e06f0c279b3d2dc3693e66d1f8722..50f127acef9b1e21e29f8c4ef5e877a40da0b906 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-64 mpn_sublsh1_n
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -23,7 +34,7 @@ C            cycles/limb
 C z900         10
 C z990          5
 C z9            ?
-C z10           ?
+C z10          12
 C z196          ?
 
 C TODO
index b78f26623bf134f1abe4d1927955ee426269eee5..91c4b06631be3c1f0e0d6c687bbfd6721ce37483 100644 (file)
@@ -3,19 +3,30 @@ dnl  S/390-64 mpn_submul_1
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -23,7 +34,7 @@ C            cycles/limb
 C z900         35
 C z990         24
 C z9            ?
-C z10           ?
+C z10          28
 C z196          ?
 
 C INPUT PARAMETERS
diff --git a/mpn/s390_64/z10/gmp-mparam.h b/mpn/s390_64/z10/gmp-mparam.h
new file mode 100644 (file)
index 0000000..c034f9b
--- /dev/null
@@ -0,0 +1,231 @@
+/* S/390-64 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 64
+#define GMP_LIMB_BYTES 8
+
+/* 4400 MHz IBM z10 */
+/* FFT tuning limit = 15000000 */
+/* Generated by tuneup.c, 2014-03-12, gcc 4.7 */
+
+#define DIVREM_1_NORM_THRESHOLD              0  /* always */
+#define DIVREM_1_UNNORM_THRESHOLD            4
+#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          7
+#define MOD_1U_TO_MOD_1_1_THRESHOLD          8
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD        14
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD        23
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD     29
+#define USE_PREINV_DIVREM_1                  1
+#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 */
+#define BMOD_1_TO_MOD_1_THRESHOLD           56
+
+#define MUL_TOOM22_THRESHOLD                 8
+#define MUL_TOOM33_THRESHOLD                65
+#define MUL_TOOM44_THRESHOLD                88
+#define MUL_TOOM6H_THRESHOLD               125
+#define MUL_TOOM8H_THRESHOLD               163
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD      58
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD      61
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD      57
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD      62
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD      82
+
+#define SQR_BASECASE_THRESHOLD               0  /* always (native) */
+#define SQR_TOOM2_THRESHOLD                 12
+#define SQR_TOOM3_THRESHOLD                 89
+#define SQR_TOOM4_THRESHOLD                130
+#define SQR_TOOM6_THRESHOLD                189
+#define SQR_TOOM8_THRESHOLD                260
+
+#define MULMID_TOOM42_THRESHOLD             24
+
+#define MULMOD_BNM1_THRESHOLD                9
+#define SQRMOD_BNM1_THRESHOLD                9
+
+#define MUL_FFT_MODF_THRESHOLD             220  /* k = 5 */
+#define MUL_FFT_TABLE3                                      \
+  { {    220, 5}, {      7, 4}, {     15, 5}, {      9, 6}, \
+    {      5, 5}, {     11, 6}, {      6, 5}, {     13, 6}, \
+    {     11, 7}, {      6, 6}, {     13, 7}, {      7, 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}, {     23,10}, {      7, 9}, \
+    {     15, 8}, {     33, 9}, {     19, 8}, {     39, 9}, \
+    {     27,10}, {     15, 9}, {     39,10}, {     23,11}, \
+    {     15,10}, {     31, 9}, {     67,10}, {     39, 9}, \
+    {     83,10}, {     47,11}, {     31,10}, {     63, 9}, \
+    {    127, 8}, {    255, 7}, {    511,10}, {     71, 9}, \
+    {    143, 8}, {    287, 7}, {    575,10}, {     79,11}, \
+    {     47,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, 7}, \
+    {   1407, 6}, {   2815,10}, {    191, 9}, {    383, 8}, \
+    {    767, 9}, {    415,11}, {    111,10}, {    223, 9}, \
+    {    447, 8}, {    895,12}, {     63,11}, {    127,10}, \
+    {    255, 9}, {    511,11}, {    143,10}, {    287, 9}, \
+    {    575, 8}, {   1151,10}, {    319, 9}, {    639,11}, \
+    {    175, 9}, {    703, 8}, {   1407, 7}, {   2815,11}, \
+    {    191,10}, {    415, 9}, {    831,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, 9}, \
+    {   1407, 8}, {   2815,12}, {    191,11}, {    383,10}, \
+    {    767,11}, {    415,10}, {    831,12}, {    223,10}, \
+    {    895, 9}, {   1791,11}, {    479,13}, {    127,12}, \
+    {    255,11}, {    511,10}, {   1023,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, 9}, {   3583,12}, {    479,14}, {    127,13}, \
+    {    255,12}, {    511,11}, {   1023,12}, {    575,11}, \
+    {   1151,13}, {    319,12}, {    703,11}, {   1407,10}, \
+    {   2815,13}, {    383,12}, {    767,11}, {   1535,12}, \
+    {    831,11}, {   1663,13}, {    447,12}, {    895,11}, \
+    {   1791,10}, {   3583,14}, {    255,13}, {    511,12}, \
+    {   1023,13}, {    575,12}, {   1151,13}, {    639,12}, \
+    {   1279,13}, {    703,12}, {   1407,11}, {   2815,14}, \
+    {    383,13}, {    767,12}, {   1535,13}, {    831,12}, \
+    {   1663,13}, {    895,12}, {   1791,11}, {   3583,15}, \
+    {    255,14}, {    511,13}, {   1151,14}, {    639,13}, \
+    {   1279,12}, {   2559,13}, {   1407,12}, {   2815,13}, \
+    {   1471,14}, {    767,13}, {   1663,14}, {    895,13}, \
+    {   1791,12}, {   3583,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 205
+#define MUL_FFT_THRESHOLD                 1728
+
+#define SQR_FFT_MODF_THRESHOLD             212  /* k = 5 */
+#define SQR_FFT_TABLE3                                      \
+  { {    212, 5}, {      7, 4}, {     15, 5}, {     11, 6}, \
+    {      6, 5}, {     13, 6}, {      7, 5}, {     15, 6}, \
+    {     13, 7}, {      7, 6}, {     15, 7}, {     13, 8}, \
+    {      7, 7}, {     16, 8}, {      9, 7}, {     19, 8}, \
+    {     11, 7}, {     23, 8}, {     13, 9}, {      7, 8}, \
+    {     19, 9}, {     11, 8}, {     23,10}, {      7, 9}, \
+    {     15, 8}, {     31, 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, 7}, {    575,10}, {     79,11}, {     47,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,11}, {    111,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, 9}, {    767,11}, {    207,10}, {    415,13}, \
+    {     63,12}, {    127,11}, {    255,10}, {    511,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,12}, {    223,11}, {    447,10}, {    895, 9}, \
+    {   1791,13}, {    127,12}, {    255,11}, {    511,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,10}, \
+    {   1791, 9}, {   3583,12}, {    479,11}, {    959,10}, \
+    {   1919,14}, {    127,13}, {    255,12}, {    511,11}, \
+    {   1023,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,11}, \
+    {   1791,12}, {    959,11}, {   1919,14}, {    255,13}, \
+    {    511,12}, {   1023,13}, {    575,12}, {   1151,13}, \
+    {    639,12}, {   1279,13}, {    703,12}, {   1407,11}, \
+    {   2815,14}, {    383,13}, {    767,12}, {   1535,13}, \
+    {    831,12}, {   1663,13}, {    895,12}, {   1791,11}, \
+    {   3583,13}, {    959,12}, {   1919,15}, {    255,14}, \
+    {    511,13}, {   1023,12}, {   2047,13}, {   1151,14}, \
+    {    639,13}, {   1279,12}, {   2559,13}, {   1407,12}, \
+    {   2815,14}, {    767,13}, {   1663,14}, {    895,13}, \
+    {   1791,12}, {   3583,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 201
+#define SQR_FFT_THRESHOLD                 1728
+
+#define MULLO_BASECASE_THRESHOLD             0  /* always */
+#define MULLO_DC_THRESHOLD                  34
+#define MULLO_MUL_N_THRESHOLD             3176
+
+#define DC_DIV_QR_THRESHOLD                 39
+#define DC_DIVAPPR_Q_THRESHOLD             151
+#define DC_BDIV_QR_THRESHOLD                44
+#define DC_BDIV_Q_THRESHOLD                107
+
+#define INV_MULMOD_BNM1_THRESHOLD           14
+#define INV_NEWTON_THRESHOLD               163
+#define INV_APPR_THRESHOLD                 154
+
+#define BINV_NEWTON_THRESHOLD              171
+#define REDC_1_TO_REDC_N_THRESHOLD          46
+
+#define MU_DIV_QR_THRESHOLD                792
+#define MU_DIVAPPR_Q_THRESHOLD             807
+#define MUPI_DIV_QR_THRESHOLD               81
+#define MU_BDIV_QR_THRESHOLD               654
+#define MU_BDIV_Q_THRESHOLD                792
+
+#define POWM_SEC_TABLE  3,19,194,946,2424
+
+#define MATRIX22_STRASSEN_THRESHOLD         17
+#define HGCD_THRESHOLD                     117
+#define HGCD_APPR_THRESHOLD                145
+#define HGCD_REDUCE_THRESHOLD             1329
+#define GCD_DC_THRESHOLD                   318
+#define GCDEXT_DC_THRESHOLD                265
+#define JACOBI_BASE_METHOD                   4
+
+#define GET_STR_DC_THRESHOLD                17
+#define GET_STR_PRECOMPUTE_THRESHOLD        35
+#define SET_STR_DC_THRESHOLD              1015
+#define SET_STR_PRECOMPUTE_THRESHOLD      2047
+
+#define FAC_DSC_THRESHOLD                  330
+#define FAC_ODD_THRESHOLD                   23
index a838451f1be11deb9e6f009c122f1843c4d5a7e2..79d17d01299baee9c37717fb1f8d5bc9919066a3 100644 (file)
@@ -4,19 +4,30 @@ dnl  in a third limb vector.
 dnl  Copyright 1995, 1997, 2000, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index a4f922a445041052031e926c2c2f97daf542867f..c914b29541e53d7fe0afce2e71526dc7b2de0232 100644 (file)
@@ -4,19 +4,30 @@ dnl  to a second limb vector.
 dnl  Copyright 1995, 2000, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 02f341fb594a7a46fdd281fe25d8e015141cf34b..83548a6953bc4ef853fcbbcc1de2d86b627e6fa5 100644 (file)
@@ -4,19 +4,30 @@ dnl  in a second limb vector.
 dnl  Copyright 1995, 2000, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index c701eba241dc8a537fde178f864ea673e4f2c820..bef2abd9b2533bcccbbf2af898e57d9bbb6f8796 100644 (file)
@@ -4,19 +4,30 @@ dnl  result from a second limb vector.
 dnl  Copyright 1995, 2000, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 493f1a51bd2f49ce1692bbee100306a831e7d173..465bc806fa9581d32743af220303846a137df704 100644 (file)
@@ -4,19 +4,30 @@ dnl  difference in a third limb vector.
 dnl  Copyright 1995, 1997, 2000, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 825a1ace8ee678bf7ca52efed91998ff133d42a7..f2dd1160f79b05400479072a02178fd5e694874a 100644 (file)
@@ -3,17 +3,28 @@ Copyright 1996, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index 7c8a9c41e817b15c5fb17eb5f6fa26d3d7de1fb4..8549195d92c2b9fd345db028b91c711b1c4814d1 100644 (file)
@@ -4,19 +4,30 @@ dnl  sum in a third limb vector.
 dnl  Copyright 1995, 1996, 2000 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index d73529e304c150a9e8da134c7a2837756a8b3ff1..92d5d78d511156398f35af2de071212e507850e0 100644 (file)
@@ -1,22 +1,33 @@
 dnl  SPARC mpn_addmul_1 -- Multiply a limb vector with a limb and add the
 dnl  result to a second limb vector.
 
-dnl  Copyright 1992, 1993, 1994, 2000 Free Software Foundation, Inc.
+dnl  Copyright 1992-1994, 2000 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 55432ea01a7bae139f42bb770cf7c6e514e7931d..a3bc61254303ea6daff486f0a11cf049a8008edb 100644 (file)
@@ -1,22 +1,32 @@
 /* SPARC v7 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* Generated by tuneup.c, 2002-03-13, gcc 2.95, Weitek 8701 */
 
index 00004f87a79baf643bc08a996d3b438266d23d24..8321343d6bb73531edc1dd7d919320a25e14a7e0 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC mpn_lshift -- Shift a number left.
 dnl  Copyright 1995, 1996, 2000 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 147db11157f265499a1bda0955267c61f6ea06b3..42b4168be1454e8d165b8fc98e3e2b7cdaacf6e2 100644 (file)
@@ -1,22 +1,33 @@
 dnl  SPARC mpn_mul_1 -- Multiply a limb vector with a limb and store
 dnl  the result in a second limb vector.
 
-dnl  Copyright 1992, 1993, 1994, 2000 Free Software Foundation, Inc.
+dnl  Copyright 1992-1994, 2000 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 26db4419d8d4e8b099a5e9e10ae4e7164ea248db..e1554766fe1dc015ce96eb7af9617d2d533e03b9 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC mpn_rshift -- Shift a number right.
 dnl  Copyright 1995, 1996, 2000 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 36d73018b3587e0cd1f0c9d1d763a84cef2aca29..5a0d425204774318078a2054e0f7cb96a4337a05 100644 (file)
@@ -3,22 +3,33 @@ divert(-1)
 dnl  m4 macros for SPARC assembler (32 and 64 bit).
 
 
-dnl  Copyright 2002, 2011 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2002, 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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  The GNU MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+dnl  or both in parallel, as here.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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/.
 
 
 changecom(;)   dnl cannot use default # since that's used in REGISTER decls
@@ -36,4 +47,33 @@ m4_assert_defined(`HAVE_REGISTER')
 `.register `$1',`$2'')')
 
 
+C Testing mechanism for running newer code on older processors
+ifdef(`FAKE_T3',`
+  include_mpn(`sparc64/ultrasparct3/missing.m4')
+',`
+  define(`addxccc',    ``addxccc'      $1, $2, $3')
+  define(`addxc',      ``addxc'        $1, $2, $3')
+  define(`umulxhi',    ``umulxhi'      $1, $2, $3')
+  define(`lzcnt',      ``lzd'  $1, $2')
+')
+
+dnl  Usage: LEA64(symbol,reg,pic_reg)
+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.
+
+define(LEA64,
+m4_assert_numargs(3)
+m4_assert_defined(`HAVE_GOTDATA')
+`ifdef(`PIC',`
+       rd      %pc, %`$2'
+       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'')')
+
 divert
index 4fc759dcbf6c415316bf11c11fe7ceebf14145b1..24a576d82b8a4543229756b41ed0fc89e721a2b4 100644 (file)
@@ -4,19 +4,30 @@ dnl  store difference in a third limb vector.
 dnl  Copyright 1995, 1996, 2000 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 9cde45fc3b2336b1ca28ee2b36141bc4d1405aa6..73f93770067f296dc21fff400f9d8f193d6b4726 100644 (file)
@@ -1,22 +1,33 @@
 dnl  SPARC mpn_submul_1 -- Multiply a limb vector with a limb and subtract
 dnl  the result from a second limb vector.
 
-dnl  Copyright 1992, 1993, 1994, 2000 Free Software Foundation, Inc.
+dnl  Copyright 1992-1994, 2000 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index fc520f67e2c29a8dcecae8a1d5389fa681c8e7a9..23ab3de1dbb7f7cc5a09e99266751038c190887e 100644 (file)
@@ -4,19 +4,30 @@ dnl  This is for v7 CPUs with a floating-point unit.
 dnl  Copyright 1993, 1994, 1996, 2000 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index a7513ead6c7643fe350af7cbac4de9cddf6a184f..ebbb820639e7f30a0335268f9b4bf5ece1965bc3 100644 (file)
@@ -4,19 +4,30 @@ dnl  This is for v7 CPUs without a floating-point unit.
 dnl  Copyright 1993, 1994, 1996, 2000 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 7fd21a6a7f1aa709fc207f1ef8600c19527c8860..c781596dadc13e346708002010e835067721ca55 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC T1 32-bit mpn_add_n.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 50017261c4cc984b67ee692e123a260994342f4e..89da1864577fff16bbf385d2be203b4513560b7f 100644 (file)
@@ -1,52 +1,90 @@
 dnl  SPARC T1 32-bit mpn_addmul_1.
 
-dnl  Copyright 2010 Free Software Foundation, Inc.
+dnl  Contributed to the GNU project by David Miller.
 
-dnl  This file is part of the GNU MP Library.
+dnl  Copyright 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C                 cycles/limb
-C UltraSPARC T1:       27
+C UltraSPARC T1:       24
+C UltraSPARC T2:       19
+C UltraSPARC T3:       19
+C UltraSPARC T4:       5
 
 C INPUT PARAMETERS
-define(`rp',   `%o0')
-define(`up',   `%o1')
-define(`n',    `%o2')
-define(`v0',   `%o3')
+define(`rp',   `%i0')
+define(`up',   `%i1')
+define(`n',    `%i2')
+define(`v0',   `%i3')
 
 ASM_START()
 PROLOGUE(mpn_addmul_1)
-       mov     0, %g4
-       srl     v0, 0, v0
-       srl     n, 0, n
-       dec     n                       C n--
-
-L(top):        lduw    [up+0], %g1
-       add     up, 4, up               C up++
-       mulx    %g1, v0, %g3
-       lduw    [rp+0], %g2
-       add     %g2, %g3, %g3
-       add     %g4, %g3, %g3
+       save    %sp, -96, %sp
+       srl     n, 0, %o4
+       srl     v0, 0, %g1
+       subcc   %o4, 1, %o4
+       be      L(final_one)
+        clr    %o5
+
+L(top):        lduw    [up+0], %l0
+       lduw    [rp+0], %l2
+       lduw    [up+4], %l1
+       lduw    [rp+4], %l3
+       mulx    %l0, %g1, %g3
+       add     up, 8, up
+       mulx    %l1, %g1, %o3
+       sub     %o4, 2, %o4
+       add     rp, 8, rp
+       add     %l2, %g3, %g3
+       add     %o5, %g3, %g3
+       stw     %g3, [rp-8]
+       srlx    %g3, 32, %o5
+       add     %l3, %o3, %o3
+       add     %o5, %o3, %o3
+       stw     %o3, [rp-4]
+       brgz    %o4, L(top)
+        srlx   %o3, 32, %o5
+
+       brlz,pt %o4, L(done)
+        nop
+
+L(final_one):
+       lduw    [up+0], %l0
+       lduw    [rp+0], %l2
+       mulx    %l0, %g1, %g3
+       add     %l2, %g3, %g3
+       add     %o5, %g3, %g3
        stw     %g3, [rp+0]
-       add     rp, 4, rp               C rp++
-       srlx    %g3, 32, %g4
-       brnz    n, L(top)
-       dec     n                       C n--
+       srlx    %g3, 32, %o5
 
-       retl
-       mov     %g4, %o0                C return value
+L(done):
+       ret
+        restore %o5, 0, %o0
 EPILOGUE()
index 2342e1498d248ce596151f9f6ad2853a67089c90..6f9d5a44ca66ac772d2b5b32aad7af999da95801 100644 (file)
@@ -1,22 +1,32 @@
 /* UltraSPARC T 32-bit gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 DIVREM_1_NORM_THRESHOLD              0  /* always */
 #define DIVREM_1_UNNORM_THRESHOLD            3
index fcde0c788efb9644ecbc293b9945f8362f086f78..0239cd28cd359718b2c21da60b31a14cb7011a32 100644 (file)
@@ -1,26 +1,42 @@
 dnl  SPARC T1 32-bit mpn_mul_1.
 
-dnl  Copyright 2010 Free Software Foundation, Inc.
+dnl  Contributed to the GNU project by David Miller.
 
-dnl  This file is part of the GNU MP Library.
+dnl  Copyright 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C                 cycles/limb
-C UltraSPARC T1:       23
+C UltraSPARC T1:       20
+C UltraSPARC T2:       18
+C UltraSPARC T3:       18
+C UltraSPARC T4:       4
 
 C INPUT PARAMETERS
 define(`rp',   `%o0')
@@ -30,21 +46,38 @@ define(`v0',        `%o3')
 
 ASM_START()
 PROLOGUE(mpn_mul_1)
-       mov     0, %g4
-       srl     v0, 0, v0
        srl     n, 0, n
-       dec     n                       C n--
+       srl     v0, 0, v0
+       subcc   n, 1, n
+       be      L(final_one)
+        clr    %o5
 
 L(top):        lduw    [up+0], %g1
-       add     up, 4, up               C up++
+       lduw    [up+4], %g2
+       mulx    %g1, v0, %g3
+       add     up, 8, up
+       mulx    %g2, v0, %o4
+       sub     n, 2, n
+       add     rp, 8, rp
+       add     %o5, %g3, %g3
+       stw     %g3, [rp-8]
+       srlx    %g3, 32, %o5
+       add     %o5, %o4, %o4
+       stw     %o4, [rp-4]
+       brgz    n, L(top)
+        srlx   %o4, 32, %o5
+
+       brlz,pt n, L(done)
+        nop
+
+L(final_one):
+       lduw    [up+0], %g1
        mulx    %g1, v0, %g3
-       add     %g4, %g3, %g3
+       add     %o5, %g3, %g3
        stw     %g3, [rp+0]
-       add     rp, 4, rp               C rp++
-       srlx    %g3, 32, %g4
-       brnz    n, L(top)
-       dec     n                       C n--
+       srlx    %g3, 32, %o5
 
+L(done):
        retl
-       mov     %g4, %o0                C return value
+        mov    %o5, %o0
 EPILOGUE()
index c7aa966a78718a3591963a49524affa80964eea8..3b906ef202ed11bc7a5d00ffd15383d26d2b058a 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC T1 32-bit mpn_sqr_diagonal.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index a2293a988248b8d5d21be39b91e140cbd178a23d..946bc3ff8e26f5746933c3423c70096bff56c4bd 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC T1 32-bit mpn_sub_n.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 605a8820bc2d8b2673cfa7bc66beebe48863bfd2..89200709c4cbe009c7eb5e39dadcacd879448b97 100644 (file)
@@ -1,52 +1,91 @@
 dnl  SPARC T1 32-bit mpn_submul_1.
 
-dnl  Copyright 2010 Free Software Foundation, Inc.
+dnl  Contributed to the GNU project by David Miller.
 
-dnl  This file is part of the GNU MP Library.
+dnl  Copyright 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C                 cycles/limb
-C UltraSPARC T1:       27
+C UltraSPARC T1:       24
+C UltraSPARC T2:       19
+C UltraSPARC T3:       19
+C UltraSPARC T4:       5
 
 C INPUT PARAMETERS
-define(`rp',   `%o0')
-define(`up',   `%o1')
-define(`n',    `%o2')
-define(`v0',   `%o3')
+define(`rp',   `%i0')
+define(`up',   `%i1')
+define(`n',    `%i2')
+define(`v0',   `%i3')
 
 ASM_START()
 PROLOGUE(mpn_submul_1)
-       subcc   %g0, %g0, %g4           C clear CF and g4
-       srl     v0, 0, v0
-       srl     n, 0, n
-       dec     n                       C n--
-
-L(top):        lduw    [up+0], %g1
-       add     up, 4, up               C up++
-       mulx    %g1, v0, %g3
-       lduw    [rp+0], %g2
-       addx    %g4, %g3, %g3
-       srlx    %g3, 32, %g4
-       subcc   %g2, %g3, %g3
+       save    %sp, -96, %sp
+       srl     n, 0, %o4
+       srl     v0, 0, %g1
+       subcc   %o4, 1, %o4
+       be      L(final_one)
+        subcc  %g0, 0, %o5
+
+L(top):        lduw    [up+0], %l0
+       lduw    [rp+0], %l2
+       lduw    [up+4], %l1
+       lduw    [rp+4], %l3
+       mulx    %l0, %g1, %g3
+       add     up, 8, up
+       mulx    %l1, %g1, %o3
+       sub     %o4, 2, %o4
+       add     rp, 8, rp
+       addx    %o5, %g3, %g3
+       srlx    %g3, 32, %o5
+       subcc   %l2, %g3, %g3
+       stw     %g3, [rp-8]
+       addx    %o5, %o3, %o3
+       srlx    %o3, 32, %o5
+       subcc   %l3, %o3, %o3
+       brgz    %o4, L(top)
+        stw    %o3, [rp-4]
+
+       brlz,pt %o4, L(done)
+        nop
+
+L(final_one):
+       lduw    [up+0], %l0
+       lduw    [rp+0], %l2
+       mulx    %l0, %g1, %g3
+       addx    %o5, %g3, %g3
+       srlx    %g3, 32, %o5
+       subcc   %l2, %g3, %g3
        stw     %g3, [rp+0]
-       add     rp, 4, rp               C rp++
-       brnz    n, L(top)
-       dec     n                       C n--
 
-       retl
-       addx    %g4, 0, %o0             C return value
+L(done):
+       addx    %o5, 0, %o5
+       ret
+        restore %o5, 0, %o0
 EPILOGUE()
index 80c82122d96da4a179c6d5a6e602614c1d654342..3a20b95cb50ba0b48e65be0e4e85d0c68ddd11c7 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC mpn_umul_ppmm -- support for longlong.h for non-gcc.
 dnl  Copyright 1995, 1996, 2000 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 6e5e78865b37fcbe53221ac6a3fc0578714792f3..0052092784374040428be68f34c38f338072f3c4 100644 (file)
@@ -1,22 +1,33 @@
 dnl  SPARC v8 mpn_addmul_1 -- Multiply a limb vector with a limb and
 dnl  add the result to a second limb vector.
 
-dnl  Copyright 1992, 1993, 1994, 1995, 2000 Free Software Foundation, Inc.
+dnl  Copyright 1992-1995, 2000 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 0962732b51c56a683f4cd9696f7b010a1e6941db..e57897b439d5effe33b1232ec4ca11fdf32dc821 100644 (file)
@@ -1,26 +1,36 @@
 /* SPARC v8 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 /* Generated by tuneup.c, 2004-02-07, gcc 2.95 */
 
index d428debf1541d13661bd99d02031537fcb8d31e2..e26c853aed8ce73cd7e6d4ae491f014bddc171c5 100644 (file)
@@ -4,19 +4,30 @@ dnl  store the product in a second limb vector.
 dnl  Copyright 1992, 1994, 1995, 2000 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 4dde01280821a5200a67b35c85faf92fc31bda3f..187314eceff425fb70563fbfbec65db7427bbcc8 100644 (file)
@@ -1,22 +1,33 @@
 dnl  SPARC v8 mpn_submul_1 -- Multiply a limb vector with a limb and
 dnl  subtract the result from a second limb vector.
 
-dnl  Copyright 1992, 1993, 1994, 2000 Free Software Foundation, Inc.
+dnl  Copyright 1992-1994, 2000 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 130e9a5394506f9e55ead427634b4939fd8d7dd5..1ac9239e3c53f6b263d35a66e5d896989080e6c9 100644 (file)
@@ -1,26 +1,36 @@
 /* SuperSPARC gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 /* Generated by tuneup.c, 2004-02-10, gcc 3.3 */
 
index 2ce3b8f15c83a546ac071adcc2a5c83a75d16d6e..12f66ce6a27735060d845ce67fb7531e3ea06f01 100644 (file)
@@ -5,19 +5,30 @@ dnl  udiv instruction.
 dnl  Copyright 1993, 1994, 1996, 2000 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 2ce3b8f15c83a546ac071adcc2a5c83a75d16d6e..12f66ce6a27735060d845ce67fb7531e3ea06f01 100644 (file)
@@ -5,19 +5,30 @@ dnl  udiv instruction.
 dnl  Copyright 1993, 1994, 1996, 2000 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 569a4e8dd346530d3f79f86574d0680fd44de107..1a2e84b1f6e6fc1f7171faa16587d513fa3f2931 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v8 mpn_umul_ppmm -- support for longlong.h for non-gcc.
 dnl  Copyright 1995, 1996, 2000 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index a21cf10d555328bf0f52111699041588380cc0ff..7bd5974fd38f73ede7b342c118f1bd83fc98dfd1 100644 (file)
@@ -4,19 +4,30 @@ dnl  sum in a third limb vector.
 dnl  Copyright 2001 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index 18b9a72d1ac84f69d325535cd260f4ae0191895b..2adf7a8a2f707d49ba1c88b2dacb1954299c11af 100644 (file)
@@ -4,19 +4,30 @@ dnl  the result to a second limb vector.
 dnl  Copyright 1998, 2000, 2001, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 40da333cf2b5dc6d340ba12132ddc24616f130ff..f909e2cf18ef18cce7312c06cc8c1046a86c71ba 100644 (file)
 /* SPARC v9 32-bit gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 2009, 2010, 2011
-Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2002, 2004, 2009-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
+
+/* 1593 MHz ultrasparc3 running Solaris 10 (swift.nada.kth.se) */
+/* FFT tuning limit = 25000000 */
+/* Generated by tuneup.c, 2014-03-16, gcc 3.4 */
 
 #define DIVREM_1_NORM_THRESHOLD              3
 #define DIVREM_1_UNNORM_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         11
-#define MOD_1U_TO_MOD_1_1_THRESHOLD         11
+#define MOD_1N_TO_MOD_1_1_THRESHOLD         13
+#define MOD_1U_TO_MOD_1_1_THRESHOLD         12
 #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     61
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD     32
 #define USE_PREINV_DIVREM_1                  1
+#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 */
 #define BMOD_1_TO_MOD_1_THRESHOLD        MP_SIZE_T_MAX  /* never */
 
-#define MUL_TOOM22_THRESHOLD                27
-#define MUL_TOOM33_THRESHOLD               112
-#define MUL_TOOM44_THRESHOLD               124
-#define MUL_TOOM6H_THRESHOLD               160
-#define MUL_TOOM8H_THRESHOLD               242
+#define MUL_TOOM22_THRESHOLD                28
+#define MUL_TOOM33_THRESHOLD                43
+#define MUL_TOOM44_THRESHOLD               126
+#define MUL_TOOM6H_THRESHOLD               161
+#define MUL_TOOM8H_THRESHOLD               208
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD      69
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD      93
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD      71
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD      53
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD      70
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD      73
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD      80
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD      85
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD      55
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD      72
 
-#define SQR_BASECASE_THRESHOLD               5
+#define SQR_BASECASE_THRESHOLD               4
 #define SQR_TOOM2_THRESHOLD                 64
 #define SQR_TOOM3_THRESHOLD                 85
-#define SQR_TOOM4_THRESHOLD                158
+#define SQR_TOOM4_THRESHOLD                152
 #define SQR_TOOM6_THRESHOLD                185
-#define SQR_TOOM8_THRESHOLD                224
+#define SQR_TOOM8_THRESHOLD                324
 
 #define MULMID_TOOM42_THRESHOLD             64
 
-#define MULMOD_BNM1_THRESHOLD               11
+#define MULMOD_BNM1_THRESHOLD               12
 #define SQRMOD_BNM1_THRESHOLD               16
 
-#define MUL_FFT_MODF_THRESHOLD             212  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             288  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    212, 5}, {     11, 6}, {      7, 5}, {     17, 6}, \
+  { {    288, 5}, {      9, 4}, {     19, 5}, {     11, 6}, \
+    {      6, 5}, {     14, 6}, {      8, 5}, {     17, 6}, \
     {      9, 5}, {     20, 6}, {     13, 7}, {      7, 6}, \
-    {     16, 7}, {      9, 6}, {     20, 7}, {     13, 8}, \
-    {      7, 7}, {     19, 8}, {     11, 7}, {     25, 9}, \
+    {     16, 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}, {     67, 9}, \
-    {     39, 8}, {     79, 7}, {    159, 8}, {     83, 7}, \
-    {    175, 8}, {     91, 9}, {     47, 8}, {     95,10}, \
-    {     31, 9}, {     63, 8}, {    127, 9}, {     71, 8}, \
-    {    143, 9}, {     79, 8}, {    159, 9}, {     87,10}, \
-    {     47, 9}, {     95,11}, {     31,10}, {     63, 9}, \
-    {    127, 8}, {    255, 9}, {    143,10}, {     79, 9}, \
-    {    175,10}, {     95, 9}, {    191, 8}, {    415,10}, \
-    {    111,11}, {     63,10}, {    127, 9}, {    271,10}, \
-    {    143, 9}, {    287, 8}, {    575,10}, {    175,11}, \
-    {     95,10}, {    191, 9}, {    415, 8}, {    831,10}, \
-    {    223,12}, {     63,11}, {    127,10}, {    287, 9}, \
-    {    575,11}, {    159,10}, {    319, 9}, {    639, 8}, \
-    {   1407,11}, {    191,10}, {    415, 9}, {    831,11}, \
-    {    223,10}, {    447,12}, {   4096,13}, {   8192,14}, \
-    {  16384,15}, {  32768,16} }
-#define MUL_FFT_TABLE3_SIZE 86
-#define MUL_FFT_THRESHOLD                 2688
-
-#define SQR_FFT_MODF_THRESHOLD             180  /* k = 5 */
+    {     39, 8}, {     27, 9}, {     15, 8}, {     31, 7}, \
+    {     63, 8}, {     39, 9}, {     23, 8}, {     47,10}, \
+    {     15, 9}, {     31, 8}, {     67, 9}, {     39, 8}, \
+    {     79, 9}, {     47,10}, {     31, 9}, {     71, 8}, \
+    {    143, 9}, {     79,10}, {     47, 9}, {     95,11}, \
+    {     31,10}, {     63, 9}, {    135, 8}, {    271, 9}, \
+    {    143, 8}, {    287,10}, {     79, 9}, {    175,10}, \
+    {     95, 9}, {    191, 8}, {    383,10}, {    111,11}, \
+    {     63,10}, {    143, 9}, {    287, 8}, {    575,10}, \
+    {    175,11}, {     95,10}, {    191, 9}, {    415, 8}, \
+    {    831,12}, {     63,11}, {    127,10}, {    287, 9}, \
+    {    575,11}, {    159,10}, {    351, 9}, {    703,11}, \
+    {    191,10}, {    415, 9}, {    831,11}, {    223,10}, \
+    {    447, 9}, {    895, 8}, {   1791,12}, {    127,11}, \
+    {    287,10}, {    607, 9}, {   1215, 8}, {   2431,11}, \
+    {    319, 9}, {   1279,11}, {    351,12}, {    191,11}, \
+    {    415,10}, {    831,11}, {    447,10}, {    895, 9}, \
+    {   1791,11}, {    479,13}, {    127,12}, {    255,11}, \
+    {    575,10}, {   1151,11}, {    607,12}, {    319,11}, \
+    {    703,12}, {    383,11}, {    831,12}, {    447,11}, \
+    {    895,10}, {   1791,11}, {    959,13}, {    255,12}, \
+    {    575,11}, {   1215,10}, {   2431,12}, {    703,13}, \
+    {    383,12}, {    959,14}, {    255,13}, {    511,12}, \
+    {   1087,11}, {   2175,12}, {   1215,11}, {   2431,13}, \
+    {    639,12}, {   1407,11}, {   2943,13}, {    895,12}, \
+    {   1919,14}, {    511,13}, {   1151,12}, {   2431,13}, \
+    {   1407,14}, {    767,13}, {   1791,15}, {    511,14}, \
+    {   1023,13}, {   2431,14}, {   1279,13}, {   2943,12}, \
+    {   5887,14}, {  16384,15}, {  32768,16} }
+#define MUL_FFT_TABLE3_SIZE 143
+#define MUL_FFT_THRESHOLD                 2240
+
+#define SQR_FFT_MODF_THRESHOLD             244  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    180, 5}, {      6, 4}, {     13, 5}, {     13, 6}, \
-    {      7, 5}, {     15, 6}, {     13, 7}, {      7, 6}, \
-    {     17, 7}, {      9, 6}, {     20, 7}, {     11, 6}, \
-    {     23, 7}, {     13, 8}, {      7, 7}, {     19, 8}, \
-    {     11, 7}, {     25, 9}, {      7, 8}, {     15, 7}, \
-    {     31, 8}, {     23, 9}, {     15, 8}, {     39, 9}, \
-    {     23,10}, {     15, 9}, {     31, 8}, {     63, 7}, \
-    {    127, 9}, {     47,10}, {     31, 9}, {     63, 8}, \
-    {    127, 9}, {     71, 8}, {    143, 7}, {    287, 6}, \
-    {    575,10}, {     47, 9}, {     95,11}, {     31,10}, \
-    {     63, 9}, {    127, 8}, {    255, 9}, {    143,10}, \
-    {     79, 9}, {    159, 8}, {    319, 9}, {    175, 8}, \
-    {    351, 7}, {    703,10}, {     95, 9}, {    191, 8}, \
-    {    383, 9}, {    207,10}, {    111,11}, {     63,10}, \
-    {    127, 9}, {    255,10}, {    143, 9}, {    287, 8}, \
+  { {    244, 5}, {      8, 4}, {     17, 5}, {     17, 6}, \
+    {      9, 5}, {     19, 6}, {     17, 7}, {      9, 6}, \
+    {     20, 7}, {     11, 6}, {     23, 7}, {     13, 8}, \
+    {      7, 7}, {     19, 8}, {     11, 7}, {     25, 9}, \
+    {      7, 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, 7}, {    287, 9}, {     79,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,10}, {     95, 9}, {    191, 8}, {    383, 9}, \
+    {    207, 8}, {    415, 9}, {    223,11}, {     63,10}, \
+    {    127, 9}, {    271,10}, {    143, 9}, {    287, 8}, \
     {    575,10}, {    159, 9}, {    319,10}, {    175, 9}, \
     {    351, 8}, {    703,11}, {     95,10}, {    191, 9}, \
-    {    383,10}, {    207, 9}, {    415, 8}, {    831,12}, \
-    {     63,11}, {    127,10}, {    255, 9}, {    543,10}, \
-    {    287, 9}, {    575,11}, {    159,10}, {    319, 9}, \
-    {    639,10}, {    351, 9}, {    703, 8}, {   1407,11}, \
-    {    191,10}, {    415, 9}, {    831,11}, {    223,10}, \
-    {    447, 9}, {    895,12}, {   4096,13}, {   8192,14}, \
-    {  16384,15}, {  32768,16} }
-#define SQR_FFT_TABLE3_SIZE 94
-#define SQR_FFT_THRESHOLD                 1856
+    {    383,10}, {    207, 9}, {    415, 8}, {    831,10}, \
+    {    223,12}, {     63,11}, {    127,10}, {    271, 9}, \
+    {    543,10}, {    287, 9}, {    575,11}, {    159,10}, \
+    {    319, 9}, {    639,10}, {    351, 9}, {    703, 8}, \
+    {   1407,11}, {    191,10}, {    415, 9}, {    831,11}, \
+    {    223,10}, {    447, 9}, {    895,10}, {    479,12}, \
+    {    127,11}, {    255,10}, {    543,11}, {    287,10}, \
+    {    575,11}, {    319,10}, {    639,11}, {    351,10}, \
+    {    703,12}, {    191,11}, {    415,10}, {    831,11}, \
+    {    447,10}, {    895, 9}, {   1791,13}, {    127,12}, \
+    {    255,11}, {    575,12}, {    319,11}, {    703,10}, \
+    {   1407,12}, {    383,11}, {    831,12}, {    447,11}, \
+    {    959,10}, {   1919, 9}, {   3839,13}, {    255,12}, \
+    {    575,11}, {   1151,12}, {    703,11}, {   1407,13}, \
+    {    383,12}, {    959,14}, {    255,13}, {    511,12}, \
+    {   1215,11}, {   2431,13}, {    639,12}, {   1407,13}, \
+    {    767,12}, {   1599,13}, {    895,12}, {   1919,14}, \
+    {    511,13}, {   1151,12}, {   2431,13}, {   1407,12}, \
+    {   2815,14}, {    767,13}, {   1535,12}, {   3071,13}, \
+    {   1919,15}, {    511,14}, {   1023,13}, {   2431,14}, \
+    {   1279,13}, {   2943,12}, {   5887,14}, {  16384,15}, \
+    {  32768,16} }
+#define SQR_FFT_TABLE3_SIZE 153
+#define SQR_FFT_THRESHOLD                 2112
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
-#define MULLO_DC_THRESHOLD                 145
-#define MULLO_MUL_N_THRESHOLD             5333
+#define MULLO_DC_THRESHOLD                 144
+#define MULLO_MUL_N_THRESHOLD             4292
 
-#define DC_DIV_QR_THRESHOLD                 78
-#define DC_DIVAPPR_Q_THRESHOLD             414
-#define DC_BDIV_QR_THRESHOLD                75
-#define DC_BDIV_Q_THRESHOLD                360
+#define DC_DIV_QR_THRESHOLD                 74
+#define DC_DIVAPPR_Q_THRESHOLD             406
+#define DC_BDIV_QR_THRESHOLD                63
+#define DC_BDIV_Q_THRESHOLD                363
 
-#define INV_MULMOD_BNM1_THRESHOLD           52
+#define INV_MULMOD_BNM1_THRESHOLD          108
 #define INV_NEWTON_THRESHOLD               351
-#define INV_APPR_THRESHOLD                 354
+#define INV_APPR_THRESHOLD                 303
 
-#define BINV_NEWTON_THRESHOLD              234
-#define REDC_1_TO_REDC_N_THRESHOLD          60
+#define BINV_NEWTON_THRESHOLD              354
+#define REDC_1_TO_REDC_N_THRESHOLD          61
 
-#define MU_DIV_QR_THRESHOLD                855
+#define MU_DIV_QR_THRESHOLD                998
 #define MU_DIVAPPR_Q_THRESHOLD            1099
-#define MUPI_DIV_QR_THRESHOLD              112
-#define MU_BDIV_QR_THRESHOLD               839
+#define MUPI_DIV_QR_THRESHOLD              118
+#define MU_BDIV_QR_THRESHOLD               807
 #define MU_BDIV_Q_THRESHOLD                979
 
-#define POWM_SEC_TABLE  4,23,127,453,1679,2870
+#define POWM_SEC_TABLE  3,22,127,624,779,2351
 
-#define MATRIX22_STRASSEN_THRESHOLD          9
-#define HGCD_THRESHOLD                      87
-#define HGCD_APPR_THRESHOLD                126
-#define HGCD_REDUCE_THRESHOLD             1679
+#define MATRIX22_STRASSEN_THRESHOLD          7
+#define HGCD_THRESHOLD                      90
+#define HGCD_APPR_THRESHOLD                123
+#define HGCD_REDUCE_THRESHOLD             1494
 #define GCD_DC_THRESHOLD                   283
-#define GCDEXT_DC_THRESHOLD                189
+#define GCDEXT_DC_THRESHOLD                192
 #define JACOBI_BASE_METHOD                   4
 
-#define GET_STR_DC_THRESHOLD                14
-#define GET_STR_PRECOMPUTE_THRESHOLD        28
-#define SET_STR_DC_THRESHOLD               262
-#define SET_STR_PRECOMPUTE_THRESHOLD       548
+#define GET_STR_DC_THRESHOLD                12
+#define GET_STR_PRECOMPUTE_THRESHOLD        27
+#define SET_STR_DC_THRESHOLD               290
+#define SET_STR_PRECOMPUTE_THRESHOLD       634
 
 #define FAC_DSC_THRESHOLD                  156
-#define FAC_ODD_THRESHOLD                   28
+#define FAC_ODD_THRESHOLD                   25
index 881f46fb62c05428070d94f6312e4cea14eaf2c8..40aeffad4f31568415c17448b601cf8038ec5e2a 100644 (file)
@@ -4,19 +4,30 @@ dnl  the result in a second limb vector.
 dnl  Copyright 1998, 2000, 2001, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index e4a78c5de7a2be5de1fa32b71748b27dba613833..e0242798496a15a36977e7980123aec54deb5471 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 32-bit mpn_sqr_diagonal.
 dnl  Copyright 2001, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index cea474326cc4d1c176f17d3353649601196f24e1..636c73bf35c3d925b8a04f654f537024acba8223 100644 (file)
@@ -4,19 +4,30 @@ dnl  store difference in a third limb vector.
 dnl  Copyright 2001 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index e5823b1e4b178c6329df064e2a65149755668740..92d0ce7db9ea1086d3db53a092a7f7f70a6447c3 100644 (file)
@@ -4,19 +4,30 @@ dnl  subtract the result from a second limb vector.
 dnl  Copyright 1998, 2000, 2001, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 0957b8c225152fadbde63ade3590300dfeccc63a..61dde97a66ea3cb456f4943950a7b62fabf42a4b 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 32-bit mpn_udiv_qrnnd - division support for longlong.h.
 dnl  Copyright 2002, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index fada1926c054873711a2c7305960c09a1b9416c5..e2c051a02b807619ba0fc81986d95192f6fc81b7 100644 (file)
@@ -1,19 +1,30 @@
-Copyright 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1997, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index 409425fe028abf40ce0ca6817ef0ef3228c7d3ed..ab105d39c7852ddcfccb3e76bbb13266efc4d8a4 100644 (file)
@@ -1,27 +1,41 @@
 dnl  SPARC v9 mpn_copyd -- Copy a limb vector, decrementing.
 
-dnl  Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+dnl  Copyright 1999-2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C                 cycles/limb
-C UltraSPARC 1&2:     2
-C UltraSPARC 3:              2.5
+C UltraSPARC 1&2:       2
+C UltraSPARC 3:                 2.5
+C UltraSPARC T1:       17
+C UltraSPARC T3:        6
+C UltraSPARC T4/T5:     2
 
 C INPUT PARAMETERS
 C rptr %o0
index bc81797ce806363c88b44072dd7015755ff9ab52..45663dc2a35f4d55a33458ba8b28a0edc8f48d63 100644 (file)
@@ -1,27 +1,41 @@
 dnl  SPARC v9 mpn_copyi -- Copy a limb vector, incrementing.
 
-dnl  Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+dnl  Copyright 1999-2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C                 cycles/limb
-C UltraSPARC 1&2:     2
-C UltraSPARC 3:              2.5
+C UltraSPARC 1&2:       2
+C UltraSPARC 3:                 2.5
+C UltraSPARC T1:       17
+C UltraSPARC T3:        6
+C UltraSPARC T4/T5:     2
 
 C INPUT PARAMETERS
 C rptr %o0
index 6f3d7c447c45020b6fb19fae4455f857fc72cf93..c3fbf01b14c3081b644caa5a8342689a6e16b52d 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2000, 2001, 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 06de9a60408be35bf1f4ea47a402d1b6facff0e2..531494a94f6c8d35cc6e7301b1680c8e3c8a4ea1 100644 (file)
@@ -1,22 +1,33 @@
 /* UltraSparc 64 mpn_divrem_1 -- mpn by limb division.
 
-Copyright 1991, 1993, 1994, 1996, 1998, 1999, 2000, 2001, 2003 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1998-2001, 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 3014777523ad70aff67aad96878b11cae3acba54..e4d8de6a28e882b1c31e372e104cd00fc69300b7 100644 (file)
@@ -1,33 +1,45 @@
 dnl  SPARC64 mpn_gcd_1.
 
-dnl  Based on the K7 gcd_1.asm, by Kevin Ryde.  Rehacked for SPARC by Torbjorn
+dnl  Based on the K7 gcd_1.asm, by Kevin Ryde.  Rehacked for SPARC by Torbjörn
 dnl  Granlund.
 
-dnl  Copyright 2000, 2001, 2002, 2005, 2009, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 
 C                cycles/bit (approx)
-C UltraSPARC 1&2:      5.1
-C UltraSPARC 3:        5.0
-C UltraSPARC T1:      12.8
+C UltraSPARC 1&2:       5.1
+C UltraSPARC 3:                 5.0
+C UltraSPARC T1:       11.4
+C UltraSPARC T3:       10
+C UltraSPARC T4:        6
 C Numbers measured with: speed -CD -s32-64 -t32 mpn_gcd_1
 
 C ctz_table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
@@ -35,13 +47,14 @@ 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))
 
-       .section        ".rodata"
+       RODATA
+       TYPE(ctz_table,object)
 ctz_table:
        .byte   MAXSHIFT
 forloop(i,1,MASK,
 `      .byte   m4_count_trailing_zeros(i)
 ')
-
+       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).
@@ -92,25 +105,11 @@ L(bmod):
 
 L(noreduce):
 
-ifdef(`PIC',`
-       sethi   %hi(_GLOBAL_OFFSET_TABLE_-4), %l7
-       call    L(LGETPC0)
-       add     %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
-       sethi   %hi(ctz_table), %g1
-       or      %g1, %lo(ctz_table), %g1
-       ldx     [%l7+%g1], %i5
-',`
-       sethi   %hh(ctz_table), %l7
-       or      %l7, %hm(ctz_table), %l7
-       sllx    %l7, 32, %l7
-       sethi   %lm(ctz_table), %g1
-       add     %l7, %g1, %l7
-       or      %l7, %lo(ctz_table), %i5
-')
+       LEA64(ctz_table, i5, g4)
 
        cmp     %o0, 0
        bnz     %xcc, L(mid)
-        andcc  %o0, MASK, %g3          C
+        and    %o0, MASK, %g3          C
 
        return  %i7+8
         sllx   %o2, %o4, %o0           C CAUTION: v0 alias for o2
@@ -118,15 +117,13 @@ ifdef(`PIC',`
        ALIGN(16)
 L(top):        movcc   %xcc, %l4, v0           C v = min(u,v)
        movcc   %xcc, %l2, %o0          C u = |v - u]
-       cmp     %g3, 0                  C are all MAXSHIFT low bits zero?
-L(mid):        ldub    [%i5+%g3], %g3          C
-       bz,a    %xcc, L(shift_alot)     C
+L(mid):        ldub    [%i5+%g3], %g5          C
+       brz,a,pn %g3, L(shift_alot)     C
         srlx   %o0, MAXSHIFT, %o0
-       srlx    %o0, %g3, %l4           C new u, odd
-       nop                             C force parallel exec of sub insns
+       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
-       bnz     %xcc, L(top)            C
+       bnz,pt  %xcc, L(top)            C
         and    %l2, MASK, %g3          C extract low MAXSHIFT bits from (v-u)
 
        return  %i7+8
@@ -134,11 +131,5 @@ L(mid):    ldub    [%i5+%g3], %g3          C
 
 L(shift_alot):
        b       L(mid)
-        andcc  %o0, MASK, %g3          C
-
-ifdef(`PIC',`
-L(LGETPC0):
-       retl
-       add     %o7, %l7, %l7
-')
+        and    %o0, MASK, %g3          C
 EPILOGUE()
index 8539d1b1fd2727177f3749995198885f793521a2..5ac2c461c5e26ec13631001f52b28795b25bae01 100644 (file)
@@ -1,25 +1,36 @@
 /* Sparc64 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 2006, 2008, 2009,
-2010 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2002, 2004, 2006, 2008-2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 /* 500 MHz ultrasparc2 running GNU/Linux */
 
diff --git a/mpn/sparc64/lshift.asm b/mpn/sparc64/lshift.asm
new file mode 100644 (file)
index 0000000..90bbb45
--- /dev/null
@@ -0,0 +1,140 @@
+dnl  SPARC v9 mpn_lshift
+
+dnl  Contributed to the GNU project by David Miller.
+
+dnl  Copyright 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 UltraSPARC 1&2:       2
+C UltraSPARC 3:                 2.5
+C UltraSPARC T1:       17.5
+C UltraSPARC T3:        8
+C UltraSPARC T4:        3
+
+C INPUT PARAMETERS
+define(`rp',     `%i0')
+define(`up',     `%i1')
+define(`n',      `%i2')
+define(`cnt',    `%i3')
+
+define(`tcnt',   `%i4')
+define(`retval', `%i5')
+define(`u0',     `%l0')
+define(`u1',     `%l1')
+define(`r0',     `%l6')
+define(`r1',     `%l7')
+define(`u0_off', `%o0')
+define(`u1_off', `%o1')
+define(`r0_off', `%o2')
+define(`r1_off', `%o3')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_lshift)
+       save    %sp, -176, %sp
+
+       sllx    n, 3, n
+       sub     %g0, cnt, tcnt
+
+       sub     up, 8, u1_off
+       add     rp, (5 * 8), r1_off
+
+       ldx     [n + u1_off], u1        C WAS: up - 8
+       add     u1_off, (3 * 8), u1_off
+
+       sub     r1_off, 8, r0_off
+       sub     u1_off, 8, u0_off
+
+       subcc   n, (3 * 8), n
+       srlx    u1, tcnt, retval
+
+       bl,pn   %xcc, L(end12)
+        sllx   u1, cnt, %l3
+
+       ldx     [n + u0_off], u0        C WAS: up - 16
+       subcc   n, (2 * 8), n
+
+       ldx     [n + u1_off], u1        C WAS: up - 24
+
+       bl,pn   %xcc, L(end34)
+        srlx   u0, tcnt, %l4
+
+       b,a     L(top)
+       ALIGN(16)
+L(top):
+       sllx    u0, cnt, %l2
+       or      %l4, %l3, r0
+
+       ldx     [n + u0_off], u0        C WAS: up - 16
+       srlx    u1, tcnt, %l5
+
+       stx     r0, [n + r0_off]        C WAS: rp - 8
+       subcc   n, (2 * 8), n
+
+       sllx    u1, cnt, %l3
+       or      %l2, %l5, r1
+
+       ldx     [n + u1_off], u1        C WAS: up - 24
+       srlx    u0, tcnt, %l4
+
+       bge,pt  %xcc, L(top)
+        stx    r1, [n + r1_off]        C WAS: rp - 16
+
+L(end34):
+       sllx    u0, cnt, %l2
+       or      %l4, %l3, r0
+
+       srlx    u1, tcnt, %l5
+       stx     r0, [n + r0_off]        C WAS: rp - 8
+
+       or      %l2, %l5, r1
+       sub     n, (2 * 8), %o5
+
+       sllx    u1, cnt, %l3
+       stx     r1, [%o5 + r1_off]      C WAS: rp - 16
+
+L(end12):
+       andcc   n, 8, %g0
+       bz,pn   %xcc, L(done)
+        nop
+
+       ldx     [n + u0_off], u1
+       srlx    u1, tcnt, %l4
+       or      %l4, %l3, r0
+       stx     r0, [r0_off - 24]
+       sllx    u1, cnt, %l3
+L(done):
+       stx     %l3, [r0_off - 32]
+
+       ret
+       restore retval, 0, %o0
+EPILOGUE()
diff --git a/mpn/sparc64/lshiftc.asm b/mpn/sparc64/lshiftc.asm
new file mode 100644 (file)
index 0000000..4a0f0a3
--- /dev/null
@@ -0,0 +1,147 @@
+dnl  SPARC v9 mpn_lshiftc
+
+dnl  Contributed to the GNU project by David Miller.
+
+dnl  Copyright 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 UltraSPARC 1&2:       3
+C UltraSPARC 3:                 3
+C UltraSPARC T1:       17
+C UltraSPARC T3:       10
+C UltraSPARC T4:        3.5
+
+C INPUT PARAMETERS
+define(`rp',     `%i0')
+define(`up',     `%i1')
+define(`n',      `%i2')
+define(`cnt',    `%i3')
+
+define(`tcnt',   `%i4')
+define(`retval', `%i5')
+define(`u0',     `%l0')
+define(`u1',     `%l1')
+define(`r0',     `%l6')
+define(`r1',     `%l7')
+define(`u0_off', `%o0')
+define(`u1_off', `%o1')
+define(`r0_off', `%o2')
+define(`r1_off', `%o3')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_lshiftc)
+       save    %sp, -176, %sp
+
+       sllx    n, 3, n
+       sub     %g0, cnt, tcnt
+
+       sub     up, 8, u1_off
+       add     rp, (5 * 8), r1_off
+
+       ldx     [n + u1_off], u1        C WAS: up - 8
+       add     u1_off, (3 * 8), u1_off
+
+       sub     r1_off, 8, r0_off
+       sub     u1_off, 8, u0_off
+
+       subcc   n, (3 * 8), n
+       srlx    u1, tcnt, retval
+
+       bl,pn   %xcc, L(end12)
+        sllx   u1, cnt, %l3
+
+       ldx     [n + u0_off], u0        C WAS: up - 16
+       subcc   n, (2 * 8), n
+
+       ldx     [n + u1_off], u1        C WAS: up - 24
+
+       bl,pn   %xcc, L(end34)
+        srlx   u0, tcnt, %l4
+
+       b,a     L(top)
+       ALIGN(16)
+L(top):
+       not     %l3, %l3
+       sllx    u0, cnt, %l2
+
+       andn    %l3, %l4, r0
+       ldx     [n + u0_off], u0        C WAS: up - 16
+
+       srlx    u1, tcnt, %l5
+       stx     r0, [n + r0_off]        C WAS: rp - 8
+
+       subcc   n, (2 * 8), n
+       not     %l2, %l2
+
+       sllx    u1, cnt, %l3
+       andn    %l2, %l5, r1
+
+       ldx     [n + u1_off], u1        C WAS: up - 24
+       srlx    u0, tcnt, %l4
+
+       bge,pt  %xcc, L(top)
+        stx    r1, [n + r1_off]        C WAS: rp - 16
+
+L(end34):
+       not     %l3, %l3
+       sllx    u0, cnt, %l2
+
+       andn    %l3, %l4, r0
+       srlx    u1, tcnt, %l5
+
+       stx     r0, [n + r0_off]        C WAS: rp - 8
+       not     %l2, %l2
+
+       andn    %l2, %l5, r1
+       sub     n, (2 * 8), %o5
+
+       sllx    u1, cnt, %l3
+       stx     r1, [%o5 + r1_off]      C WAS: rp - 16
+
+L(end12):
+       andcc   n, 8, %g0
+       bz      %xcc, L(done)+4
+        not    %l3, %l3
+
+       ldx     [n + u0_off], u1
+       srlx    u1, tcnt, %l4
+       andn    %l3, %l4, r0
+       stx     r0, [r0_off - 24]
+       sllx    u1, cnt, %l3
+L(done):
+       not     %l3, %l3
+       stx     %l3, [r0_off - 32]
+
+       ret
+       restore retval, 0, %o0
+EPILOGUE()
index a1fef62046e9c8ed7e0c73a40cdb6c3ccd68f621..f1c51970d976ea48dbab066c60b2c54da1a89bdd 100644 (file)
@@ -1,22 +1,33 @@
 /* UltraSPARC 64 mpn_mod_1 -- mpn by limb remainder.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2003, 2010 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2001, 2003, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index d2202c803269f1fb0fa931e9c4d7ba52b30bed14..cc1b9484bccfba6b599a535d2be6ddc6a07aed61 100644 (file)
@@ -9,22 +9,33 @@
    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 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2008-2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -46,19 +57,23 @@ mpn_mod_1s_4p_cps (mp_limb_t cps[7], mp_limb_t b)
   b <<= cnt;
   invert_limb (bi, b);
 
-  B1modb = -b * ((bi >> (GMP_LIMB_BITS-cnt)) | (CNST_LIMB(1) << cnt));
-  ASSERT (B1modb <= b);                /* NB: not fully reduced mod b */
-  udiv_rnnd_preinv (B2modb, B1modb, 0, b, bi);
-  udiv_rnnd_preinv (B3modb, B2modb, 0, b, bi);
-  udiv_rnnd_preinv (B4modb, B3modb, 0, b, bi);
-  udiv_rnnd_preinv (B5modb, B4modb, 0, b, bi);
-
   cps[0] = bi;
   cps[1] = cnt;
+
+  B1modb = -b * ((bi >> (GMP_LIMB_BITS-cnt)) | (CNST_LIMB(1) << cnt));
+  ASSERT (B1modb <= b);                /* NB: not fully reduced mod b */
   cps[2] = B1modb >> cnt;
+
+  udiv_rnnd_preinv (B2modb, B1modb, CNST_LIMB(0), b, bi);
   cps[3] = B2modb >> cnt;
+
+  udiv_rnnd_preinv (B3modb, B2modb, CNST_LIMB(0), b, bi);
   cps[4] = B3modb >> cnt;
+
+  udiv_rnnd_preinv (B4modb, B3modb, CNST_LIMB(0), b, bi);
   cps[5] = B4modb >> cnt;
+
+  udiv_rnnd_preinv (B5modb, B4modb, CNST_LIMB(0), b, bi);
   cps[6] = B5modb >> cnt;
 
 #if WANT_ASSERT
@@ -75,7 +90,7 @@ mpn_mod_1s_4p_cps (mp_limb_t cps[7], mp_limb_t b)
 }
 
 mp_limb_t
-mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
+mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t cps[7])
 {
   mp_limb_t rh, rl, bi, ph, pl, ch, cl, r;
   mp_limb_t B1modb, B2modb, B3modb, B4modb, B5modb;
@@ -96,7 +111,7 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
        {
        case 0:
          umul_ppmm_s (ph, pl, ap[n - 3], B1modb);
-         add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 4]);
+         add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[n - 4]);
          umul_ppmm_s (ch, cl, ap[n - 2], B2modb);
          add_ssaaaa (ph, pl, ph, pl, ch, cl);
          umul_ppmm_s (rh, rl, ap[n - 1], B3modb);
@@ -115,7 +130,7 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
          break;
        case 3:
          umul_ppmm_s (ph, pl, ap[n - 2], B1modb);
-         add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 3]);
+         add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[n - 3]);
          umul_ppmm_s (rh, rl, ap[n - 1], B2modb);
          add_ssaaaa (rh, rl, rh, rl, ph, pl);
          n -= 3;
@@ -132,7 +147,7 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
                + HI(rr)  * (B^5 mod b)         <= (B-1)(b-1)
          */
          umul_ppmm_s (ph, pl, ap[i + 1], B1modb);
-         add_ssaaaa (ph, pl, ph, pl, 0, ap[i + 0]);
+         add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[i + 0]);
 
          umul_ppmm_s (ch, cl, ap[i + 2], B2modb);
          add_ssaaaa (ph, pl, ph, pl, ch, cl);
@@ -148,7 +163,7 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
        }
 
       umul_ppmm_s (rh, cl, rh, B1modb);
-      add_ssaaaa (rh, rl, rh, rl, 0, cl);
+      add_ssaaaa (rh, rl, rh, rl, CNST_LIMB(0), cl);
     }
   else
     {
index 5ec97c5cd40771c298171e072e6948fa15ad7403..7c8fc1cf3d8cecd2d35a6c639b0365527fde350b 100644 (file)
@@ -4,22 +4,33 @@
    CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
    FUTURE GNU MP RELEASES.
 
-Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2000-2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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/mpn/sparc64/rshift.asm b/mpn/sparc64/rshift.asm
new file mode 100644 (file)
index 0000000..3f8e11f
--- /dev/null
@@ -0,0 +1,142 @@
+dnl  SPARC v9 mpn_rshift
+
+dnl  Contributed to the GNU project by David Miller.
+
+dnl  Copyright 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 UltraSPARC 1&2:       2
+C UltraSPARC 3:                 2.5
+C UltraSPARC T1:       17.5
+C UltraSPARC T3:        8
+C UltraSPARC T4:        3
+
+C INPUT PARAMETERS
+define(`rp',     `%i0')
+define(`up',     `%i1')
+define(`n',      `%i2')
+define(`cnt',    `%i3')
+
+define(`tcnt',   `%i4')
+define(`retval', `%i5')
+define(`u0',     `%l0')
+define(`u1',     `%l1')
+define(`r0',     `%l6')
+define(`r1',     `%l7')
+define(`u0_off', `%o0')
+define(`u1_off', `%o1')
+define(`r0_off', `%o2')
+define(`r1_off', `%o3')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_rshift)
+       save    %sp, -176, %sp
+
+       sllx    n, 3, n
+       sub     %g0, cnt, tcnt
+
+       add     up, n, up
+       add     rp, n, rp
+
+       neg     n, n
+       sub     up, (2 * 8), u0_off
+       sub     rp, (5 * 8), r0_off
+
+       ldx     [n + up], u1            C WAS: up + 0
+       sub     u0_off, (1 * 8), u1_off
+       sub     r0_off, (1 * 8), r1_off
+
+       subcc   n, -(3 * 8), n
+       sllx    u1, tcnt, retval
+
+       bg,pn   %xcc, L(end12)
+        srlx   u1, cnt, %l3
+
+       ldx     [n + u0_off], u0        C WAS: up + 0
+       subcc   n, -(2 * 8), n
+
+       ldx     [n + u1_off], u1        C WAS: up + 8
+
+       bg,pn   %xcc, L(end34)
+        sllx   u0, tcnt, %l4
+
+       b,a     L(top)
+       ALIGN(16)
+L(top):
+       srlx    u0, cnt, %l2
+       or      %l3, %l4, r0
+
+       ldx     [n + u0_off], u0        C WAS: up + 0
+       sllx    u1, tcnt, %l5
+
+       stx     r0, [n + r0_off]        C WAS: rp + 0
+       subcc   n, -(2 * 8), n
+
+       srlx    u1, cnt, %l3
+       or      %l2, %l5, r1
+
+       ldx     [n + u1_off], u1        C WAS: up + 8
+       sllx    u0, tcnt, %l4
+
+       ble,pt  %xcc, L(top)
+        stx    r1, [n + r1_off]        C WAS: rp + 8
+
+L(end34):
+       srlx    u0, cnt, %l2
+       or      %l3, %l4, r0
+
+       sllx    u1, tcnt, %l5
+       stx     r0, [n + r0_off]        C WAS: rp + 0
+
+       or      %l2, %l5, r1
+       sub     n, -(2 * 8), %o5
+
+       srlx    u1, cnt, %l3
+       stx     r1, [%o5 + r1_off]      C WAS: rp + 8
+
+L(end12):
+       andcc   n, 8, %g0
+       bz,pn   %xcc, L(done)
+        nop
+
+       ldx     [n + u0_off], u1
+       sllx    u1, tcnt, %l4
+       or      %l3, %l4, r0
+       stx     r0, [r0_off + 24]
+       srlx    u1, cnt, %l3
+L(done):
+       stx     %l3, [r0_off + 32]
+
+       ret
+       restore retval, 0, %o0
+EPILOGUE()
diff --git a/mpn/sparc64/sec_tabselect.asm b/mpn/sparc64/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..22e0dc5
--- /dev/null
@@ -0,0 +1,162 @@
+dnl  SPARC v9 mpn_sec_tabselect.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund and David Miller.
+
+dnl  Copyright 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 UltraSPARC 1&2:       2 hopefully
+C UltraSPARC 3:                 3
+C UltraSPARC T1:       17
+C UltraSPARC T3:        ?
+C UltraSPARC T4/T5:     2.25 hopefully
+
+C INPUT PARAMETERS
+define(`rp',     `%i0')
+define(`tp',     `%i1')
+define(`n',      `%i2')
+define(`nents',  `%i3')
+define(`which',  `%i4')
+
+define(`i',      `%g1')
+define(`j',      `%g3')
+define(`stride', `%g4')
+define(`tporig', `%g5')
+define(`mask',   `%o0')
+
+define(`data0',  `%l0')
+define(`data1',  `%l1')
+define(`data2',  `%l2')
+define(`data3',  `%l3')
+define(`t0',     `%l4')
+define(`t1',     `%l5')
+define(`t2',     `%l6')
+define(`t3',     `%l7')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_sec_tabselect)
+       save    %sp, -176, %sp
+
+       sllx    n, 3, stride
+       sub     n, 4, j
+       brlz    j, L(outer_end)
+        mov    tp, tporig
+
+L(outer_loop):
+       clr     data0
+       clr     data1
+       clr     data2
+       clr     data3
+       mov     tporig, tp
+       mov     nents, i
+       mov     which, %o1
+
+L(top):        subcc   %o1, 1, %o1             C set carry iff o1 = 0
+       ldx     [tp + 0], t0
+       subc    %g0, %g0, mask
+       ldx     [tp + 8], t1
+       sub     i, 1, i
+       ldx     [tp + 16], t2
+       ldx     [tp + 24], t3
+       add     tp, stride, tp
+       and     t0, mask, t0
+       and     t1, mask, t1
+       or      t0, data0, data0
+       and     t2, mask, t2
+       or      t1, data1, data1
+       and     t3, mask, t3
+       or      t2, data2, data2
+       brnz    i, L(top)
+        or     t3, data3, data3
+
+       stx     data0, [rp + 0]
+       subcc   j, 4, j
+       stx     data1, [rp + 8]
+       stx     data2, [rp + 16]
+       stx     data3, [rp + 24]
+       add     tporig, (4 * 8), tporig
+
+       brgez   j, L(outer_loop)
+        add    rp, (4 * 8), rp
+L(outer_end):
+
+
+       andcc   n, 2, %g0
+       be      L(b0x)
+        nop
+L(b1x):        clr     data0
+       clr     data1
+       mov     tporig, tp
+       mov     nents, i
+       mov     which, %o1
+
+L(tp2):        subcc   %o1, 1, %o1
+       ldx     [tp + 0], t0
+       subc    %g0, %g0, mask
+       ldx     [tp + 8], t1
+       sub     i, 1, i
+       add     tp, stride, tp
+       and     t0, mask, t0
+       and     t1, mask, t1
+       or      t0, data0, data0
+       brnz    i, L(tp2)
+        or     t1, data1, data1
+
+       stx     data0, [rp + 0]
+       stx     data1, [rp + 8]
+       add     tporig, (2 * 8), tporig
+       add     rp, (2 * 8), rp
+
+
+L(b0x):        andcc   n, 1, %g0
+       be      L(b00)
+        nop
+L(b01):        clr     data0
+       mov     tporig, tp
+       mov     nents, i
+       mov     which, %o1
+
+L(tp1):        subcc   %o1, 1, %o1
+       ldx     [tp + 0], t0
+       subc    %g0, %g0, mask
+       sub     i, 1, i
+       add     tp, stride, tp
+       and     t0, mask, t0
+       brnz    i, L(tp1)
+        or     t0, data0, data0
+
+       stx     data0, [rp + 0]
+
+L(b00):         ret
+         restore
+EPILOGUE()
index 8f77ddd161b8fcf445521f1b0521076a40669017..09fc16d46a4417c4733815d6b4e7edbd7e7d8dac 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 LOW32(x)   ((x) & 0xFFFFFFFF)
index 2dbac315a05856c82798c3e902bb3b13331f45b8..92374d2552d5d3a913c5467f88e7800a128106e9 100644 (file)
@@ -1,22 +1,33 @@
 dnl  SPARC v9 mpn_add_n -- Add two limb vectors of the same length > 0 and
 dnl  store sum in a third limb vector.
 
-dnl  Copyright 2001, 2002, 2003, 2011 Free Software Foundation, Inc.
+dnl  Copyright 2001-2003, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -32,19 +43,19 @@ C recurrency, and the UltraSPARC 1 and 2 the IE units are 100% saturated.
 C Therefore, it seems futile to try to optimize this any further...
 
 C INPUT PARAMETERS
-define(`rp',`%i0')
-define(`up',`%i1')
-define(`vp',`%i2')
-define(`n',`%i3')
-
-define(`u0',`%l0')
-define(`u1',`%l2')
-define(`u2',`%l4')
-define(`u3',`%l6')
-define(`v0',`%l1')
-define(`v1',`%l3')
-define(`v2',`%l5')
-define(`v3',`%l7')
+define(`rp', `%i0')
+define(`up', `%i1')
+define(`vp', `%i2')
+define(`n',  `%i3')
+
+define(`u0', `%l0')
+define(`u1', `%l2')
+define(`u2', `%l4')
+define(`u3', `%l6')
+define(`v0', `%l1')
+define(`v1', `%l3')
+define(`v2', `%l5')
+define(`v3', `%l7')
 
 define(`cy',`%i4')
 
@@ -84,7 +95,7 @@ L(com):
        ldx     [vp-8],v3
        subcc   n,8,n
        add     u0,v0,%g1       C main add
-       add     %g1,cy,%g4      C carry add
+       add     %g1,cy,%g5      C carry add
        or      u0,v0,%g2
        bl,pn   %xcc,.Lend4567
        fanop
@@ -92,7 +103,7 @@ L(com):
 
        .align  16
 C START MAIN LOOP
-.Loop: andn    %g2,%g4,%g2
+.Loop: andn    %g2,%g5,%g2
        and     u0,v0,%g3
        ldx     [up+0],u0
        fanop
@@ -104,15 +115,15 @@ C --
 C --
        srlx    %g2,63,cy
        add     u1,v1,%g1
-       stx     %g4,[rp+0]
+       stx     %g5,[rp+0]
        fanop
 C --
-       add     %g1,cy,%g4
+       add     %g1,cy,%g5
        or      u1,v1,%g2
        fmnop
        fanop
 C --
-       andn    %g2,%g4,%g2
+       andn    %g2,%g5,%g2
        and     u1,v1,%g3
        ldx     [up-24],u1
        fanop
@@ -124,15 +135,15 @@ C --
 C --
        srlx    %g2,63,cy
        add     u2,v2,%g1
-       stx     %g4,[rp+8]
+       stx     %g5,[rp+8]
        fanop
 C --
-       add     %g1,cy,%g4
+       add     %g1,cy,%g5
        or      u2,v2,%g2
        fmnop
        fanop
 C --
-       andn    %g2,%g4,%g2
+       andn    %g2,%g5,%g2
        and     u2,v2,%g3
        ldx     [up-16],u2
        fanop
@@ -144,15 +155,15 @@ C --
 C --
        srlx    %g2,63,cy
        add     u3,v3,%g1
-       stx     %g4,[rp-16]
+       stx     %g5,[rp-16]
        fanop
 C --
-       add     %g1,cy,%g4
+       add     %g1,cy,%g5
        or      u3,v3,%g2
        fmnop
        fanop
 C --
-       andn    %g2,%g4,%g2
+       andn    %g2,%g5,%g2
        and     u3,v3,%g3
        ldx     [up-8],u3
        fanop
@@ -164,45 +175,45 @@ C --
 C --
        srlx    %g2,63,cy
        add     u0,v0,%g1
-       stx     %g4,[rp-8]
+       stx     %g5,[rp-8]
        fanop
 C --
-       add     %g1,cy,%g4
+       add     %g1,cy,%g5
        or      u0,v0,%g2
        bge,pt  %xcc,.Loop
        fanop
 C END MAIN LOOP
 .Lend4567:
-       andn    %g2,%g4,%g2
+       andn    %g2,%g5,%g2
        and     u0,v0,%g3
        or      %g3,%g2,%g2
        srlx    %g2,63,cy
        add     u1,v1,%g1
-       stx     %g4,[rp+0]
-       add     %g1,cy,%g4
+       stx     %g5,[rp+0]
+       add     %g1,cy,%g5
        or      u1,v1,%g2
-       andn    %g2,%g4,%g2
+       andn    %g2,%g5,%g2
        and     u1,v1,%g3
        or      %g3,%g2,%g2
        srlx    %g2,63,cy
        add     u2,v2,%g1
-       stx     %g4,[rp+8]
-       add     %g1,cy,%g4
+       stx     %g5,[rp+8]
+       add     %g1,cy,%g5
        or      u2,v2,%g2
-       andn    %g2,%g4,%g2
+       andn    %g2,%g5,%g2
        and     u2,v2,%g3
        or      %g3,%g2,%g2
        add     rp,32,rp
        srlx    %g2,63,cy
        add     u3,v3,%g1
-       stx     %g4,[rp-16]
-       add     %g1,cy,%g4
+       stx     %g5,[rp-16]
+       add     %g1,cy,%g5
        or      u3,v3,%g2
-       andn    %g2,%g4,%g2
+       andn    %g2,%g5,%g2
        and     u3,v3,%g3
        or      %g3,%g2,%g2
        srlx    %g2,63,cy
-       stx     %g4,[rp-8]
+       stx     %g5,[rp-8]
 
        addcc   n,4,n
        bz,pn   %xcc,.Lret
@@ -216,10 +227,10 @@ C END MAIN LOOP
        subcc   n,1,n
        add     u0,v0,%g1
        or      u0,v0,%g2
-       add     %g1,cy,%g4
+       add     %g1,cy,%g5
        and     u0,v0,%g3
-       andn    %g2,%g4,%g2
-       stx     %g4,[rp-8]
+       andn    %g2,%g5,%g2
+       stx     %g5,[rp-8]
        or      %g3,%g2,%g2
        bnz,pt  %xcc,.Loop0
        srlx    %g2,63,cy
index afffaf8170d6299714cf33b3a69f044522f3a85b..48a94146ff618581e03a5fabb33e6403b5e437d5 100644 (file)
@@ -1,23 +1,33 @@
 dnl  SPARC v9 64-bit mpn_addmul_1 -- Multiply a limb vector with a limb and add
 dnl  the result to a second limb vector.
 
-dnl  Copyright 1998, 2000, 2001, 2002, 2003, 2004 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 1998, 2000-2004 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 65efb5159af19d916ffe003a68d3073de0a7ee10..37674d7423bfef876e1cc2dd1e53778f08d88f5f 100644 (file)
@@ -4,19 +4,30 @@ dnl  number and add the result to a n limb vector.
 dnl  Copyright 2002, 2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/sparc64/ultrasparc1234/lshift.asm b/mpn/sparc64/ultrasparc1234/lshift.asm
deleted file mode 100644 (file)
index 5fa7025..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-dnl  SPARC v9 mpn_lshift
-
-dnl  Copyright 1996, 2000, 2001, 2002, 2003, 2010 Free Software Foundation,
-dnl  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 UltraSPARC 1&2:     2
-C UltraSPARC 3:              2.5
-
-C INPUT PARAMETERS
-define(`rp', `%i0')
-define(`up', `%i1')
-define(`n',  `%i2')
-define(`cnt',`%i3')
-
-define(`u0', `%l0')
-define(`u1', `%l2')
-define(`u2', `%l4')
-define(`u3', `%l6')
-
-define(`tnc',`%i4')
-
-define(`fanop',`fitod %f0,%f2')                dnl  A quasi nop running in the FA pipe
-
-ASM_START()
-       REGISTER(%g2,#scratch)
-       REGISTER(%g3,#scratch)
-PROLOGUE(mpn_lshift)
-       save    %sp,-160,%sp
-
-       sllx    n,3,%g1
-       sub     %g0,cnt,tnc             C negate shift count
-       add     up,%g1,up               C make %o1 point at end of src
-       add     rp,%g1,rp               C make %o0 point at end of res
-       ldx     [up-8],u3               C load first limb
-       subcc   n,5,n
-       srlx    u3,tnc,%i5              C compute function result
-       bl,pn   %xcc,.Lend1234
-       sllx    u3,cnt,%g3
-
-       subcc   n,4,n
-       ldx     [up-16],u0
-       ldx     [up-24],u1
-       add     up,-32,up
-       ldx     [up-0],u2
-       ldx     [up-8],u3
-
-       bl,pn   %xcc,.Lend5678
-       srlx    u0,tnc,%g2
-
-       b,a     .Loop
-       ALIGN(16)
-.Loop:
-       sllx    u0,cnt,%g1
-       or      %g3,%g2,%g3
-       ldx     [up-16],u0
-       fanop
-C --
-       srlx    u1,tnc,%g2
-       subcc   n,4,n
-       stx     %g3,[rp-8]
-       fanop
-C --
-       sllx    u1,cnt,%g3
-       or      %g1,%g2,%g1
-       ldx     [up-24],u1
-       fanop
-C --
-       srlx    u2,tnc,%g2
-       stx     %g1,[rp-16]
-       add     up,-32,up
-       fanop
-C --
-       sllx    u2,cnt,%g1
-       or      %g3,%g2,%g3
-       ldx     [up-0],u2
-       fanop
-C --
-       srlx    u3,tnc,%g2
-       stx     %g3,[rp-24]
-       add     rp,-32,rp
-       fanop
-C --
-       sllx    u3,cnt,%g3
-       or      %g1,%g2,%g1
-       ldx     [up-8],u3
-       fanop
-C --
-       srlx    u0,tnc,%g2
-       stx     %g1,[rp-0]
-       bge,pt  %xcc,.Loop
-       fanop
-C --
-.Lend5678:
-       sllx    u0,cnt,%g1
-       or      %g3,%g2,%g3
-       srlx    u1,tnc,%g2
-       stx     %g3,[rp-8]
-       sllx    u1,cnt,%g3
-       or      %g1,%g2,%g1
-       srlx    u2,tnc,%g2
-       stx     %g1,[rp-16]
-       sllx    u2,cnt,%g1
-       or      %g3,%g2,%g3
-       srlx    u3,tnc,%g2
-       stx     %g3,[rp-24]
-       add     rp,-32,rp
-       sllx    u3,cnt,%g3              C carry...
-       or      %g1,%g2,%g1
-       stx     %g1,[rp-0]
-
-.Lend1234:
-       addcc   n,4,n
-       bz,pn   %xcc,.Lret
-       fanop
-.Loop0:
-       add     rp,-8,rp
-       subcc   n,1,n
-       ldx     [up-16],u3
-       add     up,-8,up
-       srlx    u3,tnc,%g2
-       or      %g3,%g2,%g3
-       stx     %g3,[rp]
-       sllx    u3,cnt,%g3
-       bnz,pt  %xcc,.Loop0
-       fanop
-.Lret:
-       stx     %g3,[rp-8]
-       mov     %i5,%i0
-       ret
-       restore
-EPILOGUE(mpn_lshift)
index 09fe652ade4101e4c56fdc45f739ed71b04b07e5..47286d569e75d77173037b99940acd2049b52e1c 100644 (file)
@@ -1,28 +1,38 @@
 dnl  SPARC v9 mpn_lshiftc
 
-dnl  Copyright 1996, 2000, 2001, 2002, 2003, 2010 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 1996, 2000-2003, 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
 
 C                 cycles/limb
-C UltraSPARC 1&2:     ?
+C UltraSPARC 1&2:     3
 C UltraSPARC 3:              2.67
 
 C INPUT PARAMETERS
index 752abc89d7380dce92524168a6a1cbede9e2b308..871d562fcb2209cc6c19ec4c8c5416b94daaa0f7 100644 (file)
@@ -1,22 +1,33 @@
 dnl  SPARC v9 64-bit mpn_mul_1 -- Multiply a limb vector with a limb and store
 dnl  the result in a second limb vector.
 
-dnl  Copyright 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+dnl  Copyright 1998, 2000-2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/sparc64/ultrasparc1234/rshift.asm b/mpn/sparc64/ultrasparc1234/rshift.asm
deleted file mode 100644 (file)
index aeba31a..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-dnl  SPARC v9 mpn_rshift
-
-dnl  Copyright 1996, 2000, 2001, 2002, 2003, 2010 Free Software Foundation,
-dnl  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 UltraSPARC 1&2:     2
-C UltraSPARC 3:              2.5       (for some up/rp alignments)
-
-C INPUT PARAMETERS
-define(`rp', `%i0')
-define(`up', `%i1')
-define(`n',  `%i2')
-define(`cnt',`%i3')
-
-define(`u0', `%l0')
-define(`u1', `%l2')
-define(`u2', `%l4')
-define(`u3', `%l6')
-
-define(`tnc',`%i4')
-
-define(`fanop',`fitod %f0,%f2')                dnl  A quasi nop running in the FA pipe
-
-ASM_START()
-       REGISTER(%g2,#scratch)
-       REGISTER(%g3,#scratch)
-PROLOGUE(mpn_rshift)
-       save    %sp,-160,%sp
-
-       sub     %g0,cnt,tnc             C negate shift count
-       ldx     [up],u3                 C load first limb
-       subcc   n,5,n
-       sllx    u3,tnc,%i5              C compute function result
-       bl,pn   %xcc,.Lend1234
-       srlx    u3,cnt,%g3
-
-       subcc   n,4,n
-       ldx     [up+8],u0
-       ldx     [up+16],u1
-       add     up,32,up
-       ldx     [up-8],u2
-       ldx     [up+0],u3
-
-       bl,pn   %xcc,.Lend5678
-       sllx    u0,tnc,%g2
-
-       b,a     .Loop
-       ALIGN(16)
-.Loop:
-       srlx    u0,cnt,%g1
-       or      %g3,%g2,%g3
-       ldx     [up+8],u0
-       fanop
-C --
-       sllx    u1,tnc,%g2
-       subcc   n,4,n
-       stx     %g3,[rp+0]
-       fanop
-C --
-       srlx    u1,cnt,%g3
-       or      %g1,%g2,%g1
-       ldx     [up+16],u1
-       fanop
-C --
-       sllx    u2,tnc,%g2
-       stx     %g1,[rp+8]
-       add     up,32,up
-       fanop
-C --
-       srlx    u2,cnt,%g1
-       or      %g3,%g2,%g3
-       ldx     [up-8],u2
-       fanop
-C --
-       sllx    u3,tnc,%g2
-       stx     %g3,[rp+16]
-       add     rp,32,rp
-       fanop
-C --
-       srlx    u3,cnt,%g3
-       or      %g1,%g2,%g1
-       ldx     [up+0],u3
-       fanop
-C --
-       sllx    u0,tnc,%g2
-       stx     %g1,[rp-8]
-       bge,pt  %xcc,.Loop
-       fanop
-C --
-.Lend5678:
-       srlx    u0,cnt,%g1
-       or      %g3,%g2,%g3
-       sllx    u1,tnc,%g2
-       stx     %g3,[rp+0]
-       srlx    u1,cnt,%g3
-       or      %g1,%g2,%g1
-       sllx    u2,tnc,%g2
-       stx     %g1,[rp+8]
-       srlx    u2,cnt,%g1
-       or      %g3,%g2,%g3
-       sllx    u3,tnc,%g2
-       stx     %g3,[rp+16]
-       add     rp,32,rp
-       srlx    u3,cnt,%g3              C carry...
-       or      %g1,%g2,%g1
-       stx     %g1,[rp-8]
-
-.Lend1234:
-       addcc   n,4,n
-       bz,pn   %xcc,.Lret
-       fanop
-.Loop0:
-       add     rp,8,rp
-       subcc   n,1,n
-       ldx     [up+8],u3
-       add     up,8,up
-       sllx    u3,tnc,%g2
-       or      %g3,%g2,%g3
-       stx     %g3,[rp-8]
-       srlx    u3,cnt,%g3
-       bnz,pt  %xcc,.Loop0
-       fanop
-.Lret:
-       stx     %g3,[rp+0]
-       mov     %i5,%i0
-       ret
-       restore
-EPILOGUE(mpn_rshift)
index fbbb4ff45691129a20f89f33a4494655f2423113..43c69d31d120fad62a2753b1a08043f09385c2c5 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 64-bit mpn_sqr_diagonal.
 dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d49245ad206390b21abe599d356c5b67b8af6cda..9fb7f70747572280c19a09fc6322be0b3c26157f 100644 (file)
@@ -1,22 +1,33 @@
 dnl  SPARC v9 mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
 dnl  store difference in a third limb vector.
 
-dnl  Copyright 2001, 2002, 2003, 2011 Free Software Foundation, Inc.
+dnl  Copyright 2001-2003, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -84,7 +95,7 @@ L(com):
        ldx     [vp-8],v3
        subcc   n,8,n
        sub     u0,v0,%g1       C main sub
-       sub     %g1,cy,%g4      C carry sub
+       sub     %g1,cy,%g5      C carry sub
        orn     u0,v0,%g2
        bl,pn   %xcc,.Lend4567
        fanop
@@ -92,7 +103,7 @@ L(com):
 
        .align  16
 C START MAIN LOOP
-.Loop: orn     %g4,%g2,%g2
+.Loop: orn     %g5,%g2,%g2
        andn    u0,v0,%g3
        ldx     [up+0],u0
        fanop
@@ -104,15 +115,15 @@ C --
 C --
        srlx    %g2,63,cy
        sub     u1,v1,%g1
-       stx     %g4,[rp+0]
+       stx     %g5,[rp+0]
        fanop
 C --
-       sub     %g1,cy,%g4
+       sub     %g1,cy,%g5
        orn     u1,v1,%g2
        fmnop
        fanop
 C --
-       orn     %g4,%g2,%g2
+       orn     %g5,%g2,%g2
        andn    u1,v1,%g3
        ldx     [up-24],u1
        fanop
@@ -124,15 +135,15 @@ C --
 C --
        srlx    %g2,63,cy
        sub     u2,v2,%g1
-       stx     %g4,[rp+8]
+       stx     %g5,[rp+8]
        fanop
 C --
-       sub     %g1,cy,%g4
+       sub     %g1,cy,%g5
        orn     u2,v2,%g2
        fmnop
        fanop
 C --
-       orn     %g4,%g2,%g2
+       orn     %g5,%g2,%g2
        andn    u2,v2,%g3
        ldx     [up-16],u2
        fanop
@@ -144,15 +155,15 @@ C --
 C --
        srlx    %g2,63,cy
        sub     u3,v3,%g1
-       stx     %g4,[rp-16]
+       stx     %g5,[rp-16]
        fanop
 C --
-       sub     %g1,cy,%g4
+       sub     %g1,cy,%g5
        orn     u3,v3,%g2
        fmnop
        fanop
 C --
-       orn     %g4,%g2,%g2
+       orn     %g5,%g2,%g2
        andn    u3,v3,%g3
        ldx     [up-8],u3
        fanop
@@ -164,45 +175,45 @@ C --
 C --
        srlx    %g2,63,cy
        sub     u0,v0,%g1
-       stx     %g4,[rp-8]
+       stx     %g5,[rp-8]
        fanop
 C --
-       sub     %g1,cy,%g4
+       sub     %g1,cy,%g5
        orn     u0,v0,%g2
        bge,pt  %xcc,.Loop
        fanop
 C END MAIN LOOP
 .Lend4567:
-       orn     %g4,%g2,%g2
+       orn     %g5,%g2,%g2
        andn    u0,v0,%g3
        andn    %g2,%g3,%g2
        srlx    %g2,63,cy
        sub     u1,v1,%g1
-       stx     %g4,[rp+0]
-       sub     %g1,cy,%g4
+       stx     %g5,[rp+0]
+       sub     %g1,cy,%g5
        orn     u1,v1,%g2
-       orn     %g4,%g2,%g2
+       orn     %g5,%g2,%g2
        andn    u1,v1,%g3
        andn    %g2,%g3,%g2
        srlx    %g2,63,cy
        sub     u2,v2,%g1
-       stx     %g4,[rp+8]
-       sub     %g1,cy,%g4
+       stx     %g5,[rp+8]
+       sub     %g1,cy,%g5
        orn     u2,v2,%g2
-       orn     %g4,%g2,%g2
+       orn     %g5,%g2,%g2
        andn    u2,v2,%g3
        andn    %g2,%g3,%g2
        add     rp,32,rp
        srlx    %g2,63,cy
        sub     u3,v3,%g1
-       stx     %g4,[rp-16]
-       sub     %g1,cy,%g4
+       stx     %g5,[rp-16]
+       sub     %g1,cy,%g5
        orn     u3,v3,%g2
-       orn     %g4,%g2,%g2
+       orn     %g5,%g2,%g2
        andn    u3,v3,%g3
        andn    %g2,%g3,%g2
        srlx    %g2,63,cy
-       stx     %g4,[rp-8]
+       stx     %g5,[rp-8]
 
        addcc   n,4,n
        bz,pn   %xcc,.Lret
@@ -216,10 +227,10 @@ C END MAIN LOOP
        subcc   n,1,n
        sub     u0,v0,%g1
        orn     u0,v0,%g2
-       sub     %g1,cy,%g4
+       sub     %g1,cy,%g5
        andn    u0,v0,%g3
-       orn     %g4,%g2,%g2
-       stx     %g4,[rp-8]
+       orn     %g5,%g2,%g2
+       stx     %g5,[rp-8]
        andn    %g2,%g3,%g2
        bnz,pt  %xcc,.Loop0
        srlx    %g2,63,cy
index ba9120031564d184b72542b2a9ece089fb59c26f..0bdb566b9f3cad499def04542688d994bf683080 100644 (file)
@@ -1,22 +1,33 @@
 dnl  SPARC v9 64-bit mpn_submul_1 -- Multiply a limb vector with a limb and
 dnl  subtract the result from a second limb vector.
 
-dnl  Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+dnl  Copyright 2001-2003 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index afd75aff7924e3bd6fb02b7ed404b0c0b6c64d94..0c525bbdcf5d95b0cd98f5302f0cce11eb0dc841 100644 (file)
 /* ultrasparc3/4 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 2006, 2008, 2009,
-2010 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2002, 2004, 2006, 2008-2010, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 /* 1593 MHz ultrasparc3 running Solaris 10 (swift.nada.kth.se) */
+/* FFT tuning limit = 60000000 */
+/* Generated by tuneup.c, 2014-03-14, gcc 3.4 */
 
 #define DIVREM_1_NORM_THRESHOLD              0  /* 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         10
+#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        20
 #define MOD_1_2_TO_MOD_1_4_THRESHOLD         0  /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD     29
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD     25
 #define USE_PREINV_DIVREM_1                  1
+#define DIV_QR_1N_PI1_METHOD                 1
+#define DIV_QR_1_NORM_THRESHOLD              2
+#define DIV_QR_1_UNNORM_THRESHOLD            1
 #define DIV_QR_2_PI2_THRESHOLD           MP_SIZE_T_MAX  /* never */
 #define DIVEXACT_1_THRESHOLD                 0  /* always */
 #define BMOD_1_TO_MOD_1_THRESHOLD        MP_SIZE_T_MAX  /* never */
 
-#define MUL_TOOM22_THRESHOLD                30
+#define MUL_TOOM22_THRESHOLD                28
 #define MUL_TOOM33_THRESHOLD                93
 #define MUL_TOOM44_THRESHOLD               139
 #define MUL_TOOM6H_THRESHOLD               165
 #define MUL_TOOM8H_THRESHOLD               278
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD      86
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     105
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD      93
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD     104
 #define MUL_TOOM42_TO_TOOM53_THRESHOLD      85
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD      68
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD      51
 #define MUL_TOOM43_TO_TOOM54_THRESHOLD      67
 
-#define SQR_BASECASE_THRESHOLD               9
-#define SQR_TOOM2_THRESHOLD                 72
-#define SQR_TOOM3_THRESHOLD                 94
-#define SQR_TOOM4_THRESHOLD                184
-#define SQR_TOOM6_THRESHOLD                  0  /* always */
+#define SQR_BASECASE_THRESHOLD               7
+#define SQR_TOOM2_THRESHOLD                 71
+#define SQR_TOOM3_THRESHOLD                 98
+#define SQR_TOOM4_THRESHOLD                175
+#define SQR_TOOM6_THRESHOLD                190
 #define SQR_TOOM8_THRESHOLD                339
 
 #define MULMID_TOOM42_THRESHOLD             40
 
-#define MULMOD_BNM1_THRESHOLD               13
+#define MULMOD_BNM1_THRESHOLD               15
 #define SQRMOD_BNM1_THRESHOLD                9
 
-#define MUL_FFT_MODF_THRESHOLD             212  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             220  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    212, 5}, {     13, 6}, {     17, 7}, {      9, 6}, \
+  { {    220, 5}, {     13, 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, 9}, {     83,10}, {     47, 9}, {     95, 8}, \
-    {    191, 7}, {    383, 9}, {     99,10}, {     55,11}, \
-    {     31,10}, {     63, 9}, {    127, 8}, {    255,10}, \
-    {     71, 9}, {    143, 8}, {    287,10}, {     79, 9}, \
+    {     31, 9}, {     63, 8}, {    127, 7}, {    255, 9}, \
+    {     67,10}, {     39, 9}, {     79, 8}, {    159, 9}, \
+    {     83,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, 9}, \
     {    159, 8}, {    319,11}, {     47,10}, {     95, 9}, \
     {    191, 8}, {    383,10}, {    103, 9}, {    207, 8}, \
     {    415,10}, {    111,12}, {     31,11}, {     63,10}, \
-    {    127, 9}, {    255,10}, {    143, 9}, {    287,11}, \
-    {     79,10}, {    159, 9}, {    319, 8}, {    639,10}, \
-    {    175, 9}, {    351,11}, {     95,10}, {    191, 9}, \
-    {    383,10}, {    207, 9}, {    415,11}, {    111,10}, \
-    {    223, 9}, {    447,12}, {     63,11}, {    127,10}, \
-    {    255,11}, {    143,10}, {    287, 9}, {    575,11}, \
-    {    159,10}, {    319,11}, {    175,10}, {    351,12}, \
+    {    127, 9}, {    255,10}, {    143, 9}, {    287, 8}, \
+    {    575,11}, {     79,10}, {    175, 9}, {    351,11}, \
+    {     95,10}, {    191, 9}, {    383,10}, {    207, 9}, \
+    {    415,11}, {    111,10}, {    223,12}, {     63,11}, \
+    {    127,10}, {    255,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,10}, \
     {    415,11}, {    223,10}, {    447,13}, {     63,12}, \
     {    127,11}, {    287,10}, {    575,12}, {    159,11}, \
     {    351,10}, {    703,12}, {    191,11}, {    415,12}, \
-    {    223,11}, {    479,10}, {    959,13}, {    127,12}, \
-    {    287,11}, {    575,12}, {    351,13}, {    191,12}, \
-    {    479,14}, {    127,13}, {    255,12}, {    575,13}, \
-    {    319,12}, {    639,11}, {   1279,12}, {    703,13}, \
+    {    223,11}, {    479,13}, {    127,12}, {    287,11}, \
+    {    575,12}, {    351,13}, {    191,12}, {    415,11}, \
+    {    831,12}, {    479,14}, {    127,13}, {    255,12}, \
+    {    575,13}, {    319,12}, {    703,11}, {   1407,13}, \
     {    383,12}, {    831,13}, {    447,12}, {    895,14}, \
-    {    255,13}, {    511,12}, {   1087,13}, {    575,12}, \
-    {   1215,13}, {    639,12}, {   1279,13}, {    703,14}, \
-    {    383,13}, {    831,12}, {   1663,13}, {    895,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}, {   2303,14}, {   1407,15}, {    767,14}, \
-    {   1791,16}, {    511,15}, {   1023,14}, {   2303,15}, \
-    {   1279,14}, {   2815,15}, {   1535,14}, {   3199,15}, \
-    {   1791,14}, {   3583,16}, {  65536,17}, { 131072,18}, \
-    { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
-    {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 170
-#define MUL_FFT_THRESHOLD                 1984
-
-#define SQR_FFT_MODF_THRESHOLD             236  /* k = 5 */
+    {    255,13}, {    511,12}, {   1023,13}, {    575,12}, \
+    {   1215,13}, {    703,14}, {    383,13}, {    831,12}, \
+    {   1663,13}, {    895,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}, {   2303,14}, \
+    {   1407,15}, {    767,14}, {   1791,16}, {    511,15}, \
+    {   1023,14}, {   2303,15}, {   1279,14}, {   2815,15}, \
+    {   1535,14}, {   3199,15}, {   1791,14}, {   3583,16}, \
+    {  65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
+    {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 172
+#define MUL_FFT_THRESHOLD                 2240
+
+#define SQR_FFT_MODF_THRESHOLD             244  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    244, 5}, {      8, 4}, {     17, 5}, {     17, 6}, \
-    {     17, 7}, {      9, 6}, {     19, 7}, {     17, 8}, \
+  { {    244, 5}, {      8, 4}, {     17, 5}, {     15, 6}, \
+    {      8, 5}, {     17, 6}, {     17, 7}, {      9, 6}, \
+    {     19, 7}, {     10, 6}, {     21, 7}, {     17, 8}, \
     {      9, 7}, {     20, 8}, {     11, 7}, {     23, 8}, \
     {     21, 9}, {     11, 8}, {     25, 9}, {     15, 8}, \
     {     31, 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}, {     55,11}, {     31,10}, {     63, 9}, \
-    {    127, 8}, {    255,10}, {     71, 9}, {    143, 8}, \
-    {    287,10}, {     79, 9}, {    159,11}, {     47,10}, \
-    {     95, 9}, {    191, 8}, {    383,12}, {     31,11}, \
-    {     63,10}, {    127, 9}, {    255, 8}, {    511,10}, \
-    {    135, 9}, {    271,10}, {    143, 9}, {    287,11}, \
-    {     79,10}, {    159, 9}, {    319, 8}, {    639,10}, \
-    {    175, 9}, {    351, 8}, {    703,11}, {     95,10}, \
+    {     79,10}, {     47, 9}, {     95,10}, {     55,11}, \
+    {     31,10}, {     63, 9}, {    127, 8}, {    255,10}, \
+    {     71, 9}, {    143, 8}, {    287, 7}, {    575,10}, \
+    {     79, 9}, {    159, 8}, {    319,11}, {     47, 9}, \
+    {    191, 8}, {    383, 7}, {    767, 9}, {    207,12}, \
+    {     31,11}, {     63,10}, {    127, 9}, {    255, 8}, \
+    {    511, 9}, {    271,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, 8}, {    831,10}, {    223, 9}, {    447,12}, \
-    {     63,11}, {    127,10}, {    271, 9}, {    543,11}, \
-    {    143,10}, {    287, 9}, {    575, 8}, {   1151, 9}, \
-    {    607,11}, {    159,10}, {    319, 9}, {    639,11}, \
-    {    175,10}, {    351, 9}, {    703, 8}, {   1407,12}, \
-    {     95,11}, {    191,10}, {    383,11}, {    207,10}, \
-    {    415, 9}, {    831,11}, {    223,10}, {    447,13}, \
-    {     63,12}, {    127,11}, {    271,10}, {    543,11}, \
-    {    287,10}, {    575, 9}, {   1151,10}, {    607,12}, \
-    {    159,11}, {    319,10}, {    639,11}, {    351,10}, \
-    {    703,12}, {    191,11}, {    415,10}, {    831,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}, \
-    {    415,11}, {    831,12}, {    479,11}, {    959,14}, \
-    {    127,13}, {    255,12}, {    543,11}, {   1087,12}, \
-    {    575,13}, {    319,12}, {    639,11}, {   1279,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}, {    959,15}, {    255,14}, \
-    {    511,13}, {   1087,12}, {   2175,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}, \
-    {   2303,15}, {   1279,14}, {   2815,15}, {   1535,14}, \
-    {   3199,15}, {   1791,16}, {  65536,17}, { 131072,18}, \
-    { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
-    {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 182
+    {    415, 8}, {    831,10}, {    223, 9}, {    447, 8}, \
+    {    895,12}, {     63,11}, {    127,10}, {    271,11}, \
+    {    143,10}, {    287, 9}, {    575, 8}, {   1215,11}, \
+    {    159,10}, {    319, 9}, {    639,11}, {    175,10}, \
+    {    351, 9}, {    703,11}, {    191,10}, {    383,11}, \
+    {    207,10}, {    415, 9}, {    831, 8}, {   1663,10}, \
+    {    447,13}, {     63,12}, {    127,11}, {    271,10}, \
+    {    543, 9}, {   1087,11}, {    287,10}, {    575, 9}, \
+    {   1151,12}, {    159,11}, {    319,10}, {    639,11}, \
+    {    351,10}, {    703,12}, {    191,11}, {    415,10}, \
+    {    831,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}, {    415,11}, {    831,12}, {    479,14}, \
+    {    127,13}, {    255,12}, {    607,13}, {    319,12}, \
+    {    703,11}, {   1407,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}, {    895,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}, {   2303,14}, \
+    {   1407,15}, {    767,14}, {   1791,16}, {    511,15}, \
+    {   1023,14}, {   2303,15}, {   1279,14}, {   2815,15}, \
+    {   1535,14}, {   3199,15}, {   1791,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                 1728
 
-#define MULLO_BASECASE_THRESHOLD            12
+#define MULLO_BASECASE_THRESHOLD            19
 #define MULLO_DC_THRESHOLD                   0  /* never mpn_mullo_basecase */
-#define MULLO_MUL_N_THRESHOLD             3791
+#define MULLO_MUL_N_THRESHOLD             4392
 
-#define DC_DIV_QR_THRESHOLD                 16
-#define DC_DIVAPPR_Q_THRESHOLD              66
-#define DC_BDIV_QR_THRESHOLD                27
+#define DC_DIV_QR_THRESHOLD                 15
+#define DC_DIVAPPR_Q_THRESHOLD              64
+#define DC_BDIV_QR_THRESHOLD                29
 #define DC_BDIV_Q_THRESHOLD                 86
 
-#define INV_MULMOD_BNM1_THRESHOLD           58
-#define INV_NEWTON_THRESHOLD                16
+#define INV_MULMOD_BNM1_THRESHOLD           54
+#define INV_NEWTON_THRESHOLD                17
 #define INV_APPR_THRESHOLD                  17
 
-#define BINV_NEWTON_THRESHOLD              110
+#define BINV_NEWTON_THRESHOLD              111
 #define REDC_1_TO_REDC_2_THRESHOLD           0  /* always */
 #define REDC_2_TO_REDC_N_THRESHOLD         115
 
-#define MU_DIV_QR_THRESHOLD                618
-#define MU_DIVAPPR_Q_THRESHOLD             551
+#define MU_DIV_QR_THRESHOLD                680
+#define MU_DIVAPPR_Q_THRESHOLD             618
 #define MUPI_DIV_QR_THRESHOLD                0  /* always */
-#define MU_BDIV_QR_THRESHOLD               562
-#define MU_BDIV_Q_THRESHOLD                748
+#define MU_BDIV_QR_THRESHOLD               680
+#define MU_BDIV_Q_THRESHOLD                807
 
-#define POWM_SEC_TABLE  4,23,130,961,1926
+#define POWM_SEC_TABLE  1,16,102,386,1985,2079
 
 #define MATRIX22_STRASSEN_THRESHOLD         12
-#define HGCD_THRESHOLD                      39
+#define HGCD_THRESHOLD                      46
 #define HGCD_APPR_THRESHOLD                 50
 #define HGCD_REDUCE_THRESHOLD             1012
-#define GCD_DC_THRESHOLD                   134
-#define GCDEXT_DC_THRESHOLD                132
+#define GCD_DC_THRESHOLD                   124
+#define GCDEXT_DC_THRESHOLD                138
 #define JACOBI_BASE_METHOD                   4
 
-#define GET_STR_DC_THRESHOLD                19
+#define GET_STR_DC_THRESHOLD                20
 #define GET_STR_PRECOMPUTE_THRESHOLD        28
-#define SET_STR_DC_THRESHOLD               300
+#define SET_STR_DC_THRESHOLD               324
 #define SET_STR_PRECOMPUTE_THRESHOLD      1043
 
-#define FAC_DSC_THRESHOLD                  462
+#define FAC_DSC_THRESHOLD                  422
 #define FAC_ODD_THRESHOLD                    0  /* always */
index 9dc0bf2fd20bc3444264da268e74cd4753dfd707..954c7f6d357287c22fa89fd387442aed1a4a0a85 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 mpn_add_n for T1/T2.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 4c25cac29d9986b737eeba6c200a6ca107294d70..313479773fd4c8d8ceedb0d74e6234abd1bec447 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 mpn_addlsh1_n for T1/T2.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 5b3e6138382f8d48cfd272c871278fb9f1132dd9..ee1afd011602a2aded80974bd7912f34e7cc1572 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 mpn_addlsh2_n for T1/T2.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 010e6c7be5c92ee8271ba58f57e4c27fe8396056..5be9a0d30aafd7e7d811c2df4b91f96922423544 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 mpn_addlshC_n for T1/T2.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 C                 cycles/limb
 C UltraSPARC T1:       21
index 6b2b2c298e92ba6ca40ac1e13730305d035a2879..29dba966f3d1a89b75ca9fd68f504151063d42e3 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 mpn_addmul_1 for T1/T2.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index b071b5afb8fd89e644eb844b40cf13fdf2b3993b..99db78ac0f22d3bddc9d0fc96ff672851b67e436 100644 (file)
@@ -1,25 +1,36 @@
 /* Sparc64 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 2006, 2008, 2009,
-2010 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2002, 2004, 2006, 2008-2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 /* 1000 MHz ultrasparc t1 running GNU/Linux */
 
diff --git a/mpn/sparc64/ultrasparct1/lshift.asm b/mpn/sparc64/ultrasparct1/lshift.asm
deleted file mode 100644 (file)
index 2729a40..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-dnl  SPARC v9 mpn_lshift for T1/T2.
-
-dnl  Copyright 2010 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 UltraSPARC T1:       17
-C UltraSPARC T2:        ?
-
-C INPUT PARAMETERS
-define(`rp', `%o0')
-define(`up', `%o1')
-define(`vp', `%o2')
-define(`n',  `%o3')
-define(`cy', `%o4')
-
-ASM_START()
-       REGISTER(%g2,#scratch)
-       REGISTER(%g3,#scratch)
-PROLOGUE(mpn_lshift)
-       add     %o1, -8, %o1
-       add     %o0, 8, %g1
-       sllx    %o2, 3, %g5
-       sub     %g0, %o3, %o4
-       ldx     [%o1+%g5], %g2
-       add     %g5, -8, %g5
-       brz,pn  %g5, L(end)
-       sllx    %g2, %o3, %g4
-
-L(top):        ldx     [%o1+%g5], %o5
-       nop
-       add     %g5, -8, %g5
-       srlx    %o5, %o4, %g3
-       or      %g4, %g3, %g3
-       sllx    %o5, %o3, %g4
-       stx     %g3, [%g1+%g5]
-       brnz    %g5, L(top)
-       nop
-
-L(end):        stx     %g4, [%g1-8]
-       retl
-        srlx   %g2, %o4, %o0
-EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct1/lshiftc.asm b/mpn/sparc64/ultrasparct1/lshiftc.asm
deleted file mode 100644 (file)
index d645af7..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-dnl  SPARC v9 mpn_lshiftc for T1/T2.
-
-dnl  Copyright 2010 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 UltraSPARC T1:       17
-C UltraSPARC T2:        ?
-
-C INPUT PARAMETERS
-define(`rp', `%o0')
-define(`up', `%o1')
-define(`vp', `%o2')
-define(`n',  `%o3')
-define(`cy', `%o4')
-
-ASM_START()
-       REGISTER(%g2,#scratch)
-       REGISTER(%g3,#scratch)
-PROLOGUE(mpn_lshiftc)
-       add     %o1, -8, %o1
-       add     %o0, 8, %g1
-       sllx    %o2, 3, %g5
-       sub     %g0, %o3, %o4
-       ldx     [%o1+%g5], %g2
-       add     %g5, -8, %g5
-       brz,pn  %g5, L(end)
-       sllx    %g2, %o3, %g4
-
-L(top):        ldx     [%o1+%g5], %o5
-       not     %g4
-       add     %g5, -8, %g5
-       srlx    %o5, %o4, %g3
-       andn    %g4, %g3, %g3
-       sllx    %o5, %o3, %g4
-       stx     %g3, [%g1+%g5]
-       brnz    %g5, L(top)
-       nop
-
-L(end):        not     %g4
-       stx     %g4, [%g1-8]
-       retl
-        srlx   %g2, %o4, %o0
-EPILOGUE()
index fa2ae44fe550f91b160804d383352aa24181c32e..1fea2a19ef9c60311de43cc61855fcecdb05a677 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 mpn_mul_1 for T1/T2.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 8493bff5349ec8d765d65e2759508122b3c2f437..51bd4ab45b8f70b46ac0abfd329ab0d5642691c5 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 mpn_rsblsh1_n for T1/T2.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index ea2498ab6b0343b77dc0b0f5672a0fa7524f1bcb..f0d208e198f9ed40713835a9066d45ac74e35642 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 mpn_rsblsh2_n for T1/T2.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index df18c4f20529b1b76477c0511e068ca6429faee4..7c03e9f97f294d800be5ca43d56a63dcdbd0048e 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 mpn_rsblshC_n for T1/T2.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 C                 cycles/limb
 C UltraSPARC T1:       21
diff --git a/mpn/sparc64/ultrasparct1/rshift.asm b/mpn/sparc64/ultrasparct1/rshift.asm
deleted file mode 100644 (file)
index b5f5be7..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-dnl  SPARC v9 mpn_rshift for T1/T2.
-
-dnl  Copyright 2010 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 UltraSPARC T1:       17
-C UltraSPARC T2:        ?
-
-C INPUT PARAMETERS
-define(`rp', `%o0')
-define(`up', `%o1')
-define(`vp', `%o2')
-define(`n',  `%o3')
-define(`cy', `%o4')
-
-ASM_START()
-       REGISTER(%g2,#scratch)
-       REGISTER(%g3,#scratch)
-PROLOGUE(mpn_rshift)
-       add     %o1, 0, %o1
-       add     %o0, -16, %g1
-       sllx    %o2, 3, %g5
-       add     %o1, %g5, %o1
-       add     %g1, %g5, %g1
-       neg     %g5
-       sub     %g0, %o3, %o4
-       ldx     [%o1+%g5], %g2
-       add     %g5, 8, %g5
-       brz,pn  %g5, L(end)
-       srlx    %g2, %o3, %g4
-
-L(top):        ldx     [%o1+%g5], %o5
-       add     %g5, 8, %g5
-       sllx    %o5, %o4, %g3
-       or      %g4, %g3, %g3
-       srlx    %o5, %o3, %g4
-       stx     %g3, [%g1+%g5]
-       brnz    %g5, L(top)
-       nop
-
-L(end):        stx     %g4, [%g1+8]
-       retl
-        sllx   %g2, %o4, %o0
-EPILOGUE()
index 3eb8f1ab15d2074081f39cd4759ff7646877d316..c2af89f08f915ac7f9a3a4e2a237fb340bad89ca 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 mpn_sub_n for T1/T2.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 48498d1f24f18fc4c677975b921a4bb71fe4137a..8c8fa80401e928d9c39ff6a4328119278d287518 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 mpn_sublsh1_n for T1/T2.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index dcf631a9becf994d86e79e23c222a386f66cbf70..2fd5eee71af0e2b3bed2b0b4094989de7af67d53 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 mpn_sublsh2_n for T1/T2.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 85da0f6392ab9222bd47d6e4413b1a227adbe7fb..01eafef1bce7db1803ae74fd09b4dab0a384dba2 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 mpn_sublshC_n for T1/T2.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 C                 cycles/limb
 C UltraSPARC T1:       21
index 9023ea241c3b50fe998b39095e9fe96a2e9ba4a6..4f553a806381c6bdbe926037374824e8b2f21021 100644 (file)
@@ -3,19 +3,30 @@ dnl  SPARC v9 mpn_submul_1 for T1/T2.
 dnl  Copyright 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/sparc64/ultrasparct3/add_n.asm b/mpn/sparc64/ultrasparct3/add_n.asm
new file mode 100644 (file)
index 0000000..0170746
--- /dev/null
@@ -0,0 +1,126 @@
+dnl  SPARC v9 mpn_add_n for T3/T4.
+
+dnl  Contributed to the GNU project by David Miller.
+
+dnl  Copyright 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 UltraSPARC T3:        8
+C UltraSPARC T4:        3
+
+C INPUT PARAMETERS
+define(`rp', `%i0')
+define(`up', `%i1')
+define(`vp', `%i2')
+define(`n',  `%i3')
+define(`cy', `%i4')
+
+define(`u0_off', `%l2')
+define(`u1_off', `%l3')
+define(`loop_n', `%l6')
+define(`tmp', `%l7')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_add_nc)
+       save    %sp, -176, %sp
+       b,a     L(ent)
+EPILOGUE()
+PROLOGUE(mpn_add_n)
+       save    %sp, -176, %sp
+
+       mov     0, cy
+L(ent):
+       subcc   n, 1, n
+       be      L(final_one)
+        cmp    %g0, cy
+
+       ldx     [up + 0], %o4
+       sllx    n, 3, tmp
+
+       ldx     [vp + 0], %o5
+       add     up, tmp, u0_off
+
+       ldx     [up + 8], %g5
+       neg     tmp, loop_n
+
+       ldx     [vp + 8], %g1
+       add     u0_off, 8, u1_off
+
+       sub     loop_n, -(2 * 8), loop_n
+
+       brgez,pn loop_n, L(loop_tail)
+        add    vp, (2 * 8), vp
+
+       b,a     L(top)
+       ALIGN(16)
+L(top):
+       addxccc(%o4, %o5, tmp)
+       ldx     [vp + 0], %o5
+
+       add     rp, (2 * 8), rp
+       ldx     [loop_n + u0_off], %o4
+
+       add     vp, (2 * 8), vp
+       stx     tmp, [rp - 16]
+
+       addxccc(%g1, %g5, tmp)
+       ldx     [vp - 8], %g1
+
+       ldx     [loop_n + u1_off], %g5
+       sub     loop_n, -(2 * 8), loop_n
+
+       brlz    loop_n, L(top)
+        stx    tmp, [rp - 8]
+
+L(loop_tail):
+       addxccc(%o4, %o5, %g3)
+       add     loop_n, u0_off, up
+
+       addxccc(%g1, %g5, %g5)
+       stx     %g3, [rp + 0]
+
+       brgz,pt loop_n, L(done)
+        stx    %g5, [rp + 8]
+
+       add     rp, (2 * 8), rp
+L(final_one):
+       ldx     [up+0], %o4
+       ldx     [vp+0], %o5
+       addxccc(%o4, %o5, %g3)
+       stx     %g3, [rp+0]
+
+L(done):
+       addxc(%g0, %g0, %i0)
+       ret
+        restore
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/addmul_1.asm b/mpn/sparc64/ultrasparct3/addmul_1.asm
new file mode 100644 (file)
index 0000000..939811e
--- /dev/null
@@ -0,0 +1,182 @@
+dnl  SPARC v9 mpn_addmul_1 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  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:       26
+C UltraSPARC T4:       4.5
+
+C INPUT PARAMETERS
+define(`rp', `%i0')
+define(`up', `%i1')
+define(`n',  `%i2')
+define(`v0', `%i3')
+
+define(`u0',  `%l0')
+define(`u1',  `%l1')
+define(`u2',  `%l2')
+define(`u3',  `%l3')
+define(`r0',  `%l4')
+define(`r1',  `%l5')
+define(`r2',  `%l6')
+define(`r3',  `%l7')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_addmul_1)
+       save    %sp, -176, %sp
+       ldx     [up+0], %g1
+
+       and     n, 3, %g3
+       brz     %g3, L(b0)
+        addcc  %g0, %g0, %g5                   C clear carry limb, flag
+       cmp     %g3, 2
+       bcs     %xcc, L(b01)
+        nop
+       be      %xcc, L(b10)
+        ldx    [up+8], %g5
+
+L(b11):        ldx     [up+16], u3
+       mulx    %g1, v0, %o2
+       umulxhi(%g1, v0, %o3)
+       ldx     [rp+0], r1
+       mulx    %g5, v0, %o4
+       ldx     [rp+8], r2
+       umulxhi(%g5, v0, %o5)
+       ldx     [rp+16], r3
+       mulx    u3, v0, %g4
+       umulxhi(u3, v0, %g5)
+       addcc   %o3, %o4, %o4
+       addxccc(%o5, %g4, %g4)
+       addxc(  %g0, %g5, %g5)
+       addcc   r1, %o2, r1
+       stx     r1, [rp+0]
+       addxccc(r2, %o4, r2)
+       stx     r2, [rp+8]
+       addxccc(r3, %g4, r3)
+       stx     r3, [rp+16]
+       add     n, -3, n
+       add     up, 24, up
+       brz     n, L(xit)
+        add    rp, 24, rp
+       b       L(com)
+        nop
+
+L(b10):        mulx    %g1, v0, %o4
+       ldx     [rp+0], r2
+       umulxhi(%g1, v0, %o5)
+       ldx     [rp+8], r3
+       mulx    %g5, v0, %g4
+       umulxhi(%g5, v0, %g5)
+       addcc   %o5, %g4, %g4
+       addxc(  %g0, %g5, %g5)
+       addcc   r2, %o4, r2
+       stx     r2, [rp+0]
+       addxccc(r3, %g4, r3)
+       stx     r3, [rp+8]
+       add     n, -2, n
+       add     up, 16, up
+       brz     n, L(xit)
+        add    rp, 16, rp
+       b       L(com)
+        nop
+
+L(b01):        ldx     [rp+0], r3
+       mulx    %g1, v0, %g4
+       umulxhi(%g1, v0, %g5)
+       addcc   r3, %g4, r3
+       stx     r3, [rp+0]
+       add     n, -1, n
+       add     up, 8, up
+       brz     n, L(xit)
+        add    rp, 8, rp
+
+L(com):        ldx     [up+0], %g1
+L(b0): ldx     [up+8], u1
+       ldx     [up+16], u2
+       ldx     [up+24], u3
+       mulx    %g1, v0, %o0
+       umulxhi(%g1, v0, %o1)
+       b       L(lo0)
+        nop
+
+       ALIGN(16)
+L(top):        ldx     [up+0], u0
+       addxc(  %g0, %g5, %g5)          C propagate carry into carry limb
+       ldx     [up+8], u1
+       addcc   r0, %o0, r0
+       ldx     [up+16], u2
+       addxccc(r1, %o2, r1)
+       ldx     [up+24], u3
+       addxccc(r2, %o4, r2)
+       stx     r0, [rp-32]
+       addxccc(r3, %g4, r3)
+       stx     r1, [rp-24]
+       mulx    u0, v0, %o0
+       stx     r2, [rp-16]
+       umulxhi(u0, v0, %o1)
+       stx     r3, [rp-8]
+L(lo0):        mulx    u1, v0, %o2
+       ldx     [rp+0], r0
+       umulxhi(u1, v0, %o3)
+       ldx     [rp+8], r1
+       mulx    u2, v0, %o4
+       ldx     [rp+16], r2
+       umulxhi(u2, v0, %o5)
+       ldx     [rp+24], r3
+       mulx    u3, v0, %g4
+       addxccc(%g5, %o0, %o0)
+       umulxhi(u3, v0, %g5)
+       add     up, 32, up
+       addxccc(%o1, %o2, %o2)
+       add     rp, 32, rp
+       addxccc(%o3, %o4, %o4)
+       add     n, -4, n
+       addxccc(%o5, %g4, %g4)
+       brgz    n, L(top)
+        nop
+
+       addxc(  %g0, %g5, %g5)
+       addcc   r0, %o0, r0
+       stx     r0, [rp-32]
+       addxccc(r1, %o2, r1)
+       stx     r1, [rp-24]
+       addxccc(r2, %o4, r2)
+       stx     r2, [rp-16]
+       addxccc(r3, %g4, r3)
+       stx     r3, [rp-8]
+L(xit):        addxc(  %g0, %g5, %i0)
+       ret
+        restore
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/aormul_2.asm b/mpn/sparc64/ultrasparct3/aormul_2.asm
new file mode 100644 (file)
index 0000000..ccc6a44
--- /dev/null
@@ -0,0 +1,228 @@
+dnl  SPARC v9 mpn_mul_2 and mpn_addmul_2 for T3/T4/T5.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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      cycles/limb
+C                     mul_2           addmul_2
+C UltraSPARC T3:       22.5             23.5
+C UltraSPARC T4:        3.25            3.75
+
+
+C The code is reasonably scheduled but also relies on OoO.  There was hope that
+C this could run at around 3.0 and 3.5 c/l respectively, on T4.  Two cycles per
+C iteration needs to be removed.
+C
+C We could almost use 2-way unrolling, but currently the wN registers live too
+C long.  By changing add x,w1,w1 to add x,w1,w0, i.e. migrate the values down-
+C wards, 2-way unrolling should become possible.  With n-indexed addressing it
+C should run no slower.
+C
+C The rp loads to g1/g3 are very much over-scheduled.  Presumably, they could
+C be postponed a full way, and then just one register could be used.
+
+C INPUT PARAMETERS
+define(`rp', `%i0')
+define(`up', `%i1')
+define(`n',  `%i2')
+define(`vp', `%i3')
+
+define(`v0', `%o0')
+define(`v1', `%o1')
+
+define(`w0', `%o2')
+define(`w1', `%o3')
+define(`w2', `%o4')
+define(`w3', `%o5')
+
+ifdef(`OPERATION_mul_2',`
+      define(`AM2',      `')
+      define(`ADDX',    `addcc`'$1')
+      define(`func',     `mpn_mul_2')
+')
+ifdef(`OPERATION_addmul_2',`
+      define(`AM2',      `$1')
+      define(`ADDX',    `addxccc($1,$2,$3)')
+      define(`func',     `mpn_addmul_2')
+')
+
+
+MULFUNC_PROLOGUE(mpn_mul_2 mpn_addmul_2)
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(func)
+       save    %sp, -176, %sp
+
+       ldx     [vp+0], v0              C load v0
+       and     n, 3, %g5
+       ldx     [vp+8], v1              C load v1
+       add     n, -6, n
+       ldx     [up+0], %g4
+       brz     %g5, L(b0)
+        cmp    %g5, 2
+       bcs     L(b1)
+        nop
+       be      L(b2)
+        nop
+
+L(b3):
+AM2(`  ldx     [rp+0], %g1')
+       mulx    %g4, v0, w2
+       umulxhi(%g4, v0, w3)
+       ldx     [up+8], %i5
+       mulx    %g4, v1, %l3
+       umulxhi(%g4, v1, %l7)
+AM2(`  ldx     [rp+8], %g3')
+       add     up, -8, up
+       add     rp, -8, rp
+       b       L(lo3)
+        mov    0, w0
+
+L(b2):
+AM2(`  ldx     [rp+0], %g3')
+       mulx    %g4, v0, w3
+       umulxhi(%g4, v0, w0)
+       ldx     [up+8], %i4
+       mulx    %g4, v1, %l1
+       umulxhi(%g4, v1, %l5)
+AM2(`  ldx     [rp+8], %g1')
+       add     rp, 16, rp
+       brlz    n, L(end)
+        mov    0, w1
+       ba      L(top)
+        add    up, 16, up
+
+L(b1):
+AM2(`  ldx     [rp+0], %g1')
+       mulx    %g4, v0, w0
+       umulxhi(%g4, v0, w1)
+       ldx     [up+8], %i5
+       mulx    %g4, v1, %l3
+       umulxhi(%g4, v1, %l7)
+AM2(`  ldx     [rp+8], %g3')
+       add     up, 8, up
+       add     rp, 8, rp
+       b       L(lo1)
+        mov    0, w2
+
+L(b0):
+AM2(`  ldx     [rp+0], %g3')
+       mulx    %g4, v0, w1
+       umulxhi(%g4, v0, w2)
+       ldx     [up+8], %i4
+       mulx    %g4, v1, %l1
+       umulxhi(%g4, v1, %l5)
+AM2(`  ldx     [rp+8], %g1')
+       b       L(lo0)
+        mov    0, w3
+
+       ALIGN(16)                       C cycle
+L(top):        mulx    %i4, v0, %l2            C 0->5
+       umulxhi(%i4, v0, %l6)           C 0->5
+       ldx     [up+0], %i5             C 1->6
+AM2(`  addcc   w3, %g3, w3')           C 1
+       stx     w3, [rp-16]             C 2
+       ADDX(`  %l1, w0, w0')           C 2
+       addxccc(%l5, w1, w1)            C 3
+       mulx    %i4, v1, %l3            C 3->9
+       umulxhi(%i4, v1, %l7)           C 4->9
+AM2(`  ldx     [rp+0], %g3')           C 4
+       addcc   %l2, w0, w0             C 5
+       addxccc(%l6, w1, w1)            C 5
+       addxc(  %g0, %g0, w2)           C 6
+L(lo1):        mulx    %i5, v0, %l0            C 6
+       umulxhi(%i5, v0, %l4)           C 7
+       ldx     [up+8], %i4             C 7
+AM2(`  addcc   w0, %g1, w0')           C 8
+       stx     w0, [rp-8]              C 8
+       ADDX(`  %l3, w1, w1')           C 9
+       addxccc(%l7, w2, w2)            C 9
+       mulx    %i5, v1, %l1            C 10
+       umulxhi(%i5, v1, %l5)           C 10
+AM2(`  ldx     [rp+8], %g1')           C 11
+       addcc   %l0, w1, w1             C 11
+       addxccc(%l4, w2, w2)            C 12
+       addxc(  %g0, %g0, w3)           C 12
+L(lo0):        mulx    %i4, v0, %l2            C 13
+       umulxhi(%i4, v0, %l6)           C 13
+       ldx     [up+16], %i5            C 14
+AM2(`  addcc   w1, %g3, w1')           C 14
+       stx     w1, [rp+0]              C 15
+       ADDX(`  %l1, w2, w2')           C 15
+       addxccc(%l5, w3, w3)            C 16
+       mulx    %i4, v1, %l3            C 16
+       umulxhi(%i4, v1, %l7)           C 17
+AM2(`  ldx     [rp+16], %g3')          C 17
+       addcc   %l2, w2, w2             C 18
+       addxccc(%l6, w3, w3)            C 18
+       addxc(  %g0, %g0, w0)           C 19
+L(lo3):        mulx    %i5, v0, %l0            C 19
+       umulxhi(%i5, v0, %l4)           C 20
+       ldx     [up+24], %i4            C 20
+AM2(`  addcc   w2, %g1, w2')           C 21
+       stx     w2, [rp+8]              C 21
+       ADDX(`  %l3, w3, w3')           C 22
+       addxccc(%l7, w0, w0)            C 22
+       mulx    %i5, v1, %l1            C 23
+       umulxhi(%i5, v1, %l5)           C 23
+AM2(`  ldx     [rp+24], %g1')          C 24
+       addcc   %l0, w3, w3             C 24
+       addxccc(%l4, w0, w0)            C 25
+       addxc(  %g0, %g0, w1)           C 25
+       add     up, 32, up
+       add     rp, 32, rp
+       brgz    n, L(top)
+        add    n, -4, n
+
+L(end):        mulx    %i4, v0, %l2
+       umulxhi(%i4, v0, %l6)
+AM2(`  addcc   w3, %g3, w3')
+       stx     w3, [rp-16]
+       ADDX(`  %l1, w0, w0')
+       addxccc(%l5, w1, w1)
+       mulx    %i4, v1, %l3
+       umulxhi(%i4, v1, %l7)
+       addcc   %l2, w0, w0
+       addxccc(%l6, w1, w1)
+       addxc(  %g0, %g0, w2)
+AM2(`  addcc   w0, %g1, w0')
+       stx     w0, [rp-8]
+       ADDX(`  %l3, w1, w1')
+       stx     w1, [rp+0]
+       addxc(%l7, w2, %i0)
+
+       ret
+        restore
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/aormul_4.asm b/mpn/sparc64/ultrasparct3/aormul_4.asm
new file mode 100644 (file)
index 0000000..845f6d6
--- /dev/null
@@ -0,0 +1,219 @@
+dnl  SPARC v9 mpn_mul_4 and mpn_addmul_4 for T3/T4/T5.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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      cycles/limb
+C                     mul_4           addmul_4
+C UltraSPARC T3:       21.5            22.0
+C UltraSPARC T4:        2.625           2.75
+
+
+C The code is well-scheduled and relies on OoO very little.  There is hope that
+C this will run at around 2.5 and 2.75 c/l respectively, on T4.
+
+define(`rp', `%i0')
+define(`up', `%i1')
+define(`n',  `%i2')
+define(`vp', `%i3')
+
+define(`v0', `%g1')
+define(`v1', `%o7')
+define(`v2', `%g2')
+define(`v3', `%i3')
+
+define(`w0', `%o0')
+define(`w1', `%o1')
+define(`w2', `%o2')
+define(`w3', `%o3')
+define(`w4', `%o4')
+
+define(`r0', `%o5')
+
+define(`u0', `%i4')
+define(`u1', `%i5')
+
+define(`rp0', `rp')
+define(`rp1', `%g3')
+define(`rp2', `%g4')
+define(`up0', `up')
+define(`up1', `%g5')
+
+ifdef(`OPERATION_mul_4',`
+      define(`AM4',      `')
+      define(`ADDX',    `addcc`'$1')
+      define(`func',     `mpn_mul_4')
+')
+ifdef(`OPERATION_addmul_4',`
+      define(`AM4',      `$1')
+      define(`ADDX',    `addxccc($1,$2,$3)')
+      define(`func',     `mpn_addmul_4')
+')
+
+
+MULFUNC_PROLOGUE(mpn_mul_4 mpn_addmul_4)
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(func)
+       save    %sp, -176, %sp
+
+       ldx     [up + 0], u1            C load up[0] early
+       andcc   n, 1, %g0               C is n odd?
+       ldx     [vp + 0], v0
+       sllx    n, 3, n
+       ldx     [vp + 8], v1
+       add     n, -28, n
+       ldx     [vp + 16], v2
+       add     rp, -16, rp
+       ldx     [vp + 24], v3
+       add     up, n, up0
+       add     rp, n, rp0
+       add     up0, 8, up1
+       add     rp0, 8, rp1
+       add     rp0, 16, rp2
+       mulx    u1, v0, %l0
+       mov     0, w0
+       mulx    u1, v1, %l1
+       mov     0, w1
+       mulx    u1, v2, %l2
+       mov     0, w2
+       mulx    u1, v3, %l3
+       mov     0, w3
+
+       be      L(evn)
+        neg    n, n
+
+L(odd):        mov     u1, u0
+       ldx     [up1 + n], u1
+AM4(`  ldx     [rp2 + n], r0')
+       umulxhi(u0, v0, %l4)
+       umulxhi(u0, v1, %l5)
+       umulxhi(u0, v2, %l6)
+       umulxhi(u0, v3, %l7)
+       b       L(mid)
+        add    n, 8, n
+
+L(evn):        ldx     [up1 + n], u0
+AM4(`  ldx     [rp2 + n], r0')
+       umulxhi(u1, v0, %l4)
+       umulxhi(u1, v1, %l5)
+       umulxhi(u1, v2, %l6)
+       umulxhi(u1, v3, %l7)
+       add     n, 16, n
+
+       ALIGN(16)
+L(top):        addcc   %l0, w0, w0
+       mulx    u0, v0, %l0     C w 0
+       addxccc(%l1, w1, w1)
+       mulx    u0, v1, %l1     C w 1
+       addxccc(%l2, w2, w2)
+       mulx    u0, v2, %l2     C w 2
+       addxccc(%l3, w3, w3)
+       mulx    u0, v3, %l3     C w 3
+       ldx     [up0 + n], u1
+       addxc(  %g0, %g0, w4)
+AM4(`  addcc   r0, w0, w0')
+       stx     w0, [rp0 + n]
+       ADDX(`  %l4, w1, w0')
+       umulxhi(u0, v0, %l4)    C w 1
+AM4(`  ldx     [rp1 + n], r0')
+       addxccc(%l5, w2, w1)
+       umulxhi(u0, v1, %l5)    C w 2
+       addxccc(%l6, w3, w2)
+       umulxhi(u0, v2, %l6)    C w 3
+       addxc(  %l7, w4, w3)
+       umulxhi(u0, v3, %l7)    C w 4
+L(mid):        addcc   %l0, w0, w0
+       mulx    u1, v0, %l0     C w 1
+       addxccc(%l1, w1, w1)
+       mulx    u1, v1, %l1     C w 2
+       addxccc(%l2, w2, w2)
+       mulx    u1, v2, %l2     C w 3
+       addxccc(%l3, w3, w3)
+       mulx    u1, v3, %l3     C w 4
+       ldx     [up1 + n], u0
+       addxc(  %g0, %g0, w4)
+AM4(`  addcc   r0, w0, w0')
+       stx     w0, [rp1 + n]
+       ADDX(`  %l4, w1, w0')
+       umulxhi(u1, v0, %l4)    C w 2
+AM4(`  ldx     [rp2 + n], r0')
+       addxccc(%l5, w2, w1)
+       umulxhi(u1, v1, %l5)    C w 3
+       addxccc(%l6, w3, w2)
+       umulxhi(u1, v2, %l6)    C w 4
+       addxc(  %l7, w4, w3)
+       umulxhi(u1, v3, %l7)    C w 5
+       brlz    n, L(top)
+        add    n, 16, n
+
+L(end):        addcc   %l0, w0, w0
+       mulx    u0, v0, %l0
+       addxccc(%l1, w1, w1)
+       mulx    u0, v1, %l1
+       addxccc(%l2, w2, w2)
+       mulx    u0, v2, %l2
+       addxccc(%l3, w3, w3)
+       mulx    u0, v3, %l3
+       addxc(  %g0, %g0, w4)
+AM4(`  addcc   r0, w0, w0')
+       stx     w0, [rp0 + n]
+       ADDX(`  %l4, w1, w0')
+       umulxhi(u0, v0, %l4)
+AM4(`  ldx     [rp1 + n], r0')
+       addxccc(%l5, w2, w1)
+       umulxhi(u0, v1, %l5)
+       addxccc(%l6, w3, w2)
+       umulxhi(u0, v2, %l6)
+       addxc(  %l7, w4, w3)
+       umulxhi(u0, v3, %l7)
+       addcc   %l0, w0, w0
+       addxccc(%l1, w1, w1)
+       addxccc(%l2, w2, w2)
+       addxccc(%l3, w3, w3)
+       addxc(  %g0, %g0, w4)
+AM4(`  addcc   r0, w0, w0')
+       stx     w0, [rp1 + n]
+       ADDX(`  %l4, w1, w0')
+       addxccc(%l5, w2, w1)
+       addxccc(%l6, w3, w2)
+       stx     w0, [rp2 + n]
+       add     n, 16, n
+       stx     w1, [rp1 + n]
+       stx     w2, [rp2 + n]
+       addxc(  %l7, w4, %i0)
+       ret
+        restore
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/aorslsh_n.asm b/mpn/sparc64/ultrasparct3/aorslsh_n.asm
new file mode 100644 (file)
index 0000000..1014b1b
--- /dev/null
@@ -0,0 +1,147 @@
+dnl  SPARC v9 mpn_addlsh_n and mpn_sublsh_n for T3/T4/T5.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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 UltraSPARC T3:       11
+C UltraSPARC T4:        4
+
+C For sublsh_n we combine the two shifted limbs using xnor, using the identity
+C (a xor not b) = (not (a xor b)) which equals (not (a or b)) when (a and b) =
+C 0 as it is in our usage.  This gives us the ones complement for free.
+C Unfortunately, the same trick will not work for rsblsh_n, which will instead
+C require a separate negation.
+C
+C FIXME: Add rsblsh_n to this file.
+
+define(`rp', `%i0')
+define(`up', `%i1')
+define(`vp', `%i2')
+define(`n',  `%i3')
+define(`cnt',`%i4')
+
+define(`tnc',`%o5')
+
+ifdef(`OPERATION_addlsh_n',`
+  define(`INITCY', `subcc      %g0, 0, %g0')
+  define(`MERGE',  `or')
+  define(`func',   `mpn_addlsh_n')
+')
+ifdef(`OPERATION_sublsh_n',`
+  define(`INITCY', `subcc      %g0, 1, %g0')
+  define(`MERGE',  `xnor')
+  define(`func',   `mpn_sublsh_n')
+')
+
+define(`rp0',  `rp')
+define(`rp1',  `%o2')
+define(`up0',  `up')
+define(`up1',  `%o3')
+define(`vp0',  `vp')
+define(`vp1',  `%o4')
+
+MULFUNC_PROLOGUE(mpn_addlsh_n mpn_sublsh_n)
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(func)
+       save    %sp, -176, %sp
+       mov     64, tnc
+       sub     tnc, cnt, tnc
+
+       andcc   n, 1, %g0
+       sllx    n, 3, n
+       add     n, -16, n
+       add     up, n, up0
+       add     vp, n, vp0
+       add     rp, n, rp0
+       add     up0, 8, up1
+       add     vp0, 8, vp1
+       add     rp0, -8, rp1
+       add     rp0, -16, rp0
+       neg     n, n
+       be      L(evn)
+        INITCY
+
+L(odd):        ldx     [vp0 + n], %l1
+       mov     0, %l2
+       ldx     [up0 + n], %l5
+       sllx    %l1, cnt, %g3
+       brgez   n, L(wd1)
+        add    n, 8, n
+       ldx     [vp0 + n], %l0
+       b       L(lo1)
+        sllx   %l1, cnt, %g3
+
+L(evn):        ldx     [vp0 + n], %l0
+       mov     0, %l3
+       ldx     [up0 + n], %l4
+       ldx     [vp1 + n], %l1
+       b       L(lo0)
+        sllx   %l0, cnt, %g1
+
+L(top):        addxccc(%l6, %l4, %o0)
+       ldx     [vp0 + n], %l0
+       sllx    %l1, cnt, %g3
+       stx     %o0, [rp0 + n]
+L(lo1):        srlx    %l1, tnc, %l3
+       MERGE   %l2, %g3, %l7
+       ldx     [up0 + n], %l4
+       addxccc(%l7, %l5, %o1)
+       ldx     [vp1 + n], %l1
+       sllx    %l0, cnt, %g1
+       stx     %o1, [rp1 + n]
+L(lo0):        srlx    %l0, tnc, %l2
+       MERGE   %l3, %g1, %l6
+       ldx     [up1 + n], %l5
+       brlz,pt n, L(top)
+        add    n, 16, n
+
+       addxccc(%l6, %l4, %o0)
+       sllx    %l1, cnt, %g3
+       stx     %o0, [rp0 + n]
+L(wd1):        srlx    %l1, tnc, %l3
+       MERGE   %l2, %g3, %l7
+       addxccc(%l7, %l5, %o1)
+       stx     %o1, [rp1 + n]
+
+ifdef(`OPERATION_addlsh_n',
+`      addxc(  %l3, %g0, %i0)')
+ifdef(`OPERATION_sublsh_n',
+`      addxc(  %g0, %g0, %g1)
+       add     %g1, -1, %g1
+       sub     %l3, %g1, %i0')
+
+       ret
+        restore
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/bdiv_dbm1c.asm b/mpn/sparc64/ultrasparct3/bdiv_dbm1c.asm
new file mode 100644 (file)
index 0000000..550860d
--- /dev/null
@@ -0,0 +1,147 @@
+dnl  SPARC T3/T4/T5 mpn_bdiv_dbm1c.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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 UltraSPARC T3:       25
+C UltraSPARC T4/T5:     4
+
+C INPUT PARAMETERS
+define(`qp',  `%i0')
+define(`ap',  `%i1')
+define(`n',   `%i2')
+define(`bd',  `%i3')
+define(`h',   `%i4')
+
+define(`plo0',`%g4')  define(`plo1',`%g5')
+define(`phi0',`%l0')  define(`phi1',`%l1')
+define(`a0',  `%g1')  define(`a1',  `%g3')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_bdiv_dbm1c)
+       save    %sp, -176, %sp
+
+       and     n, 3, %g5
+       ldx     [ap + 0], %g2
+       add     n, -5, n
+       brz     %g5, L(b0)
+        cmp    %g5, 2
+       bcs     %xcc, L(b1)
+        nop
+       be      %xcc, L(b2)
+        nop
+
+L(b3): ldx     [ap + 8], a0
+       mulx    bd, %g2, plo1
+       umulxhi(bd, %g2, phi1)
+       ldx     [ap + 16], a1
+       add     qp, -24, qp
+       b       L(lo3)
+        add    ap, -8, ap
+
+L(b2): ldx     [ap + 8], a1
+       mulx    bd, %g2, plo0
+       umulxhi(bd, %g2, phi0)
+       brlz,pt n, L(wd2)
+        nop
+L(gt2):        ldx     [ap + 16], a0
+       add     ap, 16, ap
+       b       L(lo2)
+        add    n, -1, n
+
+L(b1): mulx    bd, %g2, plo1
+        umulxhi(bd, %g2, phi1)
+       brlz,pn n, L(wd1)
+        add    qp, -8, qp
+L(gt1):        ldx     [ap + 8], a0
+       ldx     [ap + 16], a1
+       b       L(lo1)
+        add    ap, 8, ap
+
+L(b0): ldx     [ap + 8], a1
+       mulx    bd, %g2, plo0
+       umulxhi(bd, %g2, phi0)
+       ldx     [ap + 16], a0
+       b       L(lo0)
+        add    qp, -16, qp
+
+L(top):        ldx     [ap + 0], a0
+       sub     h, phi1, h
+L(lo2):        mulx    bd, a1, plo1
+       umulxhi(bd, a1, phi1)
+       subcc   h, plo0, h
+       addxc(  phi0, %g0, phi0)
+       stx     h, [qp + 0]
+       ldx     [ap + 8], a1
+       sub     h, phi0, h
+L(lo1):        mulx    bd, a0, plo0
+       umulxhi(bd, a0, phi0)
+       subcc   h, plo1, h
+       addxc(  phi1, %g0, phi1)
+       stx     h, [qp + 8]
+       ldx     [ap + 16], a0
+       sub     h, phi1, h
+L(lo0):        mulx    bd, a1, plo1
+       umulxhi(bd, a1, phi1)
+       subcc   h, plo0, h
+       addxc(  phi0, %g0, phi0)
+       stx     h, [qp + 16]
+       ldx     [ap + 24], a1
+       sub     h, phi0, h
+L(lo3):        mulx    bd, a0, plo0
+       umulxhi(bd, a0, phi0)
+       subcc   h, plo1, h
+       addxc(  phi1, %g0, phi1)
+       stx     h, [qp + 24]
+       add     ap, 32, ap
+       add     qp, 32, qp
+       brgz,pt n, L(top)
+        add    n, -4, n
+
+L(end):        sub     h, phi1, h
+L(wd2):        mulx    bd, a1, plo1
+       umulxhi(bd, a1, phi1)
+       subcc   h, plo0, h
+       addxc(  phi0, %g0, phi0)
+       stx     h, [qp + 0]
+       sub     h, phi0, h
+L(wd1):        subcc   h, plo1, h
+       addxc(  phi1, %g0, phi1)
+       stx     h, [qp + 8]
+       sub     h, phi1, %i0
+
+       ret
+        restore
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/cnd_aors_n.asm b/mpn/sparc64/ultrasparct3/cnd_aors_n.asm
new file mode 100644 (file)
index 0000000..f10ee72
--- /dev/null
@@ -0,0 +1,143 @@
+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  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:        8.5
+C UltraSPARC T4:        3
+
+C We use a double-pointer trick to allow indexed addressing.  Its setup
+C cost might be a problem in these functions, since we don't expect huge n
+C arguments.
+C
+C For sub we need ~(a & mask) = (~a | ~mask) but by complementing mask we can
+C instead do ~(a & ~mask) = (~a | mask), allowing us to use the orn insn.
+
+C INPUT PARAMETERS
+define(`cnd', `%i0')
+define(`rp',  `%i1')
+define(`up',  `%i2')
+define(`vp',  `%i3')
+define(`n',   `%i4')
+
+define(`mask',   `cnd')
+define(`up0', `%l0')  define(`up1', `%l1')
+define(`vp0', `%l2')  define(`vp1', `%l3')
+define(`rp0', `%g4')  define(`rp1', `%g5')
+define(`u0',  `%l4')  define(`u1',  `%l5')
+define(`v0',  `%l6')  define(`v1',  `%l7')
+define(`x0',  `%g1')  define(`x1',  `%g3')
+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')
+  define(`INITCY',  `addcc     %g0, 0, %g0')
+  define(`RETVAL',  `addxc(    %g0, %g0, %i0)')
+  define(`func',    `mpn_cnd_add_n')
+')
+ifdef(`OPERATION_cnd_sub_n',`
+  define(`LOGOP',   `orn       $2, $1, $3')
+  define(`MAKEMASK',`cmp       $1, 1
+                    subc       %g0, %g0, $2')
+  define(`INITCY',  `subcc     %g0, 1, %g0')
+  define(`RETVAL',  `addxc(    %g0, %g0, %i0)
+                    xor        %i0, 1, %i0')
+  define(`func',    `mpn_cnd_sub_n')
+')
+
+MULFUNC_PROLOGUE(mpn_cnd_add_n mpn_cnd_sub_n)
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(func)
+       save    %sp, -176, %sp
+
+       MAKEMASK(cnd,mask)
+
+       andcc   n, 1, %g0
+       sllx    n, 3, n
+       add     n, -16, n
+       add     vp, n, vp0
+       add     up, n, up0
+       add     rp, n, rp0
+       neg     n, n
+       be      L(evn)
+        INITCY
+
+L(odd):        ldx     [vp0 + n], v1
+       ldx     [up0 + n], u1
+       LOGOP(  v1, mask, x1)
+       addxccc(u1, x1, w1)
+       stx     w1, [rp0 + n]
+       add     n, 8, n
+       brgz    n, L(rtn)
+        nop
+
+L(evn):        add     vp0, 8, vp1
+       add     up0, 8, up1
+       add     rp0, -24, rp1
+       ldx     [vp0 + n], v0
+       ldx     [vp1 + n], v1
+       ldx     [up0 + n], u0
+       ldx     [up1 + n], u1
+       add     n, 16, n
+       brgz    n, L(end)
+        add    rp0, -16, rp0
+
+L(top):        LOGOP(  v0, mask, x0)
+       ldx     [vp0 + n], v0
+       LOGOP(  v1, mask, x1)
+       ldx     [vp1 + n], v1
+       addxccc(u0, x0, w0)
+       ldx     [up0 + n], u0
+       addxccc(u1, x1, w1)
+       ldx     [up1 + n], u1
+       stx     w0, [rp0 + n]
+       add     n, 16, n
+       brlez   n, L(top)
+        stx    w1, [rp1 + n]
+
+L(end):        LOGOP(  v0, mask, x0)
+       LOGOP(  v1, mask, x1)
+       addxccc(u0, x0, w0)
+       addxccc(u1, x1, w1)
+       stx     w0, [rp0 + n]
+       stx     w1, [rp1 + 32]
+
+L(rtn):        RETVAL
+       ret
+        restore
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/dive_1.asm b/mpn/sparc64/ultrasparct3/dive_1.asm
new file mode 100644 (file)
index 0000000..d7dbdf9
--- /dev/null
@@ -0,0 +1,129 @@
+dnl  SPARC T3/T4/T5 mpn_divexact_1.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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 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',`%o4')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_divexact_1)
+       save    %sp, -176, %sp
+       cmp     n, 1
+       bne,pt  %xcc, L(gt1)
+        ldx    [ap], %o5
+       udivx   %o5, d, %g1
+       stx     %g1, [qp]
+       return  %i7+8
+        nop
+
+L(gt1):        add     d, -1, %g1
+       andn    %g1, d, %g1
+       popc    %g1, %i4                C i4 = count_trailing_zeros(d)
+
+       srlx    d, %i4, 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  %i4, L(norm)
+        sub    %o7, %g1, dinv
+
+L(unnorm):
+       mov     0, %g4
+       sub     %g0, %i4, %o2
+       srlx    %o5, %i4, %o5
+L(top_unnorm):
+       ldx     [ap+8], %g3
+       add     ap, 8, ap
+       sllx    %g3, %o2, %g5
+       or      %g5, %o5, %g5
+       srlx    %g3, %i4, %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(top_unnorm)
+        add    n, -1, n
+
+       sub     %o5, %g4, %g4
+       mulx    %g4, dinv, %g1
+       stx     %g1, [qp]
+       return  %i7+8
+        nop
+
+L(norm):
+       mulx    dinv, %o5, %g1
+       stx     %g1, [qp]
+       add     qp, 8, qp
+       addcc   %g0, 0, %g4
+L(top_norm):
+       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(top_norm)
+        add    n, -1, n
+
+       return  %i7+8
+        nop
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/hamdist.asm b/mpn/sparc64/ultrasparct3/hamdist.asm
new file mode 100644 (file)
index 0000000..20ed8bf
--- /dev/null
@@ -0,0 +1,78 @@
+dnl  SPARC v9 mpn_hamdist for T3/T4.
+
+dnl  Contributed to the GNU project by David Miller.
+
+dnl  Copyright 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 UltraSPARC T3:       18
+C UltraSPARC T4:        3.5
+
+C INPUT PARAMETERS
+define(`up',   `%o0')
+define(`vp',   `%o1')
+define(`n',    `%o2')
+define(`pcnt', `%o5')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_hamdist)
+       subcc   n, 1, n
+       be      L(final_one)
+        clr    pcnt
+L(top):
+       ldx     [up + 0], %g1
+       ldx     [vp + 0], %g2
+       ldx     [up + 8], %o4
+       ldx     [vp + 8], %g3
+       sub     n, 2, n
+       xor     %g1, %g2, %g1
+       add     up, 16, up
+       popc    %g1, %g2
+       add     vp, 16, vp
+       xor     %o4, %g3, %o4
+       add     pcnt, %g2, pcnt
+       popc    %o4, %g3
+       brgz    n, L(top)
+        add    pcnt, %g3, pcnt
+       brlz,pt n, L(done)
+        nop
+L(final_one):
+       ldx     [up + 0], %g1
+       ldx     [vp + 0], %g2
+       xor     %g1,%g2, %g1
+       popc    %g1, %g2
+       add     pcnt, %g2, pcnt
+L(done):
+       retl
+        mov    pcnt, %o0
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/invert_limb.asm b/mpn/sparc64/ultrasparct3/invert_limb.asm
new file mode 100644 (file)
index 0000000..4da49cf
--- /dev/null
@@ -0,0 +1,92 @@
+dnl  SPARC T3/T4/T5 mpn_invert_limb.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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 UltraSPARC T3:        ?
+C UltraSPARC T4/T5:     ?
+
+C INPUT PARAMETERS
+define(`d',  `%o0')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_invert_limb)
+       srlx    d, 54, %g1
+       LEA64(approx_tab, g2, g3)
+       and     %g1, 0x1fe, %g1
+       srlx    d, 24, %g4
+       lduh    [%g2+%g1], %g3
+       add     %g4, 1, %g4
+       sllx    %g3, 11, %g2
+       add     %g2, -1, %g2
+       mulx    %g3, %g3, %g3
+       mulx    %g3, %g4, %g3
+       srlx    %g3, 40, %g3
+       sub     %g2, %g3, %g2
+       sllx    %g2, 60, %g1
+       mulx    %g2, %g2, %g3
+       mulx    %g3, %g4, %g4
+       sub     %g1, %g4, %g1
+       srlx    %g1, 47, %g1
+       sllx    %g2, 13, %g2
+       add     %g1, %g2, %g1
+       and     d, 1, %g2
+       srlx    %g1, 1, %g4
+       sub     %g0, %g2, %g3
+       and     %g4, %g3, %g3
+       srlx    d, 1, %g4
+       add     %g4, %g2, %g2
+       mulx    %g1, %g2, %g2
+       sub     %g3, %g2, %g2
+       umulxhi(%g1, %g2, %g2)
+       srlx    %g2, 1, %g2
+       sllx    %g1, 31, %g1
+       add     %g2, %g1, %g1
+       mulx    %g1, d, %g3
+       umulxhi(d, %g1, %g4)
+       addcc   %g3, d, %g0
+       addxc(  %g4, d, %o0)
+       jmp     %o7+8
+        sub    %g1, %o0, %o0
+EPILOGUE()
+
+       RODATA
+       ALIGN(2)
+       TYPE(   approx_tab, object)
+       SIZE(   approx_tab, 512)
+approx_tab:
+forloop(i,256,512-1,dnl
+`      .half   eval(0x7fd00/i)
+')dnl
diff --git a/mpn/sparc64/ultrasparct3/missing.asm b/mpn/sparc64/ultrasparct3/missing.asm
new file mode 100644 (file)
index 0000000..c79032d
--- /dev/null
@@ -0,0 +1,77 @@
+dnl  SPARC v9-2011 simulation support.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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')
+
+ASM_START()
+PROLOGUE(__gmpn_umulh)
+       save    %sp, -176, %sp
+       ldx     [%sp+2047+176+256], %o0
+       ldx     [%sp+2047+176+256+8], %o1
+       rd      %ccr, %o4
+       srl     %o0, 0, %l4
+       srl     %o1, 0, %l1
+       srlx    %o1, 32, %o1
+       mulx    %o1, %l4, %l2
+       srlx    %o0, 32, %o0
+       mulx    %o0, %l1, %l3
+       mulx    %l1, %l4, %l1
+       srlx    %l1, 32, %l1
+       add     %l2, %l1, %l2
+       addcc   %l2, %l3, %l2
+       mulx    %o1, %o0, %o1
+       mov     0, %l1
+       movcs   %xcc, 1, %l1
+       sllx    %l1, 32, %l1
+       add     %o1, %l1, %o1
+       srlx    %l2, 32, %o0
+       add     %o1, %o0, %o0
+       stx     %o0, [%sp+2047+176+256]
+       wr      %o4, 0, %ccr
+       ret
+        restore
+EPILOGUE()
+
+PROLOGUE(__gmpn_lzcnt)
+       save    %sp, -176, %sp
+       ldx     [%sp+2047+176+256], %o0
+       brz,a   %o0, 2f
+        mov    64, %o1
+       brlz    %o0, 2f
+        mov    0, %o1
+1:     sllx    %o0, 1, %o0
+       brgz    %o0, 1b
+        add    %o1, 1, %o1
+       stx     %o1, [%sp+2047+176+256]
+2:     ret
+        restore
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/missing.m4 b/mpn/sparc64/ultrasparct3/missing.m4
new file mode 100644 (file)
index 0000000..e5d6d8e
--- /dev/null
@@ -0,0 +1,88 @@
+dnl  SPARC v9-2011 simulation support.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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/.
+
+
+dnl Usage addxccc(r1,r2,r3, t1)
+dnl  64-bit add with carry-in and carry-out
+dnl  FIXME: Register g2 must not be destination
+
+define(`addxccc',`dnl
+       add     %sp, -512, %sp
+       stx     %g2, [%sp+2047+256+16]
+       mov     0, %g2
+       movcs   %xcc, -1, %g2
+       addcc   %g2, 1, %g0
+       addccc  $1, $2, $3
+       ldx     [%sp+2047+256+16], %g2
+       sub     %sp, -512, %sp
+')
+
+
+dnl Usage addxc(r1,r2,r3, t1,t2)
+dnl  64-bit add with carry-in
+
+define(`addxc',`dnl
+       bcc     %xcc, 1f
+        add    $1, $2, $3
+       add     $3, 1, $3
+1:
+')
+
+
+dnl Usage umulxhi(r1,r2,r3)
+dnl  64-bit multiply returning upper 64 bits
+dnl  Calls __gmpn_umulh using a non-standard calling convention
+
+define(`umulxhi',`dnl
+       add     %sp, -512, %sp
+       stx     $1, [%sp+2047+256]
+       stx     $2, [%sp+2047+256+8]
+       stx     %o7, [%sp+2047+256+16]
+       call    __gmpn_umulh
+        nop
+       ldx     [%sp+2047+256+16], %o7
+       ldx     [%sp+2047+256], $3
+       sub     %sp, -512, %sp
+')
+dnl Usage lzcnt(r1,r2)
+dnl  Plain count leading zeros
+dnl  Calls __gmpn_lzcnt using a non-standard calling convention
+
+define(`lzcnt',`dnl
+       add     %sp, -512, %sp
+       stx     %o7, [%sp+2047+256+16]
+       call    __gmpn_lzcnt
+        stx    $1, [%sp+2047+256]
+       ldx     [%sp+2047+256+16], %o7
+       ldx     [%sp+2047+256], $2
+       sub     %sp, -512, %sp
+')
diff --git a/mpn/sparc64/ultrasparct3/mod_1_4.asm b/mpn/sparc64/ultrasparct3/mod_1_4.asm
new file mode 100644 (file)
index 0000000..08facbd
--- /dev/null
@@ -0,0 +1,233 @@
+dnl  SPARC T3/T4/T5 mpn_mod_1s_4p.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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 UltraSPARC T3:       30
+C UltraSPARC T4/T5:     4
+
+C INPUT PARAMETERS
+define(`ap',  `%o0')
+define(`n',   `%o1')
+define(`d',   `%o2')
+define(`cps', `%o3')
+
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_mod_1s_4p)
+       save    %sp, -176, %sp
+       ldx     [%i3+16], %o4
+       ldx     [%i3+24], %o3
+       ldx     [%i3+32], %o2
+       ldx     [%i3+40], %o1
+       ldx     [%i3+48], %o0
+
+       and     %i1, 3, %g3
+       sllx    %i1, 3, %g1
+       add     %i0, %g1, %i0
+       brz     %g3, L(b00)
+        cmp    %g3, 2
+       bcs     %xcc, L(b01)
+        nop
+       be      %xcc, L(b10)
+        nop
+
+L(b11):        ldx     [%i0-16], %g2
+       mulx    %g2, %o4, %g5
+       umulxhi(%g2, %o4, %g3)
+       ldx     [%i0-24], %g4
+       addcc   %g5, %g4, %g5
+       addxc(  %g3, %g0, %g4)
+       ldx     [%i0-8], %g2
+       mulx    %g2, %o3, %g1
+       umulxhi(%g2, %o3, %g3)
+       addcc   %g1, %g5, %g1
+       addxc(  %g3, %g4, %g2)
+       ba,pt   %xcc, .L8
+        add    %i0, -32, %i0
+
+L(b00):        ldx     [%i0-24], %g3
+       mulx    %g3, %o4, %g2
+       umulxhi(%g3, %o4, %g5)
+       ldx     [%i0-32], %g4
+       addcc   %g2, %g4, %g2
+       addxc(  %g5, %g0, %g3)
+       ldx     [%i0-16], %g4
+       mulx    %g4, %o3, %g5
+       umulxhi(%g4, %o3, %i5)
+       addcc   %g2, %g5, %g5
+       addxc(  %g3, %i5, %g4)
+       ldx     [%i0-8], %g2
+       mulx    %g2, %o2, %g1
+       umulxhi(%g2, %o2, %g3)
+       addcc   %g1, %g5, %g1
+       addxc(  %g3, %g4, %g2)
+       ba,pt   %xcc, .L8
+        add    %i0, -40, %i0
+
+L(b01):        ldx     [%i0-8], %g1
+       mov     0, %g2
+       ba,pt   %xcc, .L8
+        add    %i0, -16, %i0
+
+L(b10):        ldx     [%i0-8], %g2
+       ldx     [%i0-16], %g1
+       add     %i0, -24, %i0
+
+.L8:   add     %i1, -5, %g3
+       brlz,pn %g3, L(end)
+        nop
+
+L(top):        ldx     [%i0-16], %i4
+       mulx    %i4, %o4, %o5
+       umulxhi(%i4, %o4, %i1)
+       ldx     [%i0-24], %i5
+       addcc   %o5, %i5, %o5
+       addxc(  %i1, %g0, %i4)
+       ldx     [%i0-8], %i5
+       mulx    %i5, %o3, %o7
+       umulxhi(%i5, %o3, %i1)
+       addcc   %o5, %o7, %o7
+       addxc(  %i4, %i1, %i5)
+       ldx     [%i0+0], %g4
+       mulx    %g4, %o2, %i1
+       umulxhi(%g4, %o2, %i4)
+       addcc   %o7, %i1, %i1
+       addxc(  %i5, %i4, %g4)
+       mulx    %g1, %o1, %i5
+       umulxhi(%g1, %o1, %i4)
+       addcc   %i1, %i5, %i5
+       addxc(  %g4, %i4, %g5)
+       mulx    %g2, %o0, %g1
+       umulxhi(%g2, %o0, %g4)
+       addcc   %g1, %i5, %g1
+       addxc(  %g4, %g5, %g2)
+       add     %g3, -4, %g3
+       brgez,pt %g3, L(top)
+        add    %i0, -32, %i0
+
+L(end):        mulx    %g2, %o4, %g5
+       umulxhi(%g2, %o4, %g3)
+       addcc   %g1, %g5, %g5
+       addxc(  %g3, %g0, %g2)
+       ldx     [%i3+8], %i0
+       ldx     [%i3], %g4
+       sub     %g0, %i0, %i5
+       srlx    %g5, %i5, %i5
+       sllx    %g2, %i0, %g2
+       or      %i5, %g2, %g1
+       mulx    %g1, %g4, %l7
+       umulxhi(%g1, %g4, %g3)
+       sllx    %g5, %i0, %g2
+       add     %g1, 1, %g1
+       addcc   %l7, %g2, %g5
+       addxc(  %g3, %g1, %g1)
+       mulx    %g1, %i2, %g1
+       sub     %g2, %g1, %g2
+       cmp     %g2, %g5
+       add     %i2, %g2, %g1
+       movlu   %xcc, %g2, %g1
+       subcc   %g1, %i2, %g2
+       movgeu  %xcc, %g2, %g1
+       return  %i7+8
+        srlx   %g1, %o0, %o0
+EPILOGUE()
+
+PROLOGUE(mpn_mod_1s_4p_cps)
+       save    %sp, -176, %sp
+       lzcnt(  %i1, %i5)
+       sllx    %i1, %i5, %i1
+       call    mpn_invert_limb, 0
+        mov    %i1, %o0
+       stx     %o0, [%i0]
+       sra     %i5, 0, %g1
+       stx     %g1, [%i0+8]
+       sub     %g0, %i5, %g2
+       srlx    %o0, %g2, %g2
+       mov     1, %g1
+       sllx    %g1, %i5, %g1
+       or      %g2, %g1, %g2
+       sub     %g0, %i1, %g1
+       mulx    %g2, %g1, %g2
+       srlx    %g2, %i5, %g1
+       stx     %g1, [%i0+16]
+
+       umulxhi(%o0, %g2, %g3)
+       add     %g2, %g3, %g3
+       xnor    %g0, %g3, %g3
+       mulx    %g3, %i1, %g3
+       mulx    %g2, %o0, %g2
+       cmp     %g2, %g3
+       add     %i1, %g3, %g1
+       movgeu  %xcc, %g3, %g1
+       srlx    %g1, %i5, %g2
+       stx     %g2, [%i0+24]
+
+       umulxhi(%o0, %g1, %g3)
+       add     %g1, %g3, %g3
+       xnor    %g0, %g3, %g3
+       mulx    %g3, %i1, %g3
+       mulx    %g1, %o0, %g1
+       cmp     %g1, %g3
+       add     %i1, %g3, %g2
+       movgeu  %xcc, %g3, %g2
+       srlx    %g2, %i5, %g1
+       stx     %g1, [%i0+32]
+
+       umulxhi(%o0, %g2, %g3)
+       add     %g2, %g3, %g3
+       xnor    %g0, %g3, %g3
+       mulx    %g3, %i1, %g3
+       mulx    %g2, %o0, %g2
+       cmp     %g2, %g3
+       add     %i1, %g3, %g1
+       movgeu  %xcc, %g3, %g1
+       srlx    %g1, %i5, %g2
+       stx     %g2, [%i0+40]
+
+       umulxhi(%o0, %g1, %g2)
+       add     %g1, %g2, %g2
+       xnor    %g0, %g2, %g2
+       mulx    %g2, %i1, %g2
+       mulx    %g1, %o0, %o0
+       cmp     %o0, %g2
+       add     %i1, %g2, %g3
+       movgeu  %xcc, %g2, %g3
+       srlx    %g3, %i5, %i5
+       stx     %i5, [%i0+48]
+
+       return  %i7+8
+        nop
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/mod_34lsub1.asm b/mpn/sparc64/ultrasparct3/mod_34lsub1.asm
new file mode 100644 (file)
index 0000000..8744280
--- /dev/null
@@ -0,0 +1,117 @@
+dnl  SPARC v9 mpn_mod_34lsub1 for T3/T4/T5.
+
+dnl  Copyright 2005, 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 UltraSPARC T1:        -
+C UltraSPARC T3:        5
+C UltraSPARC T4:        1.57
+
+C This is based on the powerpc64/mode64 code.
+
+C INPUT PARAMETERS
+define(`up', `%i0')
+define(`n',  `%i1')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_mod_34lsub1)
+       save    %sp, -176, %sp
+
+       mov     0, %g1
+       mov     0, %g3
+       mov     0, %g4
+       addcc   %g0, 0, %g5
+
+       add     n, -3, n
+       brlz    n, L(lt3)
+        nop
+
+       add     n, -3, n
+       ldx     [up+0], %l5
+       ldx     [up+8], %l6
+       ldx     [up+16], %l7
+       brlz    n, L(end)
+        add    up, 24, up
+
+       ALIGN(16)
+L(top):        addxccc(%g1, %l5, %g1)
+       ldx     [up+0], %l5
+       addxccc(%g3, %l6, %g3)
+       ldx     [up+8], %l6
+       addxccc(%g4, %l7, %g4)
+       ldx     [up+16], %l7
+       add     n, -3, n
+       brgez   n, L(top)
+        add    up, 24, up
+
+L(end):        addxccc(        %g1, %l5, %g1)
+       addxccc(%g3, %l6, %g3)
+       addxccc(%g4, %l7, %g4)
+       addxc(  %g5, %g0, %g5)
+
+L(lt3):        cmp     n, -2
+       blt     L(2)
+        nop
+
+       ldx     [up+0], %l5
+       mov     0, %l6
+       beq     L(1)
+        addcc  %g1, %l5, %g1
+
+       ldx     [up+8], %l6
+L(1):  addxccc(%g3, %l6, %g3)
+       addxccc(%g4, %g0, %g4)
+       addxc(  %g5, %g0, %g5)
+
+L(2):  sllx    %g1, 16, %l0
+       srlx    %l0, 16, %l0            C %l0 = %g1 mod 2^48
+       srlx    %g1, 48, %l3            C %l3 = %g1 div 2^48
+       srl     %g3, 0, %g1
+       sllx    %g1, 16, %l4            C %l4 = (%g3 mod 2^32) << 16
+       srlx    %g3, 32, %l5            C %l5 = %g3 div 2^32
+       sethi   %hi(0xffff0000), %g1
+       andn    %g4, %g1, %g1
+       sllx    %g1, 32, %l6            C %l6 = (%g4 mod 2^16) << 32
+       srlx    %g4, 16, %l7            C %l7 = %g4 div 2^16
+
+       add     %l0, %l3, %l0
+       add     %l4, %l5, %l4
+       add     %l6, %l7, %l6
+
+       add     %l0, %l4, %l0
+       add     %l6, %g5, %l6
+
+       add     %l0, %l6, %i0
+       ret
+        restore
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/mode1o.asm b/mpn/sparc64/ultrasparct3/mode1o.asm
new file mode 100644 (file)
index 0000000..494e1d3
--- /dev/null
@@ -0,0 +1,82 @@
+dnl  SPARC T3/T4/T5 mpn_modexact_1c_odd.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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 UltraSPARC T3:       30
+C UltraSPARC T4/T5:    26
+
+C INPUT PARAMETERS
+define(`ap',  `%o0')
+define(`n',   `%o1')
+define(`d',   `%o2')
+define(`cy',  `%o3')
+
+define(`dinv',`%o5')
+define(`a0',  `%g1')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_modexact_1c_odd)
+       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, %o5
+       mulx    %g1, %g1, %g1
+       mulx    %g1, d, %g1
+       sub     %o5, %g1, dinv
+       add     n, -1, n
+
+L(top):        ldx     [ap], a0
+       add     ap, 8, ap
+       subcc   a0, cy, %g3
+       mulx    %g3, dinv, %g5
+       umulxhi(d, %g5, %g5)
+       addxc(  %g5, %g0, cy)
+       brnz,pt n, L(top)
+        add    n, -1, n
+
+       retl
+        mov    cy, %o0
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/mul_1.asm b/mpn/sparc64/ultrasparct3/mul_1.asm
new file mode 100644 (file)
index 0000000..af05d62
--- /dev/null
@@ -0,0 +1,174 @@
+dnl  SPARC v9 mpn_mul_1 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  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:       23
+C UltraSPARC T4:        3
+
+C INPUT PARAMETERS
+define(`rp', `%i0')
+define(`up', `%i1')
+define(`n',  `%i2')
+define(`v0', `%i3')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_mul_1)
+       save    %sp, -176, %sp
+
+       and     n, 3, %g5
+       add     n, -4, n
+       brz     %g5, L(b0)
+        cmp    %g5, 2
+       bcs     %xcc, L(b1)
+        nop
+       be      %xcc, L(b2)
+        nop
+
+L(b3): addcc   %g0, %g0, %i5
+       ldx     [up+0], %l0
+       ldx     [up+8], %l1
+       ldx     [up+16], %l2
+       mulx    %l0, v0, %o0
+       umulxhi(%l0, v0, %o1)
+       brgz    n, L(gt3)
+        add    rp, -8, rp
+       mulx    %l1, v0, %o2
+       umulxhi(%l1, v0, %o3)
+       b       L(wd3)
+        nop
+L(gt3):        ldx     [up+24], %l3
+       mulx    %l1, v0, %o2
+       umulxhi(%l1, v0, %o3)
+       add     up, 24, up
+       b       L(lo3)
+        add    n, -3, n
+
+L(b2): addcc   %g0, %g0, %o1
+       ldx     [up+0], %l1
+       ldx     [up+8], %l2
+       brgz    n, L(gt2)
+        add    rp, -16, rp
+       mulx    %l1, v0, %o2
+       umulxhi(%l1, v0, %o3)
+       mulx    %l2, v0, %o4
+       umulxhi(%l2, v0, %o5)
+       b       L(wd2)
+        nop
+L(gt2):        ldx     [up+16], %l3
+       mulx    %l1, v0, %o2
+       umulxhi(%l1, v0, %o3)
+       ldx     [up+24], %l0
+       mulx    %l2, v0, %o4
+       umulxhi(%l2, v0, %o5)
+       add     up, 16, up
+       b       L(lo2)
+        add    n, -2, n
+
+L(b1): addcc   %g0, %g0, %o3
+       ldx     [up+0], %l2
+       brgz    n, L(gt1)
+       nop
+       mulx    %l2, v0, %o4
+       stx     %o4, [rp+0]
+       umulxhi(%l2, v0, %i0)
+       ret
+        restore
+L(gt1):        ldx     [up+8], %l3
+       ldx     [up+16], %l0
+       mulx    %l2, v0, %o4
+       umulxhi(%l2, v0, %o5)
+       ldx     [up+24], %l1
+       mulx    %l3, v0, %i4
+       umulxhi(%l3, v0, %i5)
+       add     rp, -24, rp
+       add     up, 8, up
+       b       L(lo1)
+        add    n, -1, n
+
+L(b0): addcc   %g0, %g0, %o5
+       ldx     [up+0], %l3
+       ldx     [up+8], %l0
+       ldx     [up+16], %l1
+       mulx    %l3, v0, %i4
+       umulxhi(%l3, v0, %i5)
+       ldx     [up+24], %l2
+       mulx    %l0, v0, %o0
+       umulxhi(%l0, v0, %o1)
+       b       L(lo0)
+        nop
+
+       ALIGN(16)
+L(top):        ldx     [up+0], %l3     C 0
+       addxccc(%i4, %o5, %i4)  C 0
+       mulx    %l1, v0, %o2    C 1
+       stx     %i4, [rp+0]     C 1
+       umulxhi(%l1, v0, %o3)   C 2
+L(lo3):        ldx     [up+8], %l0     C 2
+       addxccc(%o0, %i5, %o0)  C 3
+       mulx    %l2, v0, %o4    C 3
+       stx     %o0, [rp+8]     C 4
+       umulxhi(%l2, v0, %o5)   C 4
+L(lo2):        ldx     [up+16], %l1    C 5
+       addxccc(%o2, %o1, %o2)  C 5
+       mulx    %l3, v0, %i4    C 6
+       stx     %o2, [rp+16]    C 6
+       umulxhi(%l3, v0, %i5)   C 7
+L(lo1):        ldx     [up+24], %l2    C 7
+       addxccc(%o4, %o3, %o4)  C 8
+       mulx    %l0, v0, %o0    C 8
+       stx     %o4, [rp+24]    C 9
+       umulxhi(%l0, v0, %o1)   C 9
+       add     rp, 32, rp      C 10
+L(lo0):        add     up, 32, up      C 10
+       brgz    n, L(top)       C 11
+        add    n, -4, n        C 11
+
+L(end):        addxccc(%i4, %o5, %i4)
+       mulx    %l1, v0, %o2
+       stx     %i4, [rp+0]
+       umulxhi(%l1, v0, %o3)
+       addxccc(%o0, %i5, %o0)
+L(wd3):        mulx    %l2, v0, %o4
+       stx     %o0, [rp+8]
+       umulxhi(%l2, v0, %o5)
+       addxccc(%o2, %o1, %o2)
+L(wd2):        stx     %o2, [rp+16]
+       addxccc(%o4, %o3, %o4)
+       stx     %o4, [rp+24]
+       addxc(  %g0, %o5, %i0)
+       ret
+        restore
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/popcount.asm b/mpn/sparc64/ultrasparct3/popcount.asm
new file mode 100644 (file)
index 0000000..de80f3c
--- /dev/null
@@ -0,0 +1,70 @@
+dnl  SPARC v9 mpn_popcount for T3/T4.
+
+dnl  Contributed to the GNU project by David Miller.
+
+dnl  Copyright 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 UltraSPARC T3:       15
+C UltraSPARC T4:        2.5
+
+C INPUT PARAMETERS
+define(`up',   `%o0')
+define(`n',    `%o1')
+define(`pcnt', `%o5')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_popcount)
+       subcc   n, 1, n
+       be      L(final_one)
+        clr    pcnt
+L(top):
+       ldx     [up + 0], %g1
+       sub     n, 2, n
+       ldx     [up + 8], %o4
+       add     up, 16, up
+       popc    %g1, %g2
+       popc    %o4, %g3
+       add     pcnt, %g2, pcnt
+       brgz    n, L(top)
+        add    pcnt, %g3, pcnt
+       brlz,pt n, L(done)
+        nop
+L(final_one):
+       ldx     [up + 0], %g1
+       popc    %g1, %g2
+       add     pcnt, %g2, pcnt
+L(done):
+       retl
+        mov    pcnt, %o0
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/sqr_diag_addlsh1.asm b/mpn/sparc64/ultrasparct3/sqr_diag_addlsh1.asm
new file mode 100644 (file)
index 0000000..216ddc0
--- /dev/null
@@ -0,0 +1,93 @@
+dnl  SPARC v9 mpn_sqr_dial_addlsh1 for T3/T4/T5.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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 UltraSPARC T3:       ?
+C UltraSPARC T4:       >= 4.5
+
+
+define(`rp', `%i0')
+define(`tp', `%i1')
+define(`up', `%i2')
+define(`n',  `%i3')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_sqr_diag_addlsh1)
+       save    %sp, -176, %sp
+
+       ldx     [up+0], %g1
+       mulx    %g1, %g1, %o0
+       umulxhi(%g1, %g1, %g2)
+       stx     %o0, [rp+0]
+
+       ldx     [up+8], %g1
+       ldx     [tp+0], %g4
+       ldx     [tp+8], %g5
+       mulx    %g1, %g1, %o0
+       orcc    %g0, %g0, %o5
+       b       L(dm)
+        add    n, -2, n
+
+       ALIGN(16)
+L(top):        ldx     [up+8], %g1
+       addcc   %g4, %o2, %o2
+       addxccc(%g5, %o0, %g3)
+       ldx     [tp+16], %g4
+       ldx     [tp+24], %g5
+       mulx    %g1, %g1, %o0
+       stx     %o2, [rp+8]
+       stx     %g3, [rp+16]
+       add     rp, 16, rp
+       add     tp, 16, tp
+L(dm): add     %g2, %o5, %o2
+       umulxhi(%g1, %g1, %g2)
+       addxccc(%g4, %g4, %g4)
+       addxccc(%g5, %g5, %g5)
+       add     up, 8, up
+       addxc(  %g0, %g0, %o5)
+       brnz    n, L(top)
+        add    n, -1, n
+
+       addcc   %o2, %g4, %g4
+       addxccc(%o0, %g5, %g5)
+       stx     %g4, [rp+8]
+       stx     %g5, [rp+16]
+       addxc(  %o5, %g2, %g2)
+       stx     %g2, [rp+24]
+
+       ret
+        restore
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/sub_n.asm b/mpn/sparc64/ultrasparct3/sub_n.asm
new file mode 100644 (file)
index 0000000..0e4bc93
--- /dev/null
@@ -0,0 +1,144 @@
+dnl  SPARC v9 mpn_sub_n for T3/T4.
+
+dnl  Contributed to the GNU project by David Miller.
+
+dnl  Copyright 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 UltraSPARC T3:        8
+C UltraSPARC T4:        3
+
+C INPUT PARAMETERS
+define(`rp', `%i0')
+define(`up', `%i1')
+define(`vp', `%i2')
+define(`n',  `%i3')
+define(`cy', `%i4')
+
+define(`u0_off', `%l0')
+define(`u1_off', `%l1')
+define(`v0_off', `%l2')
+define(`v1_off', `%l3')
+define(`r0_off', `%l4')
+define(`r1_off', `%l5')
+define(`loop_n', `%l6')
+define(`tmp', `%l7')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_sub_nc)
+       save    %sp, -176, %sp
+       ba,pt   %xcc, L(ent)
+        xor    cy, 1, cy
+EPILOGUE()
+PROLOGUE(mpn_sub_n)
+       save    %sp, -176, %sp
+       mov     1, cy
+L(ent):
+       subcc   n, 1, n
+       be      L(final_one)
+        cmp    %g0, cy
+
+       ldx     [up + 0], %o4
+       sllx    n, 3, tmp
+
+       ldx     [vp + 0], %o5
+       add     up, tmp, u0_off
+
+       ldx     [up + 8], %g5
+       add     vp, tmp, v0_off
+
+       ldx     [vp + 8], %g1
+       add     rp, tmp, r0_off
+
+       neg     tmp, loop_n
+       add     u0_off, 8, u1_off
+
+       add     v0_off, 8, v1_off
+       sub     loop_n, -(2 * 8), loop_n
+
+       sub     r0_off, 16, r0_off
+       brgez,pn loop_n, L(loop_tail)
+        sub    r0_off, 8, r1_off
+
+       b,a     L(top)
+       ALIGN(16)
+L(top):
+       xnor    %o5, 0, tmp
+       ldx     [loop_n + v0_off], %o5
+
+       addxccc(%o4, tmp, %g3)
+       ldx     [loop_n + u0_off], %o4
+
+       xnor    %g1, 0, %g1
+       stx     %g3, [loop_n + r0_off]
+
+       addxccc(%g5, %g1, tmp)
+       ldx     [loop_n + v1_off], %g1
+
+       ldx     [loop_n + u1_off], %g5
+       sub     loop_n, -(2 * 8), loop_n
+
+       brlz    loop_n, L(top)
+        stx    tmp, [loop_n + r1_off]
+
+L(loop_tail):
+       xnor    %o5, 0, tmp
+       xnor    %g1, 0, %g1
+
+       addxccc(%o4, tmp, %g3)
+       add     loop_n, u0_off, up
+
+       addxccc(%g5, %g1, %g5)
+       add     loop_n, r0_off, rp
+
+       stx     %g3, [rp + 0]
+       add     loop_n, v0_off, vp
+
+       brgz,pt loop_n, L(done)
+        stx    %g5, [rp + 8]
+
+       add     rp, (2 * 8), rp
+
+L(final_one):
+       ldx     [up+0], %o4
+       ldx     [vp+0], %o5
+       xnor    %o5, %g0, %o5
+       addxccc(%o4, %o5, %g3)
+       stx     %g3, [rp+0]
+
+L(done):
+       clr     %i0
+       movcc   %xcc, 1, %i0
+       ret
+        restore
+EPILOGUE()
diff --git a/mpn/sparc64/ultrasparct3/submul_1.asm b/mpn/sparc64/ultrasparct3/submul_1.asm
new file mode 100644 (file)
index 0000000..5635d1b
--- /dev/null
@@ -0,0 +1,170 @@
+dnl  SPARC v9 mpn_submul_1 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  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:       26
+C UltraSPARC T4:        4.5
+
+C INPUT PARAMETERS
+define(`rp', `%i0')
+define(`up', `%i1')
+define(`n',  `%i2')
+define(`v0', `%i3')
+
+ASM_START()
+       REGISTER(%g2,#scratch)
+       REGISTER(%g3,#scratch)
+PROLOGUE(mpn_submul_1)
+       save    %sp, -176, %sp
+       ldx     [up+0], %g1
+
+       and     n, 3, %g5
+       add     n, -4, n
+       brz     %g5, L(b00)
+        cmp    %g5, 2
+       bcs     %xcc, L(b01)
+        nop
+       bne     %xcc, L(b11)
+        ldx    [up+8], %g4
+
+L(b10):        add     up, 16, up
+       addcc   %g0, 0, %g3
+       mulx    %g1, v0, %l4
+       umulxhi(%g1, v0, %l5)
+       ldx     [rp+0], %o2
+       mulx    %g4, v0, %l6
+       umulxhi(%g4, v0, %l7)
+       brlz    n, L(wd2)
+        nop
+L(gt2):        ldx     [up+0], %o0
+       b       L(lo2)
+        nop
+
+L(b00):        add     rp, -16, rp
+       addcc   %g0, 0, %g3
+       ldx     [up+8], %o1
+       mulx    %g1, v0, %l0
+       umulxhi(%g1, v0, %l1)
+       ldx     [up+16], %o0
+       ldx     [rp+16], %o2
+       mulx    %o1, v0, %l2
+       umulxhi(%o1, v0, %l3)
+       b            L(lo0)
+        nop
+
+L(b01):        add     up, 8, up
+       add     rp, -8, rp
+       addcc   %g0, 0, %g3
+       ldx     [rp+8], %o3
+       mulx    %g1, v0, %l6
+       umulxhi(%g1, v0, %l7)
+       brlz    n, L(wd1)
+        nop
+       ldx     [up+0], %o0
+       ldx     [up+8], %o1
+       mulx    %o0, v0, %l0
+       umulxhi(%o0, v0, %l1)
+       b       L(lo1)
+        nop
+
+L(b11):        add     up, 24, up
+       add     rp, 8, rp
+       addcc   %g0, 0, %g3
+       mulx    %g1, v0, %l2
+       umulxhi(%g1, v0, %l3)
+       ldx     [up-8], %o1
+       ldx     [rp-8], %o3
+       mulx    %g4, v0, %l4
+       umulxhi(%g4, v0, %l5)
+       brlz    n, L(end)
+        nop
+
+       ALIGN(16)
+L(top):        ldx     [up+0], %o0
+       addxccc(%g3, %l2, %g1)
+       ldx     [rp+0], %o2
+       addxc(  %g0, %l3, %g3)
+       mulx    %o1, v0, %l6
+       subcc   %o3, %g1, %g4
+       umulxhi(%o1, v0, %l7)
+       stx     %g4, [rp-8]
+L(lo2):        ldx     [up+8], %o1
+       addxccc(%g3, %l4, %g1)
+       ldx     [rp+8], %o3
+       addxc(  %g0, %l5, %g3)
+       mulx    %o0, v0, %l0
+       subcc   %o2, %g1, %g4
+       umulxhi(%o0, v0, %l1)
+       stx     %g4, [rp+0]
+L(lo1):        ldx     [up+16], %o0
+       addxccc(%g3, %l6, %g1)
+       ldx     [rp+16], %o2
+       addxc(  %g0, %l7, %g3)
+       mulx    %o1, v0, %l2
+       subcc   %o3, %g1, %g4
+       umulxhi(%o1, v0, %l3)
+       stx     %g4, [rp+8]
+L(lo0):        ldx     [up+24], %o1
+       addxccc(%g3, %l0, %g1)
+       ldx     [rp+24], %o3
+       addxc(  %g0, %l1, %g3)
+       mulx    %o0, v0, %l4
+       subcc   %o2, %g1, %g4
+       umulxhi(%o0, v0, %l5)
+       stx     %g4, [rp+16]
+       add     n, -4, n
+       add     up, 32, up
+       brgez   n, L(top)
+        add    rp, 32, rp
+
+L(end):        addxccc(%g3, %l2, %g1)
+       ldx     [rp+0], %o2
+       addxc(  %g0, %l3, %g3)
+       mulx    %o1, v0, %l6
+       subcc   %o3, %g1, %g4
+       umulxhi(%o1, v0, %l7)
+       stx     %g4, [rp-8]
+L(wd2):        addxccc(%g3, %l4, %g1)
+       ldx     [rp+8], %o3
+       addxc(  %g0, %l5, %g3)
+       subcc   %o2, %g1, %g4
+       stx     %g4, [rp+0]
+L(wd1):        addxccc(%g3, %l6, %g1)
+       addxc(  %g0, %l7, %g3)
+       subcc   %o3, %g1, %g4
+       stx     %g4, [rp+8]
+       addxc(  %g0, %g3, %i0)
+       ret
+        restore
+EPILOGUE()
index e28a4add32c643459ced72107b2b6604e61b7338..08ed60b9be089223bc65bec52533a32b3251761e 100644 (file)
@@ -3,19 +3,30 @@ dnl  ARM/Thumb mpn_add_n.
 dnl  Copyright 1997, 2000, 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 the GNU Lesser General Public License as published by
-dnl  the Free Software Foundation; either version 3 of the License, or (at your
-dnl  option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 7ba73755203f928c2c8a973723db91d802da96f9..a38572048eef7e3566725dc4b2c027496c6cb0d5 100644 (file)
@@ -3,19 +3,30 @@ dnl  ARM/Thumb mpn_sub_n.
 dnl  Copyright 1997, 2000, 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 the GNU Lesser General Public License as published by
-dnl  the Free Software Foundation; either version 3 of the License, or (at your
-dnl  option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 1854bec6a23fa1460733dbc42e0d9523927c8ef9..0a0bf78ab345d40b32ab8fff44ca17a3f49fc634 100644 (file)
@@ -4,19 +4,30 @@ dnl  in a third limb vector.
 dnl  Copyright 1999, 2000, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index a4bd311c13478a1e40a1ab91207b55af5ad8f20a..8a6f636bdf0ada02f6ba401b897a62241096d3bb 100644 (file)
@@ -4,19 +4,30 @@ dnl  to a second limb vector.
 dnl  Copyright 1992, 1994, 1996, 2000, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 4946c98dc4a4dc6d4adfd6b30dc006c077efa1a1..e04f0bafc9ffc58b4931ab4561b2adcaf610e9c1 100644 (file)
@@ -3,21 +3,32 @@ divert(-1)
 dnl  m4 macros for VAX assembler.
 
 dnl  Copyright 2001, 2012 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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/.
 
 
 defreg(r0,`%r``''0')
index f4362822c16222f520bafcbf1784c1800ee895f7..9f20b9b783e669496bd91c7d0a15f40315c4ce6b 100644 (file)
@@ -1,24 +1,35 @@
 /* VAX gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* These numbers were measured manually using the tune/speed program.
-   The standard tune/tunup takes too long.  (VAX 8800) */
+   The standard tune/tuneup takes too long.  (VAX 8800) */
 
 #define MUL_TOOM22_THRESHOLD             14
 #define MUL_TOOM33_THRESHOLD            110
index dd22c64a6b3d7f7506c47fcd368cc147e9852ede..941e9994b87cb83432c9ba361243aafdd1599e0b 100644 (file)
@@ -1,21 +1,32 @@
 dnl  VAX mpn_lshift -- left shift.
 
-dnl  Copyright 1999, 2000, 2001, 2012 Free Software Foundation, Inc.
+dnl  Copyright 1999-2001, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 158847676cbef2a44d75d02e5871b029cb9a5257..8e4dcd217758ff52798b5ef66056f757ba604a99 100644 (file)
@@ -4,19 +4,30 @@ dnl  in a second limb vector.
 dnl  Copyright 1992, 1994, 1996, 2000, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index ffa880640f6632a8ec4ef81117afc346480991c9..00b2daac01e5d15fa4973cdff934ac48c114702a 100644 (file)
@@ -1,21 +1,32 @@
 dnl  VAX mpn_rshift -- right shift.
 
-dnl  Copyright 1999, 2000, 2001, 2012 Free Software Foundation, Inc.
+dnl  Copyright 1999-2001, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 45044979332ff079cad278ac5fde7483ef74a3a2..2844ef2cc1c537622e8b1a91dc9b452caea4e3ab 100644 (file)
@@ -4,19 +4,30 @@ dnl  store difference in a third limb vector.
 dnl  Copyright 1999, 2000, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 06277d1d9b5bc2e05f0cf974a614b74741d402bc..60d47fcd6f73c0e6b2d8dc29e386c0ba8a1fad6c 100644 (file)
@@ -4,19 +4,30 @@ dnl  result from a second limb vector.
 dnl  Copyright 1992, 1994, 1996, 2000, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 883db227d284e0d45dcbb708d51bb4628945882d..8d7ac9080ddcf6ef3ab31488493b9147ca0ed17a 100644 (file)
@@ -1,19 +1,30 @@
-Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index a0412c9390cb78b0dc7b9edd62a36b040cfaab7a..5d359f59b6583f9e3ab73496e7149725d90de9a3 100644 (file)
@@ -1,22 +1,32 @@
 dnl  x86 mpn_add_n/mpn_sub_n -- mpn addition and subtraction.
 
-dnl  Copyright 1992, 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
-dnl  Foundation, Inc.
-dnl
+dnl  Copyright 1992, 1994-1996, 1999-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index de49443d6cbdc3aeb5a24f434f58ab38650942c7..54a8905441d63ad418dab51a22f807844a5235fc 100644 (file)
@@ -1,23 +1,33 @@
 dnl  x86 __gmpn_addmul_1 (for 386 and 486) -- Multiply a limb vector with a
 dnl  limb and add the result to a second limb vector.
 
-dnl  Copyright 1992, 1994, 1997, 1999, 2000, 2001, 2002, 2005 Free Software
-dnl  Foundation, Inc.
-dnl
+dnl  Copyright 1992, 1994, 1997, 1999-2002, 2005 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 596c3db612b1576f54d39fcc75a08361484a7b0a..cd1a650022f6d3fbc4a6a2603d1fc0c5ce2364eb 100644 (file)
@@ -3,21 +3,32 @@ dnl  Intel Atom mpn_rsblsh1_n -- rp[] = (vp[] << 1) - up[]
 dnl  Contributed to the GNU project by Marco Bodrato.
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 01245fea1ea5abea34a49d0c9cd7db7ba54568ae..10f4419de9e7a4230a53fa2d1e7578df751e988c 100644 (file)
@@ -3,21 +3,32 @@ dnl  Intel Atom mpn_addlsh2_n/mpn_rsblsh2_n -- rp[] = (vp[] << 2) +- up[]
 dnl  Contributed to the GNU project by Marco Bodrato.
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index c24dcd8bf0d98e6f3480742e8112b67165efee67..71cfe490d6e8736f4e036e0f8cd00ecfe9b89508 100644 (file)
@@ -3,21 +3,32 @@ dnl  Intel Atom mpn_addlshC_n/mpn_rsblshC_n -- rp[] = (vp[] << C) +- up[]
 dnl  Contributed to the GNU project by Marco Bodrato.
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 64f982e91c1f23943e244817d4f7b6ab6f32f88c..45ec287c3a173c1fc309226e2460ee24b267ddb9 100644 (file)
@@ -5,19 +5,30 @@ dnl  Copyright 2011 Free Software Foundation, Inc.
 dnl  Contributed to the GNU project by Marco Bodrato.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 5d6ac986c57870242359ec03ad284ef44e900704..75ace65e513e7b1e1de5290a7ded3f9a89f977d9 100644 (file)
@@ -3,21 +3,32 @@ dnl  Intel Atom mpn_addlshC_n/mpn_sublshC_n -- rp[] = up[] +- (vp[] << C)
 dnl  Contributed to the GNU project by Marco Bodrato.
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 19e7a4e1b1f51126f3d268539d63d42ddd22d4fb..31e908ec446d45a66f6346453b16ded1c33cdd35 100644 (file)
@@ -2,21 +2,32 @@ dnl  Intel Atom mpn_bdiv_q_1, mpn_pi1_bdiv_q_1 -- schoolbook Hensel
 dnl  division by 1-limb divisor, returning quotient only.
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86/atom/cnd_add_n.asm b/mpn/x86/atom/cnd_add_n.asm
new file mode 100644 (file)
index 0000000..50bf2ad
--- /dev/null
@@ -0,0 +1,113 @@
+dnl  X86 mpn_cnd_add_n optimised for Intel Atom.
+
+dnl  Copyright 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 P5                            ?
+C P6 model 0-8,10-12            ?
+C P6 model 9   (Banias)                 ?
+C P6 model 13  (Dothan)                 ?
+C P4 model 0-1 (Willamette)     ?
+C P4 model 2   (Northwood)      ?
+C P4 model 3-4 (Prescott)       ?
+C Intel atom                    4.67
+C AMD K6                        ?
+C AMD K7                        ?
+C AMD K8                        ?
+
+
+define(`rp',  `%edi')
+define(`up',  `%esi')
+define(`vp',  `%ebp')
+define(`n',   `%ecx')
+define(`cnd', `20(%esp)')
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_cnd_add_n)
+       push    %edi
+       push    %esi
+       push    %ebx
+       push    %ebp
+
+       mov     cnd, %eax               C make cnd into a mask (1)
+       mov     24(%esp), rp
+       neg     %eax                    C make cnd into a mask (1)
+       mov     28(%esp), up
+       sbb     %eax, %eax              C make cnd into a mask (1)
+       mov     32(%esp), vp
+       mov     %eax, cnd               C make cnd into a mask (1)
+       mov     36(%esp), n
+
+       xor     %edx, %edx
+
+       shr     $1, n
+       jnc     L(top)
+
+       mov     0(vp), %eax
+       and     cnd, %eax
+       lea     4(vp), vp
+       add     0(up), %eax
+       lea     4(rp), rp
+       lea     4(up), up
+       sbb     %edx, %edx
+       mov     %eax, -4(rp)
+       inc     n
+       dec     n
+       je      L(end)
+
+L(top):        sbb     %edx, %edx
+       mov     0(vp), %eax
+       and     cnd, %eax
+       lea     8(vp), vp
+       lea     8(rp), rp
+       mov     -4(vp), %ebx
+       and     cnd, %ebx
+       add     %edx, %edx
+       adc     0(up), %eax
+       lea     8(up), up
+       mov     %eax, -8(rp)
+       adc     -4(up), %ebx
+       dec     n
+       mov     %ebx, -4(rp)
+       jne     L(top)
+
+L(end):        mov     $0, %eax
+       adc     %eax, %eax
+
+       pop     %ebp
+       pop     %ebx
+       pop     %esi
+       pop     %edi
+       ret
+EPILOGUE()
+ASM_END()
diff --git a/mpn/x86/atom/cnd_sub_n.asm b/mpn/x86/atom/cnd_sub_n.asm
new file mode 100644 (file)
index 0000000..221bedc
--- /dev/null
@@ -0,0 +1,124 @@
+dnl  X86 mpn_cnd_sub_n optimised for Intel Atom.
+
+dnl  Copyright 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 P5                            ?
+C P6 model 0-8,10-12            ?
+C P6 model 9   (Banias)                 ?
+C P6 model 13  (Dothan)                 ?
+C P4 model 0-1 (Willamette)     ?
+C P4 model 2   (Northwood)      ?
+C P4 model 3-4 (Prescott)       ?
+C Intel atom                    5.67
+C AMD K6                        ?
+C AMD K7                        ?
+C AMD K8                        ?
+
+
+define(`rp',  `%edi')
+define(`up',  `%esi')
+define(`vp',  `%ebp')
+define(`n',   `%ecx')
+define(`cnd', `20(%esp)')
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_cnd_sub_n)
+       push    %edi
+       push    %esi
+       push    %ebx
+       push    %ebp
+
+       mov     cnd, %eax               C make cnd into a mask (1)
+       mov     24(%esp), rp
+       neg     %eax                    C make cnd into a mask (1)
+       mov     28(%esp), up
+       sbb     %eax, %eax              C make cnd into a mask (1)
+       mov     32(%esp), vp
+       mov     %eax, cnd               C make cnd into a mask (1)
+       mov     36(%esp), n
+
+       xor     %edx, %edx
+
+       inc     n
+       shr     n
+       jnc     L(ent)
+
+       mov     0(vp), %eax
+       and     cnd, %eax
+       lea     4(vp), vp
+       mov     0(up), %edx
+       sub     %eax, %edx
+       lea     4(rp), rp
+       lea     4(up), up
+       mov     %edx, -4(rp)
+       sbb     %edx, %edx              C save cy
+
+L(ent):        mov     0(vp), %ebx
+       and     cnd, %ebx
+       add     %edx, %edx              C restore cy
+       mov     0(up), %edx
+       dec     n
+       je      L(end)
+
+L(top):        sbb     %ebx, %edx
+       mov     4(vp), %eax
+       mov     %edx, 0(rp)
+       sbb     %edx, %edx              C save cy
+       mov     8(vp), %ebx
+       lea     8(up), up
+       and     cnd, %ebx
+       and     cnd, %eax
+       add     %edx, %edx              C restore cy
+       mov     -4(up), %edx
+       lea     8(rp), rp
+       sbb     %eax, %edx
+       mov     %edx, -4(rp)
+       dec     n
+       mov     0(up), %edx
+       lea     8(vp), vp
+       jne     L(top)
+
+L(end):        sbb     %ebx, %edx
+       mov     %edx, 0(rp)
+
+       mov     $0, %eax
+       adc     %eax, %eax
+
+       pop     %ebp
+       pop     %ebx
+       pop     %esi
+       pop     %edi
+       ret
+EPILOGUE()
+ASM_END()
index c7c5a8983442ca6d2cb1ee2920599fd6671d2f04..71036a15a4d5e8f65b7378bcc6aebcc6d7b0177a 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Atom mpn_divexact_1 -- mpn by limb exact division.
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 61ce540dcbb92d6ebd32f2d328a82c2b51be6218..45df12806c0dbdc0c853d93a7b2587592acd4884 100644 (file)
 /* Intel Atom/32 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
-/* Generated by tuneup.c */
+/* 1667 MHz Pineview (Atom D510) */
+/* FFT tuning limit = 25000000 */
+/* Generated by tuneup.c, 2014-03-14, gcc 4.5 */
 
-#define MOD_1_NORM_THRESHOLD                 4
-#define MOD_1_UNNORM_THRESHOLD               8
-#define MOD_1N_TO_MOD_1_1_THRESHOLD          7
-#define MOD_1U_TO_MOD_1_1_THRESHOLD          4
+#define MOD_1_NORM_THRESHOLD                 3
+#define MOD_1_UNNORM_THRESHOLD               5
+#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     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              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           33
+#define BMOD_1_TO_MOD_1_THRESHOLD           31
 
-#define MUL_TOOM22_THRESHOLD                22
-#define MUL_TOOM33_THRESHOLD                81
+#define MUL_TOOM22_THRESHOLD                20
+#define MUL_TOOM33_THRESHOLD                74
 #define MUL_TOOM44_THRESHOLD               178
 #define MUL_TOOM6H_THRESHOLD               270
-#define MUL_TOOM8H_THRESHOLD               406
+#define MUL_TOOM8H_THRESHOLD               399
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD      85
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     126
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD     121
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD     129
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD     113
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD      73
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD     122
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD     115
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD     127
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     106
 
 #define SQR_BASECASE_THRESHOLD               0  /* always (native) */
-#define SQR_TOOM2_THRESHOLD                 32
-#define SQR_TOOM3_THRESHOLD                109
-#define SQR_TOOM4_THRESHOLD                262
-#define SQR_TOOM6_THRESHOLD                396
-#define SQR_TOOM8_THRESHOLD                547
+#define SQR_TOOM2_THRESHOLD                 30
+#define SQR_TOOM3_THRESHOLD                105
+#define SQR_TOOM4_THRESHOLD                178
+#define SQR_TOOM6_THRESHOLD                303
+#define SQR_TOOM8_THRESHOLD                527
 
 #define MULMID_TOOM42_THRESHOLD             54
 
-#define MULMOD_BNM1_THRESHOLD               16
+#define MULMOD_BNM1_THRESHOLD               13
 #define SQRMOD_BNM1_THRESHOLD               18
 
-#define MUL_FFT_MODF_THRESHOLD             404  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             380  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    376, 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}, {     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}, {    127, 8}, {    255, 9}, \
-    {    135,10}, {     79, 9}, {    159,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,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,11}, \
-    {    191,10}, {    383, 9}, {    767,10}, {    415,11}, \
-    {    223,10}, {    447,12}, {   4096,13}, {   8192,14}, \
+  { {    380, 5}, {     19, 6}, {     10, 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}, {     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}, \
+    {    127, 8}, {    255, 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,10}, {    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}, {    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}, {    127,11}, {    255,10}, \
+    {    543,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}, {    735,12}, {    383,11}, {    831,12}, \
+    {    447,11}, {    959,13}, {    255,12}, {    511,11}, \
+    {   1087,12}, {    575,11}, {   1151,12}, {    703,11}, \
+    {   1471,13}, {    383,12}, {    831,11}, {   1663,12}, \
+    {    959,14}, {    255,13}, {    511,12}, {   1215,13}, \
+    {    639,12}, {   1471,11}, {   2943,13}, {    767,12}, \
+    {   1663,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}, \
     {  16384,15}, {  32768,16} }
-#define MUL_FFT_TABLE3_SIZE 86
+#define MUL_FFT_TABLE3_SIZE 150
 #define MUL_FFT_THRESHOLD                 4544
 
 #define SQR_FFT_MODF_THRESHOLD             340  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    280, 5}, {     19, 6}, {     10, 5}, {     21, 6}, \
-    {     17, 7}, {      9, 6}, {     21, 7}, {     11, 6}, \
-    {     24, 7}, {     13, 6}, {     27, 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, 7}, {    511,10}, \
-    {     79, 9}, {    159, 8}, {    319, 9}, {    175,10}, \
-    {     95, 9}, {    191, 8}, {    383, 9}, {    207,11}, \
-    {     63,10}, {    127, 9}, {    255, 8}, {    511, 9}, \
-    {    271,10}, {    143, 9}, {    287,10}, {    159, 9}, \
-    {    319,10}, {    175,11}, {     95,10}, {    191, 9}, \
-    {    383,10}, {    207,12}, {     63,11}, {    127,10}, \
-    {    255, 9}, {    511,10}, {    271, 9}, {    543,10}, \
-    {    287,11}, {    159,10}, {    319, 9}, {    639,10}, \
-    {    351, 9}, {    703,11}, {    191,10}, {    415,11}, \
-    {    223,10}, {    479,12}, {   4096,13}, {   8192,14}, \
-    {  16384,15}, {  32768,16} }
-#define SQR_FFT_TABLE3_SIZE 82
-#define SQR_FFT_THRESHOLD                 3712
+  { {    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}, {     35, 8}, {     19, 7}, {     41, 8}, \
+    {     23, 7}, {     47, 8}, {     27, 9}, {     15, 8}, \
+    {     39, 9}, {     23, 8}, {     51,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,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,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,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,11}, {   1407,13}, \
+    {    383,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}, {   1407,14}, {    767,13}, \
+    {   1663,12}, {   3455,13}, {   1791,15}, {    511,14}, \
+    {   1023,13}, {   2431,14}, {   1279,13}, {   2943,12}, \
+    {   5887,14}, {  16384,15}, {  32768,16} }
+#define SQR_FFT_TABLE3_SIZE 151
+#define SQR_FFT_THRESHOLD                 2880
 
 #define MULLO_BASECASE_THRESHOLD             6
-#define MULLO_DC_THRESHOLD                  53
+#define MULLO_DC_THRESHOLD                  48
 #define MULLO_MUL_N_THRESHOLD             8907
 
-#define DC_DIV_QR_THRESHOLD                 63
-#define DC_DIVAPPR_Q_THRESHOLD             266
-#define DC_BDIV_QR_THRESHOLD                63
-#define DC_BDIV_Q_THRESHOLD                175
+#define DC_DIV_QR_THRESHOLD                 59
+#define DC_DIVAPPR_Q_THRESHOLD             250
+#define DC_BDIV_QR_THRESHOLD                59
+#define DC_BDIV_Q_THRESHOLD                169
 
-#define INV_MULMOD_BNM1_THRESHOLD           42
-#define INV_NEWTON_THRESHOLD               250
-#define INV_APPR_THRESHOLD                 250
+#define INV_MULMOD_BNM1_THRESHOLD           38
+#define INV_NEWTON_THRESHOLD               246
+#define INV_APPR_THRESHOLD                 246
 
-#define BINV_NEWTON_THRESHOLD              274
-#define REDC_1_TO_REDC_N_THRESHOLD          68
+#define BINV_NEWTON_THRESHOLD              276
+#define REDC_1_TO_REDC_N_THRESHOLD          67
 
 #define MU_DIV_QR_THRESHOLD               1334
 #define MU_DIVAPPR_Q_THRESHOLD            1442
 #define MUPI_DIV_QR_THRESHOLD              114
-#define MU_BDIV_QR_THRESHOLD              1078
+#define MU_BDIV_QR_THRESHOLD              1142
 #define MU_BDIV_Q_THRESHOLD               1334
 
-#define POWM_SEC_TABLE  4,35,258,1084
+#define POWM_SEC_TABLE  1,22,98,416,1378
 
-#define MATRIX22_STRASSEN_THRESHOLD         15
-#define HGCD_THRESHOLD                     135
-#define HGCD_APPR_THRESHOLD                164
-#define HGCD_REDUCE_THRESHOLD             2384
-#define GCD_DC_THRESHOLD                   487
+#define MATRIX22_STRASSEN_THRESHOLD         13
+#define HGCD_THRESHOLD                     133
+#define HGCD_APPR_THRESHOLD                169
+#define HGCD_REDUCE_THRESHOLD             2479
+#define GCD_DC_THRESHOLD                   460
 #define GCDEXT_DC_THRESHOLD                342
 #define JACOBI_BASE_METHOD                   3
 
 #define GET_STR_DC_THRESHOLD                12
-#define GET_STR_PRECOMPUTE_THRESHOLD        27
-#define SET_STR_DC_THRESHOLD               324
-#define SET_STR_PRECOMPUTE_THRESHOLD      1290
+#define GET_STR_PRECOMPUTE_THRESHOLD        23
+#define SET_STR_DC_THRESHOLD               321
+#define SET_STR_PRECOMPUTE_THRESHOLD      1099
 
-#define FAC_DSC_THRESHOLD                  250
+#define FAC_DSC_THRESHOLD                  198
 #define FAC_ODD_THRESHOLD                   34
index 2633639883a439924b223da7936b90fcbec19fcf..3cb6d7310c2ce496ad6491fd74bcd1e26d83a94c 100644 (file)
@@ -5,19 +5,30 @@ dnl  Copyright 2011 Free Software Foundation, Inc.
 dnl  Contributed to the GNU project by Marco Bodrato.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 1005cce5993e6433280ee4a8dd2cf4070256416f..f2c70dd3e85c24e293c026302ef2d542aaef9eff 100644 (file)
@@ -6,18 +6,29 @@ dnl  Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
 
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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 MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or
+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')
 
index f26e2713f17f0ee38b9b0fd177ee20c658844e93..5be53ed19d483306a59978d0b6b7a322662834db 100644 (file)
@@ -6,18 +6,29 @@ dnl  Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
 
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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 MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or
+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')
 
index 0c46e5bd7f3cfd576035358b26a8e92025bd8110..b80fb033fecec37f81e47b815f5bab0e5b20cb44 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Atom mpn_copyd -- copy limb vector, decrementing.
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 855ab81d3f17916c4d76ebae8ee776197ea7c758..49b6b8d662eeaa744854028fd65e225e16f18c21 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Atom mpn_copyi -- copy limb vector, incrementing.
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index d1d96dbd805a5944c9f5f901e5773d18aefa6d75..3fe8253240411760483be3842e8c917a20446bea 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Atom mpn_hamdist -- hamming distance.
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index cc807ed7198e8091f5297822af3c8a5f88f65ef3..6d57ba385df30dcd5913b8ac47b088ff263c1698 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Atom mpn_mod_34lsub1 -- remainder modulo 2^24-1.
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 0c06d042e4370eae1fd797491cf5ebdbbd4d9eed..c9ee6bd2db3e4b0798b6cb3db7fcd68ee4e8a370 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Atom mpn_modexact_1_odd -- exact division style remainder.
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index ab0e39acdea7c880da973c60f1230319d22c9936..1cb5dbefe9b9ee63e5fb4b41bff81113ca5f4d1b 100644 (file)
@@ -6,18 +6,29 @@ dnl  Converted from AMD64 by Marco Bodrato.
 
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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 MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or
+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')
 
index c1e537309ec5f491b74517b292345c519ae11d95..969a14a9196380c6bb166c186df38877d216ce9a 100644 (file)
@@ -1,23 +1,34 @@
 dnl x86-32 mpn_addmul_1 and mpn_submul_1 optimised for Intel Atom.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
-dnl
+
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 1e5c147d0100afcbc56e6a44d1ef76e668641dd5..782e914019c2be234d1148ca93ca175023160453 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Atom  mpn_bdiv_dbm1.
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 2edcf2e3def7da7e050015f5fbf4e06eb9563529..f84709a22e42c5759023527da73fb6edf7553396 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Atom mpn_divrem_1 -- mpn by limb division.
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 4b8c410fa13f695d2c3c1c05f74e66cd998e7bdd..ae6581d9b651d5c7ff3de1b6b576c1786f7c3a31 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Atom/SSE2 mpn_mod_1_1.
 
 dnl  Copyright 2009, 2011 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 056700ae012c64d6701a7adeff8902914ef31078..31faa3f0a3c9ad704ae446f363f9de350f6e57cc 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Atom/SSE2 mpn_mod_1_4.
 
 dnl  Copyright 2009, 2011 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 5cd86caecffa890b5163f72769de61521fda348d..aa3bb974bb5c3ac98b8c221af4915f39ce457119 100644 (file)
@@ -1,23 +1,34 @@
 dnl  Intel Atom mpn_mul_1.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
-dnl
+
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index ffd05b619efaf3bd72eecebf978c39626a19e7ac..97d3aeb5ad71571313a36f71d86550d45d5ba9ab 100644 (file)
@@ -2,23 +2,34 @@ dnl  x86 mpn_mul_basecase -- Multiply two limb vectors and store the result in
 dnl  a third limb vector.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
-dnl
+
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 997616c2a3173fe90699ea2cb7e7feaf9b55d2dd..7847aec8e664b7f15ce5796b4af35350d8f2c3bf 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Atom mpn_popcount -- population count.
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 603229326455b7fda12a2bd57911f55daac474d9..af19ed854d98b4517eccfc57447da6133f6057af 100644 (file)
@@ -1,23 +1,34 @@
 dnl  x86 mpn_sqr_basecase -- square an mpn number, optimised for atom.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
-dnl
+
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index e41bb91dac4a455b574284a245d1a930bedf0f0a..d3e7e5b5cbd145aabfc7139a53107130ab2039ee 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Atom mpn_sublsh1_n -- rp[] = up[] - (vp[] << 1)
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 90800dc30edf69d22317ebf8492a720f3444ee58..79405cf9f4b0f80683ad4db8ea1e1cee50d011ba 100644 (file)
@@ -3,21 +3,32 @@ dnl  Intel Atom mpn_addlsh2_n/mpn_sublsh2_n -- rp[] = up[] +- (vp[] << 2).
 dnl  Contributed to the GNU project by Marco Bodrato.
 
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86/bd1/gmp-mparam.h b/mpn/x86/bd1/gmp-mparam.h
new file mode 100644 (file)
index 0000000..7d80a1c
--- /dev/null
@@ -0,0 +1,208 @@
+/* AMD bd2 gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 1991, 1993, 1994, 2000-2005, 2008-2010, 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
+
+/* 3600 MHz Bulldozer Zambezi */
+/* FFT tuning limit = 25000000 */
+/* Generated by tuneup.c, 2014-03-13, gcc 4.5 */
+
+#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          4
+#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     11
+#define USE_PREINV_DIVREM_1                  1  /* native */
+#define DIV_QR_1N_PI1_METHOD                 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 DIVEXACT_1_THRESHOLD                 0  /* always (native) */
+#define BMOD_1_TO_MOD_1_THRESHOLD           27
+
+#define MUL_TOOM22_THRESHOLD                32
+#define MUL_TOOM33_THRESHOLD                65
+#define MUL_TOOM44_THRESHOLD               154
+#define MUL_TOOM6H_THRESHOLD               230
+#define MUL_TOOM8H_THRESHOLD               354
+
+#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_TOOM43_TO_TOOM54_THRESHOLD     130
+
+#define SQR_BASECASE_THRESHOLD               0  /* always (native) */
+#define SQR_TOOM2_THRESHOLD                 48
+#define SQR_TOOM3_THRESHOLD                 87
+#define SQR_TOOM4_THRESHOLD                204
+#define SQR_TOOM6_THRESHOLD                315
+#define SQR_TOOM8_THRESHOLD                430
+
+#define MULMID_TOOM42_THRESHOLD             48
+
+#define MULMOD_BNM1_THRESHOLD               21
+#define SQRMOD_BNM1_THRESHOLD               23
+
+#define MUL_FFT_MODF_THRESHOLD             840  /* k = 5 */
+#define MUL_FFT_TABLE3                                      \
+  { {    840, 5}, {     28, 6}, {     15, 5}, {     33, 6}, \
+    {     28, 7}, {     15, 6}, {     32, 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}, \
+    {   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}, \
+    {    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 */
+#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}, \
+    {     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}, \
+    {    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
+#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 INV_APPR_THRESHOLD                 202
+
+#define BINV_NEWTON_THRESHOLD              236
+#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 POWM_SEC_TABLE  1,22,194,376,692,2657
+
+#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 SET_STR_DC_THRESHOLD               100
+#define SET_STR_PRECOMPUTE_THRESHOLD       960
+
+#define FAC_DSC_THRESHOLD                  208
+#define FAC_ODD_THRESHOLD                   26
diff --git a/mpn/x86/bd2/gmp-mparam.h b/mpn/x86/bd2/gmp-mparam.h
new file mode 100644 (file)
index 0000000..c5a53f2
--- /dev/null
@@ -0,0 +1,209 @@
+/* AMD bd2 gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 1991, 1993, 1994, 2000-2005, 2008-2010, 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
+
+/* 4000 MHz Piledriver Vishera  */
+/* FFT tuning limit = 40000000 */
+/* Generated by tuneup.c, 2014-03-12, gcc 4.8 */
+
+#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_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_1N_PI1_METHOD                 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 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 MUL_TOOM6H_THRESHOLD               222
+#define MUL_TOOM8H_THRESHOLD               357
+
+#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_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 MULMID_TOOM42_THRESHOLD             68
+
+#define MULMOD_BNM1_THRESHOLD               19
+#define SQRMOD_BNM1_THRESHOLD               22
+
+#define MUL_FFT_MODF_THRESHOLD             636  /* k = 5 */
+#define MUL_FFT_TABLE3                                      \
+  { {    636, 5}, {     27, 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}, {     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}, \
+    {    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
+#define MUL_FFT_THRESHOLD                 6784
+
+#define SQR_FFT_MODF_THRESHOLD             606  /* 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}, \
+    {   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
+#define SQR_FFT_THRESHOLD                 5760
+
+#define MULLO_BASECASE_THRESHOLD             3
+#define MULLO_DC_THRESHOLD                  34
+#define MULLO_MUL_N_THRESHOLD            13463
+
+#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 INV_MULMOD_BNM1_THRESHOLD           70
+#define INV_NEWTON_THRESHOLD               262
+#define INV_APPR_THRESHOLD                 222
+
+#define BINV_NEWTON_THRESHOLD              288
+#define REDC_1_TO_REDC_N_THRESHOLD          67
+
+#define MU_DIV_QR_THRESHOLD               1718
+#define MU_DIVAPPR_Q_THRESHOLD            1652
+#define MUPI_DIV_QR_THRESHOLD              122
+#define MU_BDIV_QR_THRESHOLD              1387
+#define MU_BDIV_Q_THRESHOLD               1528
+
+#define POWM_SEC_TABLE  1,16,69,508,1378,2657,2825
+
+#define MATRIX22_STRASSEN_THRESHOLD         19
+#define HGCD_THRESHOLD                      61
+#define HGCD_APPR_THRESHOLD                 50
+#define HGCD_REDUCE_THRESHOLD             3389
+#define GCD_DC_THRESHOLD                   492
+#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 FAC_DSC_THRESHOLD                  141
+#define FAC_ODD_THRESHOLD                   29
index ac9faf270a5d69a5fd0d9d5f9b9811e3e8a46193..0288c475cdc6073135e8d13d49813d7e5f84d15a 100644 (file)
@@ -3,19 +3,30 @@ dnl  x86 mpn_bdiv_dbm1.
 dnl  Copyright 2008, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 7f344ab57294cfed344a5fbd46ac3713548e520a..825cd296a1fc3e429df9ce44e46f6b63c260fe5d 100644 (file)
@@ -1,23 +1,34 @@
 dnl  x86 mpn_bdiv_q_1 -- mpn by limb exact division.
 
+dnl  Rearranged from mpn/x86/dive_1.asm by Marco Bodrato.
+
 dnl  Copyright 2001, 2002, 2007, 2011 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
-dnl  Rearranged from mpn/x86/dive_1.asm by Marco Bodrato.
+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  The GNU MP Library is free software; you can redistribute it and/or
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+dnl  or both in parallel, as here.
 dnl
-dnl  The GNU MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index e14ba39f55a7a3eeafe432e8ada025b0ef3c8e09..198081f9fd82360272b56fc073d55c793316bf54 100644 (file)
 /* x86/bobcat gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
-/* Generated by tuneup.c, 2011-11-25, gcc 4.2 */
+/* 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          9
-#define MOD_1U_TO_MOD_1_1_THRESHOLD          3
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD        12
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD        23
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD     13
+#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           42
+#define BMOD_1_TO_MOD_1_THRESHOLD           40
 
 #define MUL_TOOM22_THRESHOLD                28
 #define MUL_TOOM33_THRESHOLD                90
-#define MUL_TOOM44_THRESHOLD               147
-#define MUL_TOOM6H_THRESHOLD               274
-#define MUL_TOOM8H_THRESHOLD               454
+#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     122
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD      93
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD     113
+#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                 89
-#define SQR_TOOM4_THRESHOLD                220
+#define SQR_TOOM3_THRESHOLD                121
+#define SQR_TOOM4_THRESHOLD                212
 #define SQR_TOOM6_THRESHOLD                303
 #define SQR_TOOM8_THRESHOLD                454
 
-#define MULMID_TOOM42_THRESHOLD             76
+#define MULMID_TOOM42_THRESHOLD             74
 
-#define MULMOD_BNM1_THRESHOLD               19
+#define MULMOD_BNM1_THRESHOLD               18
 #define SQRMOD_BNM1_THRESHOLD               23
 
-#define POWM_SEC_TABLE  4,14,290,357,2178
-
-#define MUL_FFT_MODF_THRESHOLD             888  /* k = 6 */
+#define MUL_FFT_MODF_THRESHOLD             660  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    888, 6}, {     25, 7}, {     13, 6}, {     27, 7}, \
-    {     15, 6}, {     33, 7}, {     17, 6}, {     35, 7}, \
-    {     19, 6}, {     39, 7}, {     23, 6}, {     47, 7}, \
-    {     27, 8}, {     15, 7}, {     31, 6}, {     63, 7}, \
-    {     35, 8}, {     19, 7}, {     41, 8}, {     23, 7}, \
-    {     49, 8}, {     31, 7}, {     63, 8}, {     39, 7}, \
-    {     79, 8}, {     43, 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}, {     79,10}, {     47, 9}, \
-    {     95,11}, {     31,10}, {     63, 9}, {    135,10}, \
-    {     79, 9}, {    159,10}, {     95, 9}, {    191,11}, \
-    {     63,10}, {    127, 9}, {    255,10}, {    159,11}, \
+  { {    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,10}, {    319, 9}, {    671,11}, {    191,10}, \
-    {    383, 9}, {    767,12}, {   4096,13}, {   8192,14}, \
-    {  16384,15}, {  32768,16} }
-#define MUL_FFT_TABLE3_SIZE 70
+    {    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             723  /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD             606  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    723, 5}, {     25, 6}, {     13, 5}, {     28, 6}, \
-    {     15, 5}, {     31, 6}, {     27, 7}, {     15, 6}, \
-    {     33, 7}, {     17, 6}, {     35, 7}, {     19, 6}, \
-    {     39, 7}, {     23, 6}, {     47, 7}, {     27, 8}, \
-    {     15, 7}, {     31, 6}, {     63, 7}, {     35, 8}, \
-    {     19, 7}, {     41, 8}, {     23, 7}, {     47, 8}, \
+  { {    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}, \
-    {     47, 7}, {     95, 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}, {     95,11}, {     31,10}, \
-    {     63, 9}, {    135,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}, {    543,11}, \
-    {    159, 9}, {    671,11}, {    191,10}, {    383, 9}, \
-    {    799,12}, {   4096,13}, {   8192,14}, {  16384,15}, \
-    {  32768,16} }
-#define SQR_FFT_TABLE3_SIZE 69
+    {     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            13463
+#define MULLO_MUL_N_THRESHOLD            14281
 
-#define DC_DIV_QR_THRESHOLD                 75
-#define DC_DIVAPPR_Q_THRESHOLD             216
+#define DC_DIV_QR_THRESHOLD                 71
+#define DC_DIVAPPR_Q_THRESHOLD             238
 #define DC_BDIV_QR_THRESHOLD                67
-#define DC_BDIV_Q_THRESHOLD                143
+#define DC_BDIV_Q_THRESHOLD                151
 
-#define INV_MULMOD_BNM1_THRESHOLD           75
-#define INV_NEWTON_THRESHOLD               244
-#define INV_APPR_THRESHOLD                 228
+#define INV_MULMOD_BNM1_THRESHOLD           66
+#define INV_NEWTON_THRESHOLD               228
+#define INV_APPR_THRESHOLD                 222
 
-#define BINV_NEWTON_THRESHOLD              276
+#define BINV_NEWTON_THRESHOLD              270
 #define REDC_1_TO_REDC_N_THRESHOLD          71
 
-#define MU_DIV_QR_THRESHOLD               1858
-#define MU_DIVAPPR_Q_THRESHOLD            1822
-#define MUPI_DIV_QR_THRESHOLD              122
-#define MU_BDIV_QR_THRESHOLD              1787
-#define MU_BDIV_Q_THRESHOLD               1787
-
-#define MATRIX22_STRASSEN_THRESHOLD         19
-#define HGCD_THRESHOLD                      78
-#define HGCD_APPR_THRESHOLD                 55
-#define HGCD_REDUCE_THRESHOLD             4633
-#define GCD_DC_THRESHOLD                   474
+#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                14
-#define GET_STR_PRECOMPUTE_THRESHOLD        31
+#define GET_STR_DC_THRESHOLD                18
+#define GET_STR_PRECOMPUTE_THRESHOLD        34
 #define SET_STR_DC_THRESHOLD               270
-#define SET_STR_PRECOMPUTE_THRESHOLD       812
+#define SET_STR_PRECOMPUTE_THRESHOLD       828
+
+#define FAC_DSC_THRESHOLD                  256
+#define FAC_ODD_THRESHOLD                   34
diff --git a/mpn/x86/cnd_aors_n.asm b/mpn/x86/cnd_aors_n.asm
new file mode 100644 (file)
index 0000000..74f4917
--- /dev/null
@@ -0,0 +1,124 @@
+dnl  X86 mpn_cnd_add_n, mpn_cnd_sub_n
+
+dnl  Copyright 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 P5                            ?
+C P6 model 0-8,10-12            ?
+C P6 model 9   (Banias)                 ?
+C P6 model 13  (Dothan)                 5.4
+C P4 model 0-1 (Willamette)     ?
+C P4 model 2   (Northwood)     14.5
+C P4 model 3-4 (Prescott)      21
+C Intel atom                   11
+C AMD K6                        ?
+C AMD K7                        3.4
+C AMD K8                        ?
+
+
+define(`rp',  `%edi')
+define(`up',  `%esi')
+define(`vp',  `%ebp')
+define(`n',   `%ecx')
+define(`cnd', `20(%esp)')
+define(`cy',  `%edx')
+
+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)
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(func)
+       add     $-16, %esp
+       mov     %ebp, (%esp)
+       mov     %ebx, 4(%esp)
+       mov     %esi, 8(%esp)
+       mov     %edi, 12(%esp)
+
+       C make cnd into a full mask
+       mov     cnd, %eax
+       neg     %eax
+       sbb     %eax, %eax
+       mov     %eax, cnd
+
+       C load parameters into registers
+       mov     24(%esp), rp
+       mov     28(%esp), up
+       mov     32(%esp), vp
+       mov     36(%esp), n
+
+       mov     (vp), %eax
+       mov     (up), %ebx
+
+       C put operand pointers just beyond their last limb
+       lea     (vp,n,4), vp
+       lea     (up,n,4), up
+       lea     -4(rp,n,4), rp
+       neg     n
+
+       and     cnd, %eax
+       ADDSUB  %eax, %ebx
+       sbb     cy, cy
+       inc     n
+       je      L(end)
+
+       ALIGN(16)
+L(top):        mov     (vp,n,4), %eax
+       and     cnd, %eax
+       mov     %ebx, (rp,n,4)
+       mov     (up,n,4), %ebx
+       add     cy, cy
+       ADCSBB  %eax, %ebx
+       sbb     cy, cy
+       inc     n
+       jne     L(top)
+
+L(end):        mov     %ebx, (rp)
+       xor     %eax, %eax
+       sub     cy, %eax
+
+       mov     (%esp), %ebp
+       mov     4(%esp), %ebx
+       mov     8(%esp), %esi
+       mov     12(%esp), %edi
+       add     $16, %esp
+       ret
+EPILOGUE()
+ASM_END()
index c2215ef37db1e67b1520f002e3932120678b7382..51fa19568b0bb11fee59870fb1aef3fb3e2cfedd 100644 (file)
@@ -1,21 +1,32 @@
 dnl  x86 mpn_copyd -- copy limb vector, decrementing.
 
-dnl  Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 542a39eb6401e61d6363b87e014ab1bd2044275d..f6b0354b4fb52e042e3228e600f32b993ff867f9 100644 (file)
@@ -1,21 +1,32 @@
 dnl  x86 mpn_copyi -- copy limb vector, incrementing.
 
-dnl  Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index feb0f281f6ebe95778bfb987a178435bf1295837..b370eb58771d1de8834a244dd64273dcb901b2c8 100644 (file)
 /* x86/core2 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
-/* Generated by tuneup.c, 2011-11-25, gcc 4.2 */
+/* 2133 MHz Core 2 (65nm) */
+/* FFT tuning limit = 25000000 */
+/* Generated by tuneup.c, 2014-03-14, gcc 4.5 */
 
 #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         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 PREINV_MOD_1_TO_MOD_1_THRESHOLD      7
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD     10
 #define USE_PREINV_DIVREM_1                  1  /* native */
+#define DIV_QR_1N_PI1_METHOD                 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 DIVEXACT_1_THRESHOLD                 0  /* always (native) */
 #define BMOD_1_TO_MOD_1_THRESHOLD           19
 
-#define MUL_TOOM22_THRESHOLD                24
-#define MUL_TOOM33_THRESHOLD                93
-#define MUL_TOOM44_THRESHOLD               228
-#define MUL_TOOM6H_THRESHOLD               294
-#define MUL_TOOM8H_THRESHOLD               458
+#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 MUL_TOOM32_TO_TOOM43_THRESHOLD      90
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     114
+#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      96
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD     102
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     136
 
 #define SQR_BASECASE_THRESHOLD               0  /* always (native) */
 #define SQR_TOOM2_THRESHOLD                 34
-#define SQR_TOOM3_THRESHOLD                116
+#define SQR_TOOM3_THRESHOLD                114
 #define SQR_TOOM4_THRESHOLD                178
 #define SQR_TOOM6_THRESHOLD                262
-#define SQR_TOOM8_THRESHOLD                597
+#define SQR_TOOM8_THRESHOLD                357
 
-#define MULMID_TOOM42_THRESHOLD             70
+#define MULMID_TOOM42_THRESHOLD             66
 
-#define MULMOD_BNM1_THRESHOLD               20
-#define SQRMOD_BNM1_THRESHOLD               19
+#define MULMOD_BNM1_THRESHOLD               15
+#define SQRMOD_BNM1_THRESHOLD               21
 
-#define POWM_SEC_TABLE  6,26,262,991,2212
-
-#define MUL_FFT_MODF_THRESHOLD             690  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             600  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    690, 5}, {     25, 6}, {     13, 5}, {     27, 6}, \
-    {     15, 5}, {     31, 6}, {     25, 7}, {     13, 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}, {     47, 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}, \
-    {     95,11}, {     31,10}, {     63, 9}, {    135,10}, \
-    {     79, 9}, {    159,10}, {     95, 9}, {    191,11}, \
-    {     63,10}, {    127, 9}, {    255,10}, {    159,11}, \
+  { {    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,10}, {    287,11}, {    159,10}, \
-    {    319, 9}, {    639,11}, {    191,10}, {    383, 9}, \
-    {    799,11}, {    223,12}, {   4096,13}, {   8192,14}, \
-    {  16384,15}, {  32768,16} }
-#define MUL_FFT_TABLE3_SIZE 70
-#define MUL_FFT_THRESHOLD                 7552
-
-#define SQR_FFT_MODF_THRESHOLD             630  /* k = 5 */
+    {    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}, \
+    {    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}, \
+    {   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
+#define MUL_FFT_THRESHOLD                 6784
+
+#define SQR_FFT_MODF_THRESHOLD             500  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    630, 5}, {     25, 6}, {     13, 5}, {     28, 6}, \
-    {     15, 5}, {     31, 6}, {     25, 7}, {     13, 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}, \
-    {     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,10}, {     79, 9}, {    159,10}, {     95,11}, \
-    {     63,10}, {    159,11}, {     95,10}, {    191,12}, \
-    {     63,11}, {    127,10}, {    271, 9}, {    543,11}, \
-    {    159,10}, {    319, 9}, {    671, 8}, {   1343,11}, \
-    {    191,10}, {    383, 9}, {    799,12}, {   4096,13}, \
-    {   8192,14}, {  16384,15}, {  32768,16} }
-#define SQR_FFT_TABLE3_SIZE 67
-#define SQR_FFT_THRESHOLD                 5760
+  { {    500, 5}, {     28, 6}, {     15, 5}, {     31, 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}, \
+    {     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}, {    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}, \
+    {    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}, \
+    {    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}, \
+    {   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}, \
+    {   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
+#define SQR_FFT_THRESHOLD                 5312
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
-#define MULLO_DC_THRESHOLD                  30
+#define MULLO_DC_THRESHOLD                  29
 #define MULLO_MUL_N_THRESHOLD            13463
 
-#define DC_DIV_QR_THRESHOLD                 15
-#define DC_DIVAPPR_Q_THRESHOLD              49
-#define DC_BDIV_QR_THRESHOLD                76
-#define DC_BDIV_Q_THRESHOLD                190
+#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 INV_MULMOD_BNM1_THRESHOLD           46
-#define INV_NEWTON_THRESHOLD                35
-#define INV_APPR_THRESHOLD                  35
+#define INV_MULMOD_BNM1_THRESHOLD           50
+#define INV_NEWTON_THRESHOLD                39
+#define INV_APPR_THRESHOLD                  37
 
-#define BINV_NEWTON_THRESHOLD              324
-#define REDC_1_TO_REDC_N_THRESHOLD          83
+#define BINV_NEWTON_THRESHOLD              318
+#define REDC_1_TO_REDC_N_THRESHOLD          87
 
-#define MU_DIV_QR_THRESHOLD               1442
-#define MU_DIVAPPR_Q_THRESHOLD            1099
+#define MU_DIV_QR_THRESHOLD               1099
+#define MU_DIVAPPR_Q_THRESHOLD             792
 #define MUPI_DIV_QR_THRESHOLD                0  /* always */
-#define MU_BDIV_QR_THRESHOLD              1589
-#define MU_BDIV_Q_THRESHOLD               1718
-
-#define MATRIX22_STRASSEN_THRESHOLD         31
-#define HGCD_THRESHOLD                     118
-#define HGCD_APPR_THRESHOLD                149
-#define HGCD_REDUCE_THRESHOLD             3524
-#define GCD_DC_THRESHOLD                   351
+#define MU_BDIV_QR_THRESHOLD              1442
+#define MU_BDIV_Q_THRESHOLD               1589
+
+#define POWM_SEC_TABLE  3,32,95,480,597,2657
+
+#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 GET_STR_DC_THRESHOLD                13
-#define GET_STR_PRECOMPUTE_THRESHOLD        26
-#define SET_STR_DC_THRESHOLD               517
-#define SET_STR_PRECOMPUTE_THRESHOLD      1402
+#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 FAC_DSC_THRESHOLD                  155
+#define FAC_ODD_THRESHOLD                   34
diff --git a/mpn/x86/coreihwl/gmp-mparam.h b/mpn/x86/coreihwl/gmp-mparam.h
new file mode 100644 (file)
index 0000000..e2b289c
--- /dev/null
@@ -0,0 +1,210 @@
+/* x86/coreihwl 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
+
+/* 2900 MHz Core i5 Haswell */
+/* FFT tuning limit = 40000000 */
+/* Generated by tuneup.c, 2014-03-13, gcc 4.5 */
+
+#define MOD_1_NORM_THRESHOLD                16
+#define MOD_1_UNNORM_THRESHOLD              13
+#define MOD_1N_TO_MOD_1_1_THRESHOLD         11
+#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 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_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 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 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 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 MULMID_TOOM42_THRESHOLD             98
+
+#define MULMOD_BNM1_THRESHOLD               17
+#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}, {     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}, \
+    {    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,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,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}, {   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
+#define MULLO_MUL_N_THRESHOLD            14281
+
+#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 INV_MULMOD_BNM1_THRESHOLD           54
+#define INV_NEWTON_THRESHOLD                75
+#define INV_APPR_THRESHOLD                  67
+
+#define BINV_NEWTON_THRESHOLD              296
+#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 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 GET_STR_DC_THRESHOLD                11
+#define GET_STR_PRECOMPUTE_THRESHOLD        21
+#define SET_STR_DC_THRESHOLD               527
+#define SET_STR_PRECOMPUTE_THRESHOLD      1178
+
+#define FAC_DSC_THRESHOLD                  187
+#define FAC_ODD_THRESHOLD                   34
index 21afeb619369a65edfe92d26a6207011ad1d1a1f..13289c0c2390239f020585b8a2e7ffb78f40eb95 100644 (file)
 /* x86/coreinhm gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
-/* Generated by tuneup.c, 2011-11-25, gcc 4.5 */
+/* 2667 MHz Core i7 Nehalem */
+/* FFT tuning limit = 100000000 */
+/* Generated by tuneup.c, 2014-03-19, gcc 4.5 */
 
-#define MOD_1_NORM_THRESHOLD                24
+#define MOD_1_NORM_THRESHOLD                25
 #define MOD_1_UNNORM_THRESHOLD              15
 #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_2_TO_MOD_1_4_THRESHOLD         0  /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD      5
+#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_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           16
+#define BMOD_1_TO_MOD_1_THRESHOLD           15
 
-#define MUL_TOOM22_THRESHOLD                28
-#define MUL_TOOM33_THRESHOLD                81
+#define MUL_TOOM22_THRESHOLD                26
+#define MUL_TOOM33_THRESHOLD                89
 #define MUL_TOOM44_THRESHOLD               214
-#define MUL_TOOM6H_THRESHOLD               306
-#define MUL_TOOM8H_THRESHOLD               454
+#define MUL_TOOM6H_THRESHOLD               327
+#define MUL_TOOM8H_THRESHOLD               466
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD     137
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     148
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD     132
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD     131
+#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 SQR_BASECASE_THRESHOLD               0  /* always (native) */
-#define SQR_TOOM2_THRESHOLD                 42
-#define SQR_TOOM3_THRESHOLD                149
-#define SQR_TOOM4_THRESHOLD                226
-#define SQR_TOOM6_THRESHOLD                333
-#define SQR_TOOM8_THRESHOLD                494
+#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 MULMID_TOOM42_THRESHOLD             78
 
 #define MULMOD_BNM1_THRESHOLD               17
 #define SQRMOD_BNM1_THRESHOLD               21
 
-#define POWM_SEC_TABLE  2,33,294,1298,2870
-
 #define MUL_FFT_MODF_THRESHOLD             606  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    606, 5}, {     28, 6}, {     15, 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}, {     37, 8}, \
-    {     19, 7}, {     41, 8}, {     23, 7}, {     47, 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,12}, {     63,11}, {    127,10}, \
-    {    255, 9}, {    511,10}, {    271,11}, {    159,10}, \
-    {    319, 9}, {    639,10}, {    335,11}, {    191,10}, \
-    {    383, 9}, {    767,10}, {    399,12}, {   4096,13}, \
-    {   8192,14}, {  16384,15}, {  32768,16} }
-#define MUL_FFT_TABLE3_SIZE 63
-#define MUL_FFT_THRESHOLD                 6784
-
-#define SQR_FFT_MODF_THRESHOLD             505  /* k = 5 */
-#define SQR_FFT_TABLE3                                      \
-  { {    505, 5}, {     28, 6}, {     15, 5}, {     33, 6}, \
-    {     17, 5}, {     35, 6}, {     29, 7}, {     15, 6}, \
+  { {    606, 5}, {     25, 6}, {     13, 5}, {     28, 6}, \
+    {     15, 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}, {     41, 8}, \
-    {     23, 7}, {     47, 8}, {     27, 7}, {     55, 8}, \
+    {     39, 7}, {     23, 6}, {     47, 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}, \
+    {     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,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,10}, {    415,12}, {   4096,13}, {   8192,14}, \
-    {  16384,15}, {  32768,16} }
-#define SQR_FFT_TABLE3_SIZE 74
-#define SQR_FFT_THRESHOLD                 4800
+    {    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}, \
+    {    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}, \
+    {   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}, \
+    {   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
+#define MUL_FFT_THRESHOLD                 6784
+
+#define SQR_FFT_MODF_THRESHOLD             555  /* 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}, \
+    {    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
+#define SQR_FFT_THRESHOLD                 5312
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
-#define MULLO_DC_THRESHOLD                  35
+#define MULLO_DC_THRESHOLD                  38
 #define MULLO_MUL_N_THRESHOLD            13463
 
-#define DC_DIV_QR_THRESHOLD                 21
-#define DC_DIVAPPR_Q_THRESHOLD              42
-#define DC_BDIV_QR_THRESHOLD                84
-#define DC_BDIV_Q_THRESHOLD                156
+#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 INV_MULMOD_BNM1_THRESHOLD           54
-#define INV_NEWTON_THRESHOLD                17
-#define INV_APPR_THRESHOLD                  17
+#define INV_MULMOD_BNM1_THRESHOLD           50
+#define INV_NEWTON_THRESHOLD                15
+#define INV_APPR_THRESHOLD                  18
 
-#define BINV_NEWTON_THRESHOLD              348
-#define REDC_1_TO_REDC_N_THRESHOLD          83
+#define BINV_NEWTON_THRESHOLD              351
+#define REDC_1_TO_REDC_N_THRESHOLD          84
 
-#define MU_DIV_QR_THRESHOLD                979
-#define MU_DIVAPPR_Q_THRESHOLD             501
+#define MU_DIV_QR_THRESHOLD                889
+#define MU_DIVAPPR_Q_THRESHOLD             483
 #define MUPI_DIV_QR_THRESHOLD                0  /* always */
 #define MU_BDIV_QR_THRESHOLD              1589
 #define MU_BDIV_Q_THRESHOLD               1787
 
+#define POWM_SEC_TABLE  2,25,95,473,1357
+
 #define MATRIX22_STRASSEN_THRESHOLD         20
-#define HGCD_THRESHOLD                      57
-#define HGCD_APPR_THRESHOLD                 50
+#define HGCD_THRESHOLD                      52
+#define HGCD_APPR_THRESHOLD                 51
 #define HGCD_REDUCE_THRESHOLD             3524
-#define GCD_DC_THRESHOLD                   253
-#define GCDEXT_DC_THRESHOLD                233
+#define GCD_DC_THRESHOLD                   213
+#define GCDEXT_DC_THRESHOLD                249
 #define JACOBI_BASE_METHOD                   4
 
-#define GET_STR_DC_THRESHOLD                12
-#define GET_STR_PRECOMPUTE_THRESHOLD        20
-#define SET_STR_DC_THRESHOLD               127
-#define SET_STR_PRECOMPUTE_THRESHOLD       646
+#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 FAC_DSC_THRESHOLD                   91
+#define FAC_ODD_THRESHOLD                   29
index 16ef958ad9fb1a82e4fdf1e018a5e1e22ae26348..9b227a71ba2fc284b3ae6f4a4040b570c0422b83 100644 (file)
 /* x86/coreisbr gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
-/* Generated by tuneup.c, 2011-11-24, gcc 4.2 */
+/* 3300 MHz Core i5 Sandy Bridge */
+/* FFT tuning limit = 40000000 */
+/* Generated by tuneup.c, 2014-03-13, gcc 4.5 */
 
-#define MOD_1_NORM_THRESHOLD                24
-#define MOD_1_UNNORM_THRESHOLD              25
-#define MOD_1N_TO_MOD_1_1_THRESHOLD          7
+#define MOD_1_NORM_THRESHOLD                18
+#define MOD_1_UNNORM_THRESHOLD              11
+#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      3
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD      9
 #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        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           18
+#define BMOD_1_TO_MOD_1_THRESHOLD           19
 
 #define MUL_TOOM22_THRESHOLD                28
-#define MUL_TOOM33_THRESHOLD               101
-#define MUL_TOOM44_THRESHOLD               244
-#define MUL_TOOM6H_THRESHOLD               351
-#define MUL_TOOM8H_THRESHOLD               547
+#define MUL_TOOM33_THRESHOLD                99
+#define MUL_TOOM44_THRESHOLD               160
+#define MUL_TOOM6H_THRESHOLD               268
+#define MUL_TOOM8H_THRESHOLD               490
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD     109
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     183
+#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     109
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD     108
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     137
 
 #define SQR_BASECASE_THRESHOLD               0  /* always (native) */
 #define SQR_TOOM2_THRESHOLD                 48
-#define SQR_TOOM3_THRESHOLD                165
-#define SQR_TOOM4_THRESHOLD                276
+#define SQR_TOOM3_THRESHOLD                105
+#define SQR_TOOM4_THRESHOLD                256
 #define SQR_TOOM6_THRESHOLD                366
-#define SQR_TOOM8_THRESHOLD                572
+#define SQR_TOOM8_THRESHOLD                562
 
 #define MULMID_TOOM42_THRESHOLD             98
 
-#define MULMOD_BNM1_THRESHOLD               20
+#define MULMOD_BNM1_THRESHOLD               19
 #define SQRMOD_BNM1_THRESHOLD               23
 
-#define POWM_SEC_TABLE  2,27,258,1052
-
-#define MUL_FFT_MODF_THRESHOLD             716  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             636  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    716, 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}, {     27, 8}, {     15, 7}, {     31, 6}, \
-    {     63, 7}, {     35, 8}, {     19, 7}, {     41, 8}, \
-    {     23, 7}, {     51, 8}, {     31, 7}, {     63, 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}, {     95,11}, \
-    {     31,10}, {     63, 9}, {    135,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,11}, {    159,10}, {    319, 9}, \
-    {    639,11}, {    191,10}, {    383, 9}, {    767,11}, \
-    {    223,12}, {   4096,13}, {   8192,14}, {  16384,15}, \
+  { {    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 69
-#define MUL_FFT_THRESHOLD                 7552
+#define MUL_FFT_TABLE3_SIZE 149
+#define MUL_FFT_THRESHOLD                 7424
 
-#define SQR_FFT_MODF_THRESHOLD             595  /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD             555  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    595, 5}, {     28, 6}, {     15, 5}, {     31, 6}, \
+  { {    555, 5}, {     28, 6}, {     15, 5}, {     31, 6}, \
     {     29, 7}, {     15, 6}, {     33, 7}, {     17, 6}, \
-    {     35, 7}, {     19, 6}, {     39, 7}, {     23, 6}, \
-    {     47, 7}, {     35, 8}, {     19, 7}, {     43, 8}, \
-    {     23, 7}, {     49, 8}, {     31, 7}, {     63, 8}, \
-    {     43, 9}, {     23, 8}, {     55, 9}, {     31, 8}, \
+    {     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}, {     63, 8}, \
-    {    127, 9}, {     79,10}, {     47, 9}, {     95,11}, \
-    {     31,10}, {     63, 9}, {    135,10}, {     79, 9}, \
-    {    159,10}, {     95,11}, {     63,10}, {    159,11}, \
+    {     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}, {    671,11}, {    191,10}, \
-    {    383, 9}, {    767,10}, {    399,12}, {   4096,13}, \
-    {   8192,14}, {  16384,15}, {  32768,16} }
-#define SQR_FFT_TABLE3_SIZE 63
+    {    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}, \
+    {    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
 #define SQR_FFT_THRESHOLD                 5760
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
-#define MULLO_DC_THRESHOLD                 100
-#define MULLO_MUL_N_THRESHOLD            14379
+#define MULLO_DC_THRESHOLD                  62
+#define MULLO_MUL_N_THRESHOLD            14281
 
-#define DC_DIV_QR_THRESHOLD                 22
-#define DC_DIVAPPR_Q_THRESHOLD              30
-#define DC_BDIV_QR_THRESHOLD               120
-#define DC_BDIV_Q_THRESHOLD                268
+#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 INV_MULMOD_BNM1_THRESHOLD           54
-#define INV_NEWTON_THRESHOLD                12
+#define INV_NEWTON_THRESHOLD                14
 #define INV_APPR_THRESHOLD                  13
 
-#define BINV_NEWTON_THRESHOLD              410
-#define REDC_1_TO_REDC_N_THRESHOLD         100
+#define BINV_NEWTON_THRESHOLD              363
+#define REDC_1_TO_REDC_N_THRESHOLD          90
 
-#define MU_DIV_QR_THRESHOLD               1037
-#define MU_DIVAPPR_Q_THRESHOLD             889
+#define MU_DIV_QR_THRESHOLD                998
+#define MU_DIVAPPR_Q_THRESHOLD             667
 #define MUPI_DIV_QR_THRESHOLD                0  /* always */
-#define MU_BDIV_QR_THRESHOLD              1858
-#define MU_BDIV_Q_THRESHOLD               2172
+#define MU_BDIV_QR_THRESHOLD              1787
+#define MU_BDIV_Q_THRESHOLD               2130
+
+#define POWM_SEC_TABLE  1,16,126,480,1317
 
 #define MATRIX22_STRASSEN_THRESHOLD         21
-#define HGCD_THRESHOLD                      59
+#define HGCD_THRESHOLD                      61
 #define HGCD_APPR_THRESHOLD                 56
-#define HGCD_REDUCE_THRESHOLD             4818
-#define GCD_DC_THRESHOLD                   278
-#define GCDEXT_DC_THRESHOLD                298
+#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                11
-#define GET_STR_PRECOMPUTE_THRESHOLD        23
-#define SET_STR_DC_THRESHOLD               438
-#define SET_STR_PRECOMPUTE_THRESHOLD      1206
+#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 FAC_ODD_THRESHOLD                   34
index 0d82f806bb757bd656838131876f3ea65bdc4b76..f8363db3f78bf689f6e32ccea485b79724cab1af 100644 (file)
@@ -1,20 +1,31 @@
 divert(-1)
 dnl  Copyright 2007, 2011, 2012 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index cb927e5d90cab2c6bcf8ada40c1b1a1b778da2bf..9a6cbb7931df345bdce21f8a4b94c77003b1a2e4 100644 (file)
@@ -1,21 +1,32 @@
 dnl  x86 mpn_divexact_1 -- mpn by limb exact division.
 
 dnl  Copyright 2001, 2002, 2007 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index a5fb88071d6b414095d546ec44f9630128c96ff5..255d4935c389f495a465a3cc8c47799ca03b55c3 100644 (file)
@@ -1,22 +1,32 @@
 dnl  x86 mpn_divrem_1 -- mpn by limb division extending to fractional quotient.
 
-dnl  Copyright 1999, 2000, 2001, 2002, 2003, 2007 Free Software Foundation,
-dnl  Inc.
-dnl
+dnl  Copyright 1999-2003, 2007 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 1581add400e38c7405c8497d15e1ab47fa2ba0c6..4c38ad0acb92eeee7297f7ededc0286b23a25860 100644 (file)
@@ -3,19 +3,30 @@ dnl  x86 mpn_divrem_2 -- Divide an mpn number by a normalized 2-limb number.
 dnl  Copyright 2007, 2008 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 8462dd86fc1c355c2e44192dfbcc7bed347829c8..d359d4ce7305adaa074aae0a0117bbbc65feb427 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2003, 2009, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "mpn/generic/com.c"
index 7ae29dc6a8630be4b7a7b1729134eb0f47055a35..1740813886d1c91f5286df39df46fbceeacfc2ab 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2003, 2004, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 printf */
 #include <stdlib.h>   /* for getenv */
@@ -31,9 +42,6 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 /* Change this to "#define TRACE(x) x" for some traces. */
 #define TRACE(x)
 
-/* Change this to 1 to take the cpuid from GMP_CPU_TYPE env var. */
-#define WANT_FAKE_CPUID  0
-
 
 /* fat_entry.asm */
 long __gmpn_cpuid (char [12], int);
@@ -71,6 +79,7 @@ static struct {
   { "coreinhm",   "GenuineIntel", MAKE_FMS (6, 0x1a) },
   { "coreiwsm",   "GenuineIntel", MAKE_FMS (6, 0x25) },
   { "coreisbr",   "GenuineIntel", MAKE_FMS (6, 0x2a) },
+  { "coreihwl",   "GenuineIntel", MAKE_FMS (6, 0x3c) },
   { "atom",       "GenuineIntel", MAKE_FMS (6, 0x1c) },
 
   { "k5",         "AuthenticAMD", MAKE_FMS (5, 0) },
@@ -144,6 +153,8 @@ struct cpuvec_t __gmpn_cpuvec = {
   __MPN(addmul_1_init),
   0,
   __MPN(bdiv_dbm1c_init),
+  __MPN(cnd_add_n_init),
+  __MPN(cnd_sub_n_init),
   __MPN(com_init),
   __MPN(copyd_init),
   __MPN(copyi_init),
@@ -275,7 +286,7 @@ __gmpn_cpuvec_init (void)
                case 0x09:              /* Banias */
                case 0x0d:              /* Dothan */
                case 0x0e:              /* Yonah */
-                 TRACE (printf ("  Banias/Bothan/Yonah\n"));
+                 TRACE (printf ("  Banias/Dothan/Yonah\n"));
                   CPUVEC_SETUP_p6_mmx;
                   CPUVEC_SETUP_p6_p3mmx;
                   CPUVEC_SETUP_p6_sse2;
@@ -390,9 +401,9 @@ __gmpn_cpuvec_init (void)
 
             case 0x0f:         /* k8 */
             case 0x11:         /* "fam 11h", mix of k8 and k10 */
-            case 0x13:         /* unknown, conservativeky assume k8  */
-            case 0x16:         /* unknown, conservativeky assume k8  */
-            case 0x17:         /* unknown, conservativeky assume k8  */
+            case 0x13:         /* unknown, conservatively assume k8  */
+            case 0x16:         /* unknown, conservatively assume k8  */
+            case 0x17:         /* unknown, conservatively assume k8  */
               TRACE (printf ("  k8\n"));
               CPUVEC_SETUP_k7;
               CPUVEC_SETUP_k7_mmx;
index f9b88cf79131eccdbbe21f848557b647bcb3e576..6e3cb44dd5661183cb37d23c59be980c3b4e8a68 100644 (file)
@@ -1,21 +1,32 @@
 dnl  x86 fat binary entrypoints.
 
 dnl  Copyright 2003, 2012 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 5bd000618c74b5732bebcd6af0fc7a071d0b98bd..f809bd809288ad45c9a08760d1296c87519bf78a 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "mpn/generic/gcd_1.c"
index 9043bf9da765e9602c9f20c217f75aa5dd56ce30..3641a6bafadd53101555ca51fe36df5cf8a98d58 100644 (file)
@@ -1,25 +1,35 @@
 /* Fat binary x86 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2011 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2003, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 
 /* mpn_divexact_1 is faster than mpn_divrem_1 at all sizes.  The only time
index e6e2a3b562e43857aea9825bfb721d3eeacf9505..9ecf48978f988294c350393a7aa4d0a82704d60a 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2003, 2009, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "mpn/generic/lshiftc.c"
index a79359d11381fed5d31b8631be5e7a00445b6feb..4f149cc353cc5e8386bce725495aa530cf5cce08 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2003, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "mpn/generic/mod_1.c"
index ffe148147aa8027c985e06ffb8a807f522037a04..92eaa7a87f6b302237040a0cb0f0ff938c22244c 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2003, 2009, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /*
 PROLOGUE(mpn_mod_1_1p_cps)
index 6bcbacc92380031c70eee58215e00324b4ba89cc..9095a61c9387d0a2e78487dc22bb77ce29f60444 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2003, 2009, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /*
 PROLOGUE(mpn_mod_1s_2p_cps)
index 1f6a8c9ed0e29a2d309fc508aa6c99d46af0877a..51c0def4439e731d7f082207c5ef8bddc895c536 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2003, 2009, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /*
 PROLOGUE(mpn_mod_1s_4p_cps)
index a5244cae44921ee87c015fee12cf3b74efd2f54f..870ddb899bdead54662b9673b94ee34e7e022782 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "mpn/generic/mode1o.c"
index 77201767dec637d4b154b3ff42ad113eda07849d..7f86be64c52610a641b42bf5358447794077724f 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "mpn/generic/mullo_basecase.c"
index a786115d828a3e5a548dd25dc5a4bd120313375e..00254033538ed752231d7ac6586517a32f670f6f 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "mpn/generic/redc_1.c"
index f29d65842ce900f265a895479cd174da83b88563..1932d583231f5709916775276b7e207298538be9 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "mpn/generic/redc_2.c"
index 9d9854b7e9280590bdf4a7e060c48957f489442a..cc9c9f17893db3e0cee2ea2e322833d19708fbcc 100644 (file)
@@ -1,25 +1,35 @@
 /* Generic x86 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2011 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 2000-2002, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 /* Generated by tuneup.c, 2011-01-30, gcc 3.4 */
 
index 4f91bd230a8db0276e322d3b928fb5e4d2578c14..2cb19848892d9165e8dcd2d9f9bdd40e8c2ab3dc 100644 (file)
@@ -1,24 +1,35 @@
 /* Generic x86 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 
 /* Generic x86 mpn_divexact_1 is faster than generic x86 mpn_divrem_1 on all
index 30084ed676a250df8c1611c3783920b29fbbc319..aa7dbad45ba62f5a15df280d8900a167ac88c362 100644 (file)
@@ -1,24 +1,35 @@
 /* 80486 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2001-2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 
 /* 100MHz DX4 */
index 0ab12b8af9146dca90b177fc6808d74cbf509153..2a1ae5a6bb17cd010604941acb1164632aedf7a1 100644 (file)
 /* x86/k10 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
-/* Generated by tuneup.c, 2011-11-25, gcc 4.2 */
+/* 2400 MHz K10 Barcelona */
+/* FFT tuning limit = 25000000 */
+/* Generated by tuneup.c, 2014-03-13, 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         6
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD        13
+#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 USE_PREINV_DIVREM_1                  1  /* native */
+#define DIV_QR_1N_PI1_METHOD                 1
+#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           31
+#define BMOD_1_TO_MOD_1_THRESHOLD           32
 
-#define MUL_TOOM22_THRESHOLD                26
-#define MUL_TOOM33_THRESHOLD                85
+#define MUL_TOOM22_THRESHOLD                24
+#define MUL_TOOM33_THRESHOLD                81
 #define MUL_TOOM44_THRESHOLD               130
-#define MUL_TOOM6H_THRESHOLD               206
-#define MUL_TOOM8H_THRESHOLD               309
+#define MUL_TOOM6H_THRESHOLD               189
+#define MUL_TOOM8H_THRESHOLD               430
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD      80
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD      81
 #define MUL_TOOM32_TO_TOOM53_THRESHOLD      91
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD      89
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD      82
 #define MUL_TOOM42_TO_TOOM63_THRESHOLD      90
 #define MUL_TOOM43_TO_TOOM54_THRESHOLD     112
 
 #define SQR_BASECASE_THRESHOLD               0  /* always (native) */
-#define SQR_TOOM2_THRESHOLD                 40
-#define SQR_TOOM3_THRESHOLD                 81
-#define SQR_TOOM4_THRESHOLD                178
-#define SQR_TOOM6_THRESHOLD                266
-#define SQR_TOOM8_THRESHOLD                357
+#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 MULMID_TOOM42_THRESHOLD             54
+#define MULMID_TOOM42_THRESHOLD             56
 
 #define MULMOD_BNM1_THRESHOLD               17
-#define SQRMOD_BNM1_THRESHOLD               17
+#define SQRMOD_BNM1_THRESHOLD               18
 
-#define MUL_FFT_MODF_THRESHOLD             606  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             765  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    786, 5}, {     25, 6}, {     13, 5}, {     27, 6}, \
+  { {    765, 5}, {     25, 6}, {     13, 5}, {     27, 6}, \
     {     25, 7}, {     13, 6}, {     27, 7}, {     15, 6}, \
-    {     33, 7}, {     17, 6}, {     35, 7}, {     19, 6}, \
+    {     31, 7}, {     17, 6}, {     35, 7}, {     19, 6}, \
     {     39, 7}, {     23, 6}, {     47, 7}, {     27, 8}, \
-    {     15, 7}, {     31, 6}, {     63, 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}, \
-    {     63, 9}, {     39, 8}, {     83, 9}, {     47,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,10}, {    111,11}, {     63,10}, {    127, 9}, \
-    {    255, 7}, {   1023, 8}, {    543, 9}, {    279,10}, \
-    {    159,11}, {     95,10}, {    191,12}, {     63,11}, \
-    {    127,10}, {    255, 9}, {    511,10}, {    271, 9}, \
-    {    543, 8}, {   1087,10}, {    287,11}, {    159, 9}, \
-    {    671,11}, {    191,10}, {    399, 9}, {    799,12}, \
-    {   4096,13}, {   8192,14}, {  16384,15}, {  32768,16} }
-#define MUL_FFT_TABLE3_SIZE 76
+    {     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             505  /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD             555  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    660, 5}, {     25, 6}, {     13, 5}, {     28, 6}, \
-    {     25, 7}, {     13, 6}, {     28, 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}, {     39, 8}, \
-    {     23, 7}, {     47, 8}, {     31, 7}, {     63, 8}, \
-    {     35, 7}, {     71, 8}, {     39, 9}, {     23, 8}, \
-    {     55,10}, {     15, 9}, {     31, 8}, {     63, 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,11}, {     63,10}, \
-    {    159,11}, {     95, 8}, {    799,12}, {     63,11}, \
-    {    127,10}, {    255, 9}, {    543,11}, {    159, 9}, \
-    {    639,10}, {    367,11}, {    191,10}, {    383, 9}, \
-    {    799,10}, {    415,11}, {    223,12}, {   4096,13}, \
-    {   8192,14}, {  16384,15}, {  32768,16} }
-#define SQR_FFT_TABLE3_SIZE 67
-#define SQR_FFT_THRESHOLD                 4736
+  { {    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}, \
+    {     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}, \
+    {    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}, \
+    {    639,12}, {   1471,11}, {   2943,13}, {    767,12}, \
+    {   1727,11}, {   3455,13}, {    895,12}, {   1983,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}, {  16384,15}, {  32768,16} }
+#define SQR_FFT_TABLE3_SIZE 172
+#define SQR_FFT_THRESHOLD                 5504
 
 #define MULLO_BASECASE_THRESHOLD             7
-#define MULLO_DC_THRESHOLD                  42
+#define MULLO_DC_THRESHOLD                  40
 #define MULLO_MUL_N_THRESHOLD            13463
 
-#define DC_DIV_QR_THRESHOLD                 56
+#define DC_DIV_QR_THRESHOLD                 59
 #define DC_DIVAPPR_Q_THRESHOLD             270
 #define DC_BDIV_QR_THRESHOLD                55
-#define DC_BDIV_Q_THRESHOLD                182
+#define DC_BDIV_Q_THRESHOLD                206
 
 #define INV_MULMOD_BNM1_THRESHOLD           62
-#define INV_NEWTON_THRESHOLD               260
-#define INV_APPR_THRESHOLD                 270
-
-#define BINV_NEWTON_THRESHOLD              276
-#define REDC_1_TO_REDC_N_THRESHOLD          71
-
-#define MU_DIV_QR_THRESHOLD               1652
-#define MU_DIVAPPR_Q_THRESHOLD            1652
-#define MUPI_DIV_QR_THRESHOLD              130
-#define MU_BDIV_QR_THRESHOLD              1499
-#define MU_BDIV_Q_THRESHOLD               1528
-
-#define POWM_SEC_TABLE  4,23,228,947
-
-#define MATRIX22_STRASSEN_THRESHOLD         16
-#define HGCD_THRESHOLD                     132
-#define HGCD_APPR_THRESHOLD                180
-#define HGCD_REDUCE_THRESHOLD             3134
-#define GCD_DC_THRESHOLD                   630
-#define GCDEXT_DC_THRESHOLD                432
+#define INV_NEWTON_THRESHOLD               254
+#define INV_APPR_THRESHOLD                 252
+
+#define BINV_NEWTON_THRESHOLD              274
+#define REDC_1_TO_REDC_N_THRESHOLD          74
+
+#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 POWM_SEC_TABLE  1,16,114,428,1240
+
+#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                12
-#define GET_STR_PRECOMPUTE_THRESHOLD        23
-#define SET_STR_DC_THRESHOLD               208
-#define SET_STR_PRECOMPUTE_THRESHOLD      1254
+#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                  208
+#define FAC_DSC_THRESHOLD                  224
 #define FAC_ODD_THRESHOLD                   29
index f488cbd1d80bdb63875a59b9a41e896ce888edb9..1d65af3851fe35a5e801e467c3b2593c8ff88c4e 100644 (file)
@@ -3,17 +3,28 @@ Copyright 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index 09afd8f68866870cdeaceaab440b817158072978..168f9b4ae4a80967e5c9e45f9b9f045b3e17effd 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K6 mpn_add/sub_n -- mpn addition or subtraction.
 
-dnl  Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 2389368fbdad08bf97a914ec15b8fc76a1149e70..eaa92ebb24b69dae457b6d27a545c9726651c48b 100644 (file)
@@ -1,22 +1,32 @@
 dnl  AMD K6 mpn_addmul_1/mpn_submul_1 -- add or subtract mpn multiple.
 
-dnl  Copyright 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation,
-dnl  Inc.
-dnl
+dnl  Copyright 1999-2003, 2005 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index cf476d603b40c3a194cf25ee0b24041c3931196f..fc921a56b711d01b9927f877290d6dc7b7c63933 100755 (executable)
@@ -2,20 +2,31 @@
 
 # Copyright 2000, 2001 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 # Usage: cross.pl [filename.o]...
index 1c86d9bd6cf2cfe9eab3838ff6463f0b3f860e89..b4cea4fa2a74053f95589f4a28821903075370e8 100644 (file)
@@ -1,22 +1,32 @@
 dnl  AMD K6 mpn_divrem_1 -- mpn by limb division.
 
-dnl  Copyright 1999, 2000, 2001, 2002, 2003, 2007 Free Software Foundation,
-dnl  Inc.
-dnl
+dnl  Copyright 1999-2003, 2007 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 58aff08221028369ade94b920c471d9b351ff703..0c233ff362661e9f96f23bc116b3f78037099511 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K6 mpn_gcd_1 -- mpn by 1 gcd.
 
-dnl  Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2002, 2004 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 97854d1a055cced254bc4173c97a8c9fc9eee0a4..f03f1b2d9188d12a738d1704e25ee695831f3711 100644 (file)
@@ -1,25 +1,36 @@
 /* AMD K6 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2009, 2010
-Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2004, 2009, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 
 /* 450MHz K6-2 */
index 227ed7878367dbf6caed4071703ced01f0a4e5cf..f80a5a1cdb57e602e0074df8adef08d3d4c50bad 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K6-2 mpn_copyd -- copy limb vector, decrementing.
 
 dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index e48e73e19a123d76175b2f7a1481f73a5de6d815..c86575feed9b7117fd170ae3550d58e1770c6353 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K6-2 mpn_lshift -- mpn left shift.
 
 dnl  Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index b3114d0e6e27d4c8571acf5d0b1d906b0414f382..f604a7bd52910cc16c495fa1c2fbb7bc6ac21ffc 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K6-2 mpn_rshift -- mpn right shift.
 
 dnl  Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 3dcf539a5cf59c805752309890d1e7441cb11bc1..b747454627b9c6a1fc9472a152e76990ca96d307 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K6-2 mpn_com -- mpn bitwise one's complement.
 
-dnl  Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index f169bfc14f95de8effaa39981d1c56a39d651bb4..b644dca8cd49a8df04b985f7fed82ac5f82c661f 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K6 mpn_divexact_1 -- mpn by limb exact division.
 
-dnl  Copyright 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2002, 2007 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index a6272131a2b0cca40f3fe301b0269c678b2f93a7..e17930bb2db4e1a01c58e4da8fb584285f442587 100644 (file)
@@ -1,22 +1,33 @@
 dnl  AMD K6-2 mpn_and_n, mpn_andn_n, mpn_nand_n, mpn_ior_n, mpn_iorn_n,
 dnl  mpn_nior_n, mpn_xor_n, mpn_xnor_n -- mpn bitwise logical operations.
 
-dnl  Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 149202517138eb39da05fdf06a70a229594c556d..45be58263378ab71a0e9e499f3428adc18b1cd30 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K6 mpn_lshift -- mpn left shift.
 
 dnl  Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index a0a651d39c0ac253c24874f74edd8743cdbd2938..2b19d0b5ee0a7796cb03a680158503d5597e0414 100644 (file)
@@ -1,22 +1,33 @@
 dnl  AMD K6-2 mpn_popcount, mpn_hamdist -- mpn bit population count and
 dnl  hamming distance.
 
-dnl  Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 80cd6fb05ae7a05ffe2a00abbed816aafd40818e..cd0382f322ca3416b25d3e25290467c1b9d593e7 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K6 mpn_rshift -- mpn right shift.
 
 dnl  Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index a5b7ee1064ae8e4813a7792cdba679a08b325e4c..7e30503e544b9392b9da75374f167d4fb3da1921 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K6 mpn_mod_34lsub1 -- mpn remainder modulo 2**24-1.
 
-dnl  Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 34f35369fe8ca82d56bdc42dc14b11ea086bdfb9..a13f647b8117717c723482b7fd094bfd8d5aa3ac 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K6 mpn_modexact_1_odd -- exact division style remainder.
 
-dnl  Copyright 2000, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2003, 2007 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 26cfe4022db3a7715310b243696a152654237875..3ef7ec24fe70cf4f2a574041ecdf15c9cb74de79 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K6 mpn_mul_1 -- mpn by limb multiply.
 
 dnl  Copyright 1999, 2000, 2002, 2005 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index dcd4d7008260bb9e456c30f2ae9436927a92746a..7030001c3f21ec2d9a47dfd13d65e5e85de6f419 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K6 mpn_mul_basecase -- multiply two mpn numbers.
 
-dnl  Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2003 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 3231539bfdfbf24aa7b54629f80b271048941575..34db20d386673a11f3630e81c04696bb86f9a1f7 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K6 mpn_preinv_mod_1 -- mpn by 1 remainder, with pre-inverted divisor.
 
 dnl  Copyright 2000, 2002, 2003 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 1a2ad34f47d59f50922b986a4def165cfac80893..b7ecb5cc8a1750e336ae2aa875145d26e5a28ecb 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K6 mpn_sqr_basecase -- square an mpn number.
 
-dnl  Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index e2c5e0c18dc7f9d6b7a5e3deee70c6472abd9ad7..5711b612c5c65430bfe55dcf90669bc005dc8daf 100644 (file)
@@ -3,17 +3,28 @@ Copyright 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index e24f7a988fbf10501a0c91d0a3d21cd1b1576ed1..a957b6f78e621557aec4a316bdbb283643793cbe 100644 (file)
@@ -5,19 +5,30 @@ dnl  Copyright 2011 Free Software Foundation, Inc.
 dnl  Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d84de3ee9875bd0c294f23db28a548b1c2b6ee1d..1a08072029f0be551318ded718a7d53e2c482458 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K7 mpn_add_n/mpn_sub_n -- mpn add or subtract.
 
-dnl  Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2003 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index a1a0e3e9521209694a1969273015607ea638b1bb..eec8df6de25cc991b3fbd599678c8feb455cb17f 100644 (file)
@@ -1,22 +1,32 @@
 dnl  AMD K7 mpn_addmul_1/mpn_submul_1 -- add or subtract mpn multiple.
 
-dnl  Copyright 1999, 2000, 2001, 2002, 2005, 2008 Free Software Foundation,
-dnl  Inc.
-dnl
+dnl  Copyright 1999-2002, 2005, 2008 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 7c7f2c340c3d95c2526e0b8225d449abac8f964c..df3477f539ae527289fb0087e66f8b335c5db294 100644 (file)
@@ -1,23 +1,34 @@
 dnl  AMD K7 mpn_bdiv_q_1 -- mpn by limb exact division.
 
+dnl  Rearranged from mpn/x86/k7/dive_1.asm by Marco Bodrato.
+
 dnl  Copyright 2001, 2002, 2004, 2007, 2011 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
-dnl  Rearranged from mpn/x86/k7/dive_1.asm by Marco Bodrato.
+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  The GNU MP Library is free software; you can redistribute it and/or
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+dnl  or both in parallel, as here.
 dnl
-dnl  The GNU MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index a754d091676a81f5a6f20570cc927b551356f26e..8eb4f45ac0f1c74fbaebfedc150c2c2dcddf13e8 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K7 mpn_divexact_1 -- mpn by limb exact division.
 
 dnl  Copyright 2001, 2002, 2004, 2007 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 81ee93d8ad92eaacb88d6c2a35b09a5264587416..c7d12c83c01f69678e1379bbe11b70c7748f86c2 100644 (file)
@@ -3,23 +3,33 @@ 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, 2001, 2002, 2005, 2009, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index c6bfa87e368d643de28e9191822e75b79e8a0256..9977a113e2d76530f586a4033c24b678bd26e61a 100644 (file)
@@ -1,26 +1,40 @@
 /* AMD K7 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009,
-2010 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2005, 2008-2010, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
+/* 2083 MHz K7 Barton */
+/* FFT tuning limit = 25000000 */
+/* Generated by tuneup.c, 2014-03-13, gcc 4.2 */
 
 #define MOD_1_NORM_THRESHOLD                 0  /* always */
 #define MOD_1_UNNORM_THRESHOLD               3
@@ -30,141 +44,172 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #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_1N_PI1_METHOD                 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 DIVEXACT_1_THRESHOLD                 0  /* always (native) */
 #define BMOD_1_TO_MOD_1_THRESHOLD           24
 
 #define MUL_TOOM22_THRESHOLD                28
 #define MUL_TOOM33_THRESHOLD                85
-#define MUL_TOOM44_THRESHOLD               142
-#define MUL_TOOM6H_THRESHOLD               258
+#define MUL_TOOM44_THRESHOLD               147
+#define MUL_TOOM6H_THRESHOLD               216
 #define MUL_TOOM8H_THRESHOLD               309
 
 #define MUL_TOOM32_TO_TOOM43_THRESHOLD      85
 #define MUL_TOOM32_TO_TOOM53_THRESHOLD      99
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD      97
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD      98
 #define MUL_TOOM42_TO_TOOM63_THRESHOLD     102
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD     144
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     124
 
 #define SQR_BASECASE_THRESHOLD               0  /* always (native) */
 #define SQR_TOOM2_THRESHOLD                 50
-#define SQR_TOOM3_THRESHOLD                 83
+#define SQR_TOOM3_THRESHOLD                 81
 #define SQR_TOOM4_THRESHOLD                216
-#define SQR_TOOM6_THRESHOLD                318
-#define SQR_TOOM8_THRESHOLD                430
+#define SQR_TOOM6_THRESHOLD                306
+#define SQR_TOOM8_THRESHOLD                446
 
 #define MULMID_TOOM42_THRESHOLD             56
 
 #define MULMOD_BNM1_THRESHOLD               17
-#define SQRMOD_BNM1_THRESHOLD               19
+#define SQRMOD_BNM1_THRESHOLD               17
 
-#define MUL_FFT_MODF_THRESHOLD             888  /* k = 6 */
+#define MUL_FFT_MODF_THRESHOLD             904  /* k = 6 */
 #define MUL_FFT_TABLE3                                      \
-  { {    888, 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}, {     31, 6}, {     63, 7}, \
-    {     35, 8}, {     19, 7}, {     39, 8}, {     23, 7}, \
-    {     47, 8}, {     31, 7}, {     63, 8}, {     39, 7}, \
-    {     79, 9}, {     23, 8}, {     47, 7}, {     95, 8}, \
-    {     51, 9}, {     31, 8}, {     71, 9}, {     39, 8}, \
-    {     79, 9}, {     47, 8}, {     95, 9}, {     55,10}, \
-    {     31, 9}, {     63, 8}, {    127, 9}, {     71, 8}, \
-    {    143, 9}, {     79,10}, {     47,11}, {     31,10}, \
-    {     63, 9}, {    127,10}, {     79, 9}, {    167,10}, \
-    {     95, 9}, {    207,10}, {    111,11}, {     63,10}, \
-    {    127, 9}, {    255,10}, {    159, 9}, {    319,11}, \
-    {     95,10}, {    191,12}, {     63,11}, {    127,10}, \
-    {    271, 9}, {    543,10}, {    287,11}, {    159,10}, \
-    {    319, 9}, {    671,11}, {    191,10}, {    383, 9}, \
-    {    767,11}, {    223,12}, {    127,11}, {    255,10}, \
-    {    511, 9}, {   1023,10}, {    543, 9}, {   1087,11}, \
-    {    287,10}, {    575, 9}, {   1151,10}, {    607, 9}, \
-    {   1215, 8}, {   2431,11}, {    319,10}, {    639, 9}, \
-    {   1279,10}, {    671, 9}, {   1343,12}, {    191,11}, \
-    {    383,10}, {    767, 9}, {   1535,10}, {    799, 9}, \
-    {   1599,11}, {    415,10}, {    831, 9}, {   1663,13}, \
-    {    127,12}, {    255,11}, {    511,10}, {   1023,11}, \
-    {    543,10}, {   1087,11}, {    575,10}, {   1151,11}, \
-    {    607,10}, {   1215,12}, {    319,11}, {    639,10}, \
-    {   1279,11}, {    671,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,11}, \
-    {    895,10}, {   1791,11}, {    959,13}, {    255,12}, \
-    {    511,11}, {   1023,10}, {   2047,11}, {   1087,12}, \
-    {    575,11}, {   1151,10}, {   2303,11}, {   1215,10}, \
-    {   2431,12}, {    639,11}, {   1407,10}, {   2815,11}, \
-    {   1471,10}, {   2943,13}, {    383,12}, {    767,11}, \
-    {   1599,12}, {    831,11}, {   1663,10}, {   3327,11}, \
-    {   1727,12}, {    895,11}, {   1791,10}, {   3583,12}, \
-    {    959,11}, {   1919,14}, {    255,13}, {    511,12}, \
-    {   1023,11}, {   2047,12}, {   1087,11}, {   2239,12}, \
-    {   1151,11}, {   2303,12}, {   1215,11}, {   2431,13}, \
-    {   8192,14}, {  16384,15}, {  32768,16} }
-#define MUL_FFT_TABLE3_SIZE 167
-#define MUL_FFT_THRESHOLD                 7552
-
-#define SQR_FFT_MODF_THRESHOLD             666  /* k = 6 */
-#define SQR_FFT_TABLE3                                      \
-  { {    786, 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}, {     31, 6}, {     63, 7}, \
-    {     35, 8}, {     19, 7}, {     39, 8}, {     23, 7}, \
-    {     47, 8}, {     31, 7}, {     63, 8}, {     39, 9}, \
-    {     23, 8}, {     47, 7}, {     95, 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}, {     95, 8}, \
-    {    191,11}, {     31,10}, {     63, 9}, {    135,10}, \
-    {     79, 9}, {    167,10}, {     95, 9}, {    191,10}, \
-    {    111,11}, {     63,10}, {    143, 9}, {    287, 8}, \
-    {    607,10}, {    159, 9}, {    319,10}, {    175,11}, \
-    {     95,10}, {    191, 9}, {    383,10}, {    207,12}, \
-    {     63,11}, {    127,10}, {    255, 9}, {    511,10}, \
-    {    287,11}, {    159,10}, {    319, 9}, {    639, 8}, \
-    {   1279, 9}, {    671, 8}, {   1343,11}, {    191,10}, \
-    {    383, 9}, {    767, 8}, {   1535, 9}, {    799, 8}, \
-    {   1599,10}, {    415,11}, {    223,12}, {    127,11}, \
+  { {    904, 6}, {     21, 7}, {     11, 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}, \
+    {     31, 6}, {     63, 7}, {     35, 8}, {     19, 7}, \
+    {     39, 8}, {     23, 7}, {     47, 8}, {     31, 7}, \
+    {     63, 8}, {     39, 7}, {     79, 9}, {     23, 8}, \
+    {     47, 7}, {     95, 8}, {     51, 9}, {     31, 8}, \
+    {     71, 9}, {     39, 8}, {     79, 9}, {     47, 8}, \
+    {     95, 9}, {     55,10}, {     31, 9}, {     63, 8}, \
+    {    127, 9}, {     71, 8}, {    143, 9}, {     79, 8}, \
+    {    159,10}, {     47, 9}, {     95, 8}, {    191, 9}, \
+    {    103,11}, {     31,10}, {     63, 9}, {    127, 8}, \
+    {    255, 9}, {    143,10}, {     79, 9}, {    167,10}, \
+    {     95, 9}, {    199,10}, {    111,11}, {     63,10}, \
+    {    127, 9}, {    255,10}, {    143, 9}, {    287,10}, \
+    {    159, 9}, {    319,11}, {     95,10}, {    191, 9}, \
+    {    383,10}, {    207,12}, {     63,11}, {    127,10}, \
+    {    255, 9}, {    511,10}, {    271, 8}, {   1087,10}, \
+    {    287,11}, {    159,10}, {    319, 9}, {    639,11}, \
+    {    191,10}, {    383, 9}, {    767, 8}, {   1535, 9}, \
+    {    799, 8}, {   1599,11}, {    223,12}, {    127,11}, \
     {    255,10}, {    511, 9}, {   1023,10}, {    543, 9}, \
     {   1087,11}, {    287,10}, {    575, 9}, {   1151,10}, \
     {    607, 9}, {   1215, 8}, {   2431,11}, {    319,10}, \
     {    639, 9}, {   1279,10}, {    671, 9}, {   1343,12}, \
     {    191,11}, {    383,10}, {    767, 9}, {   1535,10}, \
-    {    799, 9}, {   1599,11}, {    415,10}, {    863,13}, \
-    {    127,12}, {    255,11}, {    511,10}, {   1023,11}, \
-    {    543,10}, {   1087,11}, {    575,10}, {   1151, 9}, \
-    {   2303,11}, {    607,10}, {   1215, 9}, {   2431,12}, \
-    {    319,11}, {    639,10}, {   1279,11}, {    671,10}, \
-    {   1407, 9}, {   2815,11}, {    735,10}, {   1471, 9}, \
-    {   2943,11}, {    767,10}, {   1535,11}, {    799,10}, \
-    {   1599,11}, {    831,10}, {   1663,11}, {    863,10}, \
-    {   1727,11}, {    895,10}, {   1791,11}, {    959,10}, \
+    {    799, 9}, {   1599,10}, {    831, 9}, {   1663,10}, \
+    {    863,13}, {    127,12}, {    255,11}, {    511,10}, \
+    {   1023,11}, {    543,10}, {   1087,11}, {    575,10}, \
+    {   1151,11}, {    607,10}, {   1215, 9}, {   2431,12}, \
+    {    319,11}, {    639,10}, {   1407,11}, {    735,10}, \
+    {   1471, 9}, {   2943,12}, {    383,11}, {    767,10}, \
+    {   1535,11}, {    799,10}, {   1599,11}, {    831,10}, \
+    {   1663,11}, {    895,10}, {   1791,11}, {    959,10}, \
     {   1919,13}, {    255,12}, {    511,11}, {   1023,10}, \
-    {   2047,11}, {   1087,10}, {   2175,12}, {    575,11}, \
-    {   1151,10}, {   2303,11}, {   1215,10}, {   2431,12}, \
-    {    639,11}, {   1407,10}, {   2815,11}, {   1471,10}, \
-    {   2943,12}, {    767,11}, {   1599,12}, {    831,11}, \
-    {   1663,10}, {   3327,12}, {    895,11}, {   1791,12}, \
+    {   2047,11}, {   1087,12}, {    575,11}, {   1151,10}, \
+    {   2303,11}, {   1215,10}, {   2431,12}, {    639,11}, \
+    {   1279,10}, {   2559,11}, {   1407,10}, {   2815,11}, \
+    {   1471,10}, {   2943,13}, {    383,12}, {    767,11}, \
+    {   1599,12}, {    831,11}, {   1663,12}, {    895,11}, \
+    {   1791,10}, {   3583,12}, {    959,11}, {   1919,10}, \
+    {   3839,14}, {    255,13}, {    511,12}, {   1023,11}, \
+    {   2047,12}, {   1087,11}, {   2175,12}, {   1151,11}, \
+    {   2303,12}, {   1215,11}, {   2431,13}, {    639,12}, \
+    {   1407,11}, {   2815,12}, {   1471,11}, {   2943,13}, \
+    {    767,12}, {   1663,11}, {   3327,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}, \
+    {   2559,13}, {   1407,12}, {   2943,11}, {   5887,14}, \
+    {    767,13}, {   1535,12}, {   3071,13}, {   1663,12}, \
+    {   3327,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}, {   2559,12}, {   5119,13}, \
+    {   2943,12}, {   5887,14}, {  16384,15}, {  32768,16} }
+#define MUL_FFT_TABLE3_SIZE 228
+#define MUL_FFT_THRESHOLD                 7808
+
+#define SQR_FFT_MODF_THRESHOLD             888  /* k = 6 */
+#define SQR_FFT_TABLE3                                      \
+  { {    888, 6}, {     21, 7}, {     11, 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}, \
+    {     31, 6}, {     63, 7}, {     35, 8}, {     19, 7}, \
+    {     39, 8}, {     23, 7}, {     47, 8}, {     31, 7}, \
+    {     63, 8}, {     39, 9}, {     23, 8}, {     47, 7}, \
+    {     95, 8}, {     51, 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, 8}, {    191,11}, \
+    {     31,10}, {     63, 9}, {    127, 8}, {    255, 9}, \
+    {    143,10}, {     79, 9}, {    167,10}, {     95, 9}, \
+    {    191,10}, {    111,11}, {     63,10}, {    127, 9}, \
+    {    255, 8}, {    511,10}, {    143, 9}, {    287, 8}, \
+    {    575,10}, {    159,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}, {    319, 9}, \
+    {    639, 8}, {   1279, 9}, {    671,11}, {    191,10}, \
+    {    383, 9}, {    799, 8}, {   1599, 9}, {    831,11}, \
+    {    223,12}, {    127,11}, {    255,10}, {    543, 9}, \
+    {   1087,11}, {    287,10}, {    575, 9}, {   1215, 8}, \
+    {   2431,11}, {    319,10}, {    639, 9}, {   1279,10}, \
+    {    671, 9}, {   1407,12}, {    191,10}, {    799, 9}, \
+    {   1599,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}, {    319,11}, \
+    {    639,10}, {   1279,11}, {    671,10}, {   1343, 9}, \
+    {   2687,11}, {    703,10}, {   1407,11}, {    735,10}, \
+    {   1471, 9}, {   2943,10}, {   1503,12}, {    383,11}, \
+    {    767,10}, {   1535,11}, {    799,10}, {   1599,11}, \
+    {    863,10}, {   1727,12}, {    447,11}, {    895,10}, \
+    {   1791,11}, {    959,10}, {   1919,13}, {    255,12}, \
+    {    511,11}, {   1023,10}, {   2047,11}, {   1087,10}, \
+    {   2175,11}, {   1119,12}, {    575,11}, {   1151,10}, \
+    {   2303,11}, {   1215,10}, {   2431,12}, {    639,11}, \
+    {   1407,10}, {   2815,11}, {   1471,10}, {   2943,12}, \
+    {    767,11}, {   1599,12}, {    831,11}, {   1663,10}, \
+    {   3327,12}, {    895,11}, {   1791,10}, {   3583,12}, \
     {    959,11}, {   1919,10}, {   3839,11}, {   1983,14}, \
     {    255,13}, {    511,12}, {   1023,11}, {   2047,12}, \
-    {   1087,11}, {   2239,12}, {   1151,11}, {   2303,12}, \
-    {   1215,11}, {   2431,13}, {   8192,14}, {  16384,15}, \
+    {   1087,11}, {   2175,12}, {   1151,11}, {   2303,12}, \
+    {   1215,11}, {   2431,13}, {    639,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}, \
+    {   2175,13}, {   1151,12}, {   2495,13}, {   1279,12}, \
+    {   2559,13}, {   1407,12}, {   2943,11}, {   5887,14}, \
+    {    767,13}, {   1535,12}, {   3071,13}, {   1663,12}, \
+    {   3327,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}, {  16384,15}, \
     {  32768,16} }
-#define SQR_FFT_TABLE3_SIZE 177
-#define SQR_FFT_THRESHOLD                 7040
+#define SQR_FFT_TABLE3_SIZE 229
+#define SQR_FFT_THRESHOLD                 7552
 
-#define MULLO_BASECASE_THRESHOLD            11
-#define MULLO_DC_THRESHOLD                  35
+#define MULLO_BASECASE_THRESHOLD             8
+#define MULLO_DC_THRESHOLD                  36
 #define MULLO_MUL_N_THRESHOLD            13463
 
-#define DC_DIV_QR_THRESHOLD                 41
-#define DC_DIVAPPR_Q_THRESHOLD             214
-#define DC_BDIV_QR_THRESHOLD                41
-#define DC_BDIV_Q_THRESHOLD                148
+#define DC_DIV_QR_THRESHOLD                 45
+#define DC_DIVAPPR_Q_THRESHOLD             208
+#define DC_BDIV_QR_THRESHOLD                43
+#define DC_BDIV_Q_THRESHOLD                140
 
-#define INV_MULMOD_BNM1_THRESHOLD           77
+#define INV_MULMOD_BNM1_THRESHOLD           62
 #define INV_NEWTON_THRESHOLD               204
 #define INV_APPR_THRESHOLD                 204
 
@@ -177,20 +222,20 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #define MU_BDIV_QR_THRESHOLD              1360
 #define MU_BDIV_Q_THRESHOLD               1470
 
-#define POWM_SEC_TABLE  2,17,176,905,2246
+#define POWM_SEC_TABLE  1,16,102,336,1221
 
 #define MATRIX22_STRASSEN_THRESHOLD         16
-#define HGCD_THRESHOLD                     125
+#define HGCD_THRESHOLD                     120
 #define HGCD_APPR_THRESHOLD                143
-#define HGCD_REDUCE_THRESHOLD             4633
-#define GCD_DC_THRESHOLD                   460
-#define GCDEXT_DC_THRESHOLD                330
+#define HGCD_REDUCE_THRESHOLD             4818
+#define GCD_DC_THRESHOLD                   474
+#define GCDEXT_DC_THRESHOLD                345
 #define JACOBI_BASE_METHOD                   4
 
 #define GET_STR_DC_THRESHOLD                15
-#define GET_STR_PRECOMPUTE_THRESHOLD        35
-#define SET_STR_DC_THRESHOLD               272
-#define SET_STR_PRECOMPUTE_THRESHOLD      1183
+#define GET_STR_PRECOMPUTE_THRESHOLD        33
+#define SET_STR_DC_THRESHOLD               298
+#define SET_STR_PRECOMPUTE_THRESHOLD      1187
 
-#define FAC_DSC_THRESHOLD                  336
+#define FAC_DSC_THRESHOLD                  602
 #define FAC_ODD_THRESHOLD                   29
index 435fa96d0935b498dfd593ec24847593d1b4018e..6cce455a9de41a1f25864dd6d830dbfd2428ed45 100644 (file)
@@ -1,23 +1,34 @@
 dnl  x86 mpn_invert_limb
 
-dnl  Contributed to the GNU project by Niels Möller
+dnl  Contributed to the GNU project by Niels Möller
 
 dnl  Copyright 2009, 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 3c6704bc16ec7e253ee9d84a5a649235242fb918..a258c224f12829964794af652d3f1bcb4f089771 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD Athlon mpn_com -- mpn bitwise one's complement.
 
 dnl  Copyright 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 4601fcd75a6d0d65d180e85b7eef940caeaeeecf..59ece40920badac7b558b7f8a03c2eacbc5c5c3f 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K7 mpn_copyd -- copy limb vector, decrementing.
 
 dnl  Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index a17d575ff47f01a238248906a6b32f8a87b1f293..9a28f927ec9fd036fc5f106a729d9c0cebef0b31 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K7 mpn_copyi -- copy limb vector, incrementing.
 
 dnl  Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 8c771a32b2530e0041eee791ee803ca37488ecc1..cf343280bbda65594c4dc7a69b5469d457b2b95d 100644 (file)
@@ -1,22 +1,33 @@
 dnl  AMD K7 mpn_divrem_1, mpn_divrem_1c, mpn_preinv_divrem_1 -- mpn by limb
 dnl  division.
 
-dnl  Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2002, 2004 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
@@ -445,7 +456,7 @@ C chain, and nothing better than 18 cycles has been found when using it.
 C The jump is taken only when q1 is 0xFFFFFFFF, and on random data this will
 C be an extremely rare event.
 C
-C Branch mispredictions will hit random occurrances of q1==0xFFFFFFFF, but
+C Branch mispredictions will hit random occurrences of q1==0xFFFFFFFF, but
 C if some special data is coming out with this always, the q1_ff special
 C case actually runs at 15 c/l.  0x2FFF...FFFD divided by 3 is a good way to
 C induce the q1_ff case, for speed measurements or testing.  Note that
index b3bff8ffd16ecef6980a8e7f67a85e4b245c7e69..b3383cf2c30011548d0635f6ebe580d51c50099c 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K7 mpn_lshift -- mpn left shift.
 
-dnl  Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 072f9e2a984a80aaee204a60ae164a306b4ca175..95965b74d40046ab3acd767d9dbcf9b54aebe6ff 100644 (file)
@@ -1,22 +1,33 @@
 dnl  AMD K7 mpn_popcount, mpn_hamdist -- population count and hamming
 dnl  distance.
 
-dnl  Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 3566ce85d7dc5e25738ba920f471db2fb263a404..345d23a25e3881b643dcbc495794a9dfcdc5f884 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K7 mpn_rshift -- mpn right shift.
 
-dnl  Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index bb19626b29762fdbf22e8ee0db8e8de6ff2a23d8..1bbe6f92d767690a9324fe59ae37454a5ed14107 100644 (file)
@@ -1,23 +1,34 @@
 dnl  x86-32 mpn_mod_1_1p, requiring cmov.
 
-dnl  Contributed to the GNU project by Niels Möller and Torbjorn Granlund.
-dnl
+dnl  Contributed to the GNU project by Niels Möller and Torbjorn Granlund.
+
 dnl  Copyright 2010, 2011 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
@@ -95,7 +106,7 @@ L(first):
        mov     -8(ap), %eax
        adc     %edx, %eax
        sbb     r2, r2
-       sub     $3, n
+       subl    $3, n
        lea     -16(ap), ap
        jz      L(reduce_three)
 
index 4d1129c2af433b4fe93d5de95485ddc8658596b0..bb7597edd29180cd138a427efa6813a8ba770371 100644 (file)
@@ -1,23 +1,34 @@
 dnl  x86-32 mpn_mod_1s_4p, requiring cmov.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
-dnl
+
 dnl  Copyright 2009, 2010 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
@@ -124,7 +135,7 @@ L(top):     mov     (%esi), %eax
        mov     %ecx, %edi
 L(m0): add     %eax, %ebp
        adc     %edx, %edi
-L(m1): sub     $4, 52(%esp)
+L(m1): subl    $4, 52(%esp)
        ja      L(top)
 
 L(end):        mov     4(%esp), %eax
index f00e84dc42165592abf2d71f18257eaa62c75fe6..ee3ad04099d5d8808f951ab98e55fa7b15e7e042 100644 (file)
@@ -1,22 +1,32 @@
 dnl  AMD K7 mpn_mod_34lsub1 -- remainder modulo 2^24-1.
 
-dnl  Copyright 2000, 2001, 2002, 2004, 2005, 2008 Free Software Foundation,
-dnl  Inc.
-dnl
+dnl  Copyright 2000-2002, 2004, 2005, 2008 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index f2eaf22cb60e928ecb2dee8d756a38e0d700f16c..6472ec5949bc658d7a9bd805ff4a8402b4efc82d 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K7 mpn_modexact_1_odd -- exact division style remainder.
 
-dnl  Copyright 2000, 2001, 2002, 2004, 2007 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2002, 2004, 2007 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index bb02bb1f5062430ccbef22ed62c0692ef2858767..755cd2ed50ca4a216fd6bf18cf6eb0e0d42f074f 100644 (file)
@@ -1,22 +1,32 @@
 dnl  AMD K7 mpn_mul_1.
 
-dnl  Copyright 1999, 2000, 2001, 2002, 2005, 2008 Free Software Foundation,
-dnl  Inc.
-dnl
+dnl  Copyright 1999-2002, 2005, 2008 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 7f4c0002f7f43608ec38fd4aaa0134742ef11d62..4dfb5008852d142a06fa43c059249ec5847d97eb 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K7 mpn_mul_basecase -- multiply two mpn numbers.
 
-dnl  Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 850a54e84f264fe99a15ed472449daab049c19de..7b6a97e0df4a8affc88014fa807f2b7b6e02defa 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD K7 mpn_sqr_basecase -- square an mpn number.
 
-dnl  Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 965348586586dd04957c94daf8d71d14a4a2c376..523b01218db76b5ae3411d397caa3d94a7860408 100644 (file)
@@ -5,19 +5,30 @@ dnl  Copyright 2011 Free Software Foundation, Inc.
 dnl  Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index ab19342cb74ec04b57f48f89411ff60f75e64492..8d95fef80b736611f2ab3498a189fe91ea90bc5e 100644 (file)
 /* x86/k8 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
-/* Generated by tuneup.c, 2011-11-25, gcc 4.2 */
+/* 2500 MHz K8 Brisbane */
+/* FFT tuning limit = 10000000 */
+/* Generated by tuneup.c, 2014-03-12, gcc 4.5 */
 
 #define MOD_1_NORM_THRESHOLD                 0  /* always */
-#define MOD_1_UNNORM_THRESHOLD               3
-#define MOD_1N_TO_MOD_1_1_THRESHOLD         10
-#define MOD_1U_TO_MOD_1_1_THRESHOLD          4
+#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_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     12
+#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                26
+#define MUL_TOOM22_THRESHOLD                24
 #define MUL_TOOM33_THRESHOLD                81
-#define MUL_TOOM44_THRESHOLD               136
-#define MUL_TOOM6H_THRESHOLD               270
+#define MUL_TOOM44_THRESHOLD               130
+#define MUL_TOOM6H_THRESHOLD               303
 #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      93
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD      96
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD     121
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD      92
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     122
 
 #define SQR_BASECASE_THRESHOLD               0  /* always (native) */
 #define SQR_TOOM2_THRESHOLD                 46
-#define SQR_TOOM3_THRESHOLD                 81
+#define SQR_TOOM3_THRESHOLD                 78
 #define SQR_TOOM4_THRESHOLD                202
 #define SQR_TOOM6_THRESHOLD                286
-#define SQR_TOOM8_THRESHOLD                430
+#define SQR_TOOM8_THRESHOLD                422
 
 #define MULMID_TOOM42_THRESHOLD             56
 
 #define MULMOD_BNM1_THRESHOLD               17
-#define SQRMOD_BNM1_THRESHOLD               17
+#define SQRMOD_BNM1_THRESHOLD               18
 
-#define MUL_FFT_MODF_THRESHOLD             888  /* k = 6 */
+#define MUL_FFT_MODF_THRESHOLD             848  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    888, 6}, {     15, 5}, {     31, 6}, {     25, 7}, \
-    {     13, 6}, {     27, 7}, {     15, 6}, {     33, 7}, \
-    {     17, 6}, {     35, 7}, {     19, 6}, {     39, 7}, \
-    {     23, 6}, {     47, 7}, {     27, 8}, {     15, 7}, \
-    {     31, 6}, {     63, 7}, {     35, 8}, {     19, 7}, \
-    {     41, 8}, {     23, 7}, {     47, 8}, {     31, 7}, \
-    {     63, 8}, {     39, 7}, {     79, 9}, {     23, 8}, \
-    {     51, 9}, {     31, 8}, {     67, 9}, {     39, 8}, \
+  { {    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}, \
+    {     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}, {     63, 8}, {    127, 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}, {    127, 9}, \
-    {    255,10}, {    159,11}, {     95,10}, {    191,12}, \
+    {     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}, {    335,11}, {    191,10}, \
-    {    383, 9}, {    767,10}, {    399, 9}, {    799,11}, \
-    {    223,12}, {   4096,13}, {   8192,14}, {  16384,15}, \
-    {  32768,16} }
-#define MUL_FFT_TABLE3_SIZE 73
+    {    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             758  /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD             618  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    758, 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}, \
-    {     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}, {     79,10}, {     47, 9}, {     95,11}, \
+  { {    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}, \
-    {    159,10}, {     95, 9}, {    191,10}, {    111,11}, \
-    {     63,10}, {    127, 9}, {    255,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}, \
-    {    671,11}, {    191,10}, {    383, 9}, {    767,10}, \
-    {    399, 9}, {    799,12}, {   4096,13}, {   8192,14}, \
-    {  16384,15}, {  32768,16} }
-#define SQR_FFT_TABLE3_SIZE 74
-#define SQR_FFT_THRESHOLD                 7296
-
-#define MULLO_BASECASE_THRESHOLD             0  /* always */
-#define MULLO_DC_THRESHOLD                  28
-#define MULLO_MUL_N_THRESHOLD            13463
+    {    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}, \
+    {    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}, \
+    {   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}, \
+    {   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
+#define MULLO_MUL_N_THRESHOLD            14281
 
 #define DC_DIV_QR_THRESHOLD                 91
 #define DC_DIVAPPR_Q_THRESHOLD             280
@@ -117,32 +167,32 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #define DC_BDIV_Q_THRESHOLD                222
 
 #define INV_MULMOD_BNM1_THRESHOLD           62
-#define INV_NEWTON_THRESHOLD               266
-#define INV_APPR_THRESHOLD                 268
+#define INV_NEWTON_THRESHOLD               268
+#define INV_APPR_THRESHOLD                 270
 
-#define BINV_NEWTON_THRESHOLD              272
+#define BINV_NEWTON_THRESHOLD              260
 #define REDC_1_TO_REDC_N_THRESHOLD          79
 
-#define MU_DIV_QR_THRESHOLD               1822
-#define MU_DIVAPPR_Q_THRESHOLD            1652
-#define MUPI_DIV_QR_THRESHOLD              108
+#define MU_DIV_QR_THRESHOLD               1718
+#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 POWM_SEC_TABLE  3,21,195,961,2783
+#define POWM_SEC_TABLE  1,22,114,416,1464
 
-#define MATRIX22_STRASSEN_THRESHOLD         19
+#define MATRIX22_STRASSEN_THRESHOLD         16
 #define HGCD_THRESHOLD                     149
-#define HGCD_APPR_THRESHOLD                181
-#define HGCD_REDUCE_THRESHOLD             4633
-#define GCD_DC_THRESHOLD                   610
-#define GCDEXT_DC_THRESHOLD                419
+#define HGCD_APPR_THRESHOLD                204
+#define HGCD_REDUCE_THRESHOLD             4455
+#define GCD_DC_THRESHOLD                   599
+#define GCDEXT_DC_THRESHOLD                403
 #define JACOBI_BASE_METHOD                   4
 
-#define GET_STR_DC_THRESHOLD                14
-#define GET_STR_PRECOMPUTE_THRESHOLD        31
-#define SET_STR_DC_THRESHOLD               272
-#define SET_STR_PRECOMPUTE_THRESHOLD      1330
+#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 FAC_DSC_THRESHOLD                  438
+#define FAC_DSC_THRESHOLD                  348
 #define FAC_ODD_THRESHOLD                   24
index b0aafd3d0970e1ef941172044044d8a6e9c685ec..6ee6153cc28ee02d4a89ade70f77c66d68f3dc0b 100644 (file)
@@ -1,22 +1,32 @@
 dnl  x86 mpn_lshift -- mpn left shift.
 
-dnl  Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002 Free Software
-dnl  Foundation, Inc.
-dnl
+dnl  Copyright 1992, 1994, 1996, 1999-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86/mmx/sec_tabselect.asm b/mpn/x86/mmx/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..aae158a
--- /dev/null
@@ -0,0 +1,163 @@
+dnl  X86 MMX mpn_sec_tabselect.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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')
+
+C                           cycles/limb     cycles/limb
+C                            ali,evn n      unal,evn n
+C P5
+C P6 model 0-8,10-12
+C P6 model 9  (Banias)
+C P6 model 13 (Dothan)          1.33            1.87
+C P4 model 0  (Willamette)
+C P4 model 1  (?)
+C P4 model 2  (Northwood)       2.1             2.63
+C P4 model 3  (Prescott)
+C P4 model 4  (Nocona)          1.7             2.57
+C Intel Atom                    1.85            2.7
+C AMD K6
+C AMD K7                        1.33            1.33
+C AMD K8
+C AMD K10
+
+define(`rp',     `%edi')
+define(`tp',     `%esi')
+define(`n',      `%edx')
+define(`nents',  `%ecx')
+define(`which',  `')
+
+define(`i',      `%ebp')
+define(`j',      `%ebx')
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_sec_tabselect)
+       push    %ebx
+       push    %esi
+       push    %edi
+       push    %ebp
+
+       mov     20(%esp), rp
+       mov     24(%esp), tp
+       mov     28(%esp), n
+       mov     32(%esp), nents
+
+       movd    36(%esp), %mm6
+       punpckldq %mm6, %mm6            C 2 copies of `which'
+
+       mov     $1, %ebx
+       movd    %ebx, %mm7
+       punpckldq %mm7, %mm7            C 2 copies of 1
+
+       mov     n, j
+       add     $-4, j
+       js      L(outer_end)
+
+L(outer_top):
+       mov     nents, i
+       mov     tp, %eax
+       pxor    %mm1, %mm1
+       pxor    %mm4, %mm4
+       pxor    %mm5, %mm5
+       ALIGN(16)
+L(top):        movq    %mm6, %mm0
+       pcmpeqd %mm1, %mm0
+       paddd   %mm7, %mm1
+       movq    (tp), %mm2
+       movq    8(tp), %mm3
+       pand    %mm0, %mm2
+       pand    %mm0, %mm3
+       por     %mm2, %mm4
+       por     %mm3, %mm5
+       lea     (tp,n,4), tp
+       add     $-1, i
+       jne     L(top)
+
+       movq    %mm4, (rp)
+       movq    %mm5, 8(rp)
+
+       lea     16(%eax), tp
+       lea     16(rp), rp
+       add     $-4, j
+       jns     L(outer_top)
+L(outer_end):
+
+       test    $2, %dl
+       jz      L(b0x)
+
+L(b1x):        mov     nents, i
+       mov     tp, %eax
+       pxor    %mm1, %mm1
+       pxor    %mm4, %mm4
+       ALIGN(16)
+L(tp2):        movq    %mm6, %mm0
+       pcmpeqd %mm1, %mm0
+       paddd   %mm7, %mm1
+       movq    (tp), %mm2
+       pand    %mm0, %mm2
+       por     %mm2, %mm4
+       lea     (tp,n,4), tp
+       add     $-1, i
+       jne     L(tp2)
+
+       movq    %mm4, (rp)
+
+       lea     8(%eax), tp
+       lea     8(rp), rp
+
+L(b0x):        test    $1, %dl
+       jz      L(b00)
+
+L(b01):        mov     nents, i
+       pxor    %mm1, %mm1
+       pxor    %mm4, %mm4
+       ALIGN(16)
+L(tp1):        movq    %mm6, %mm0
+       pcmpeqd %mm1, %mm0
+       paddd   %mm7, %mm1
+       movd    (tp), %mm2
+       pand    %mm0, %mm2
+       por     %mm2, %mm4
+       lea     (tp,n,4), tp
+       add     $-1, i
+       jne     L(tp1)
+
+       movd    %mm4, (rp)
+
+L(b00):        pop     %ebp
+       pop     %edi
+       pop     %esi
+       pop     %ebx
+       emms
+       ret
+EPILOGUE()
index 4167d2cde4badd6d715b553485f5f77ad9c04609..e09e702c6f877c861b5122b7ea3bdbc5e6ff74fc 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Generic x86 mpn_mod_34lsub1 -- mpn remainder modulo 2^24-1.
 
-dnl  Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2002, 2004 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 24fe46bc7a11a74e7dfa7a641d6cdbcb3a99ef52..421de622253c07e1bff8459055d9a6a12905d507 100644 (file)
@@ -1,23 +1,33 @@
 dnl  x86 mpn_mul_1 (for 386, 486, and Pentium Pro) -- Multiply a limb vector
 dnl  with a limb and store the result in a second limb vector.
 
-dnl  Copyright 1992, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2005 Free
-dnl  Software Foundation, Inc.
-dnl
+dnl  Copyright 1992, 1994, 1997-2002, 2005 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 1400fac845da7d8592e3600548818d41938bde47..8339732a80c0d6629758b8aec2804ddd7cc8a59b 100644 (file)
@@ -1,23 +1,33 @@
 dnl  x86 mpn_mul_basecase -- Multiply two limb vectors and store the result
 dnl  in a third limb vector.
 
-dnl  Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software
-dnl  Foundation, Inc.
-dnl
+dnl  Copyright 1996-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 5fa5093724a9a4154491633ab64ebf4abafb7d58..cd8ac4e1d6e4b7f396d95119eaf8c7aefb4b3f5f 100644 (file)
@@ -1,25 +1,35 @@
 /* x86/nano gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 /* Generated by tuneup.c, 2011-11-25, gcc 4.2 */
 
index c8e6f0d6710f9f9e6d3b0dfeabfa73814e6bfa69..f19d47b94faaed565649e3d3f295bdb48d431279 100644 (file)
@@ -3,17 +3,28 @@ Copyright 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index 3bf03627844d075228f68244c7a5c5ecf6e4f990..df51c2e6f76c42d00f724954e8c292243c64fb8a 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P6 mpn_add_n/mpn_sub_n -- mpn add or subtract.
 
 dnl  Copyright 2006 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 2f9246795dd9e2270f80c4bb877db451ecaf2dcb..bc8c49c62e886a21bbe1f2a0f8157c94c038cb6e 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P6 mpn_addmul_1/mpn_submul_1 -- add or subtract mpn multiple.
 
-dnl  Copyright 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2002, 2005 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 0ffbc78e446e9ebdd4bfcfddcc05a0d6daacea58..2cc179c2384ce874ce42e814f7d19831288e047a 100644 (file)
@@ -1,23 +1,34 @@
 dnl  Intel P6 mpn_modexact_1_odd -- exact division style remainder.
 
+dnl  Rearranged from mpn/x86/p6/dive_1.asm by Marco Bodrato.
+
 dnl  Copyright 2001, 2002, 2007, 2011 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
-dnl  Rearranged from mpn/x86/p6/dive_1.asm by Marco Bodrato.
+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  The GNU MP Library is free software; you can redistribute it and/or
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+dnl  or both in parallel, as here.
 dnl
-dnl  The GNU MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 2946f51e7a36601599a2904660fefc7c4e8ea679..1be7636835e5f9b96c56ca7b4e21cd73d7d0c3f2 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P6 mpn_copyd -- copy limb vector backwards.
 
 dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index bccd5fd944b9b6192bd8a3763c4c1c18182de7f5..aa7ba880c97b27d9ac81fa2191c1fde9b492f610 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P6 mpn_modexact_1_odd -- exact division style remainder.
 
 dnl  Copyright 2001, 2002, 2007 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 6b4f2779649727ae9dab58a7878853de9f54d674..f6518f6e1998d13e477315884fdc0425fd18fc43 100644 (file)
@@ -2,23 +2,33 @@ dnl  x86 mpn_gcd_1 optimised for processors with fast BSF.
 
 dnl  Based on the K7 gcd_1.asm, by Kevin Ryde.  Rehacked by Torbjorn Granlund.
 
-dnl  Copyright 2000, 2001, 2002, 2005, 2009, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index eabe5a2d1594511c3f64b8d5f04e8d3b00134a23..96c96fd558602fe06939f26b9206e48322eab7e5 100644 (file)
@@ -1,26 +1,37 @@
 /* Intel P6 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2008, 2009, 2010, 2012
-Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2003, 2008-2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 
 /* NOTE: In a fat binary build SQR_TOOM2_THRESHOLD here cannot be more than the
index a3086bdbc20abc593776b45e5e6a0382f337a3e0..7ada213644be004b427f7252da592f5e50fdc91c 100644 (file)
@@ -1,27 +1,38 @@
 dnl  Intel P6 mpn_lshsub_n -- mpn papillion support.
 
 dnl  Copyright 2006 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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 P6/13: 3.35 cycles/limb      (separate mpn_sub_n + mpn_lshift needs 4.12)
 
-C (1) The loop is is not scheduled in any way, and scheduling attempts have not
+C (1) The loop is not scheduled in any way, and scheduling attempts have not
 C     improved speed on P6/13.  Presumably, the K7 will want scheduling, if it
 C     at all wants to use MMX.
 C (2) We could save a register by not alternatingly using eax and edx in the
index 8891f3a84355445d14a90966dc9a8b17e3d4e171..5300616c14d9d0848ed28f5ebebe8a6647f4064d 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium-II mpn_divrem_1 -- mpn by limb division.
 
-dnl  Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 7bfed234ed9e49638bd94731072ae0e1bdacf87a..35c3aadfc1f68a536ed1a4102bab2198e760ec97 100644 (file)
@@ -1,26 +1,37 @@
 /* Intel P6/mmx gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009,
-2010 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2005, 2009, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 
 /* NOTE: In a fat binary build SQR_TOOM2_THRESHOLD here cannot be more than the
index e325b67d6445da559a0f1888992819924f655216..febd1c0e6ca97d12635637133c738e1765a599ef 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium-II mpn_lshift -- mpn left shift.
 
 dnl  Copyright 2001 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  The P55 code runs well on P-II/III, but could stand some minor tweaks
index 421daa530860bcf86bb1cc45787d302fc6c4f62c..fd340e4b450f3fd453141a331572bb29cea37c01 100644 (file)
@@ -2,21 +2,32 @@ dnl  Intel Pentium-II mpn_popcount, mpn_hamdist -- population count and
 dnl  hamming distance.
 
 dnl  Copyright 2000, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index b1543cdf524698b5f6e8f06abcad038d6d18a92f..77aa1909fa7f62fb6621c3e509c16145c4f752d7 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium-II mpn_rshift -- mpn left shift.
 
 dnl  Copyright 2001 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  The P55 code runs well on P-II/III, but could stand some minor tweaks
index 5e854b727476632c2283db57bdb1a5a70f8a9fd5..b88ab5d17cddd7cae90717fbe0e7947ecb9f4846 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P6 mpn_mod_34lsub1 -- remainder modulo 2^24-1.
 
-dnl  Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2002, 2004 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index dc88b058a47f9255df33456b9f3dc8cdc5533ecc..c62b676e5adf1ae7cb538b92933b3ef0cd8afdce 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P6 mpn_modexact_1_odd -- exact division style remainder.
 
-dnl  Copyright 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2002, 2007 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index fc1afbdf0eb660f15f752f70435bab49b2370519..d87bc12b6062610056cafc8f56e9bb63edf7f84c 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P6 mpn_mul_basecase -- multiply two mpn numbers.
 
-dnl  Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2003 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 2f58968a3115dbc94c53d6ff7482a8cb2f8336d7..db2f2601c9e3ea6e35b2673d5fcf22ce3cae03b9 100644 (file)
@@ -2,21 +2,32 @@ dnl  Intel Pentium-III mpn_popcount, mpn_hamdist -- population count and
 dnl  hamming distance.
 
 dnl  Copyright 2000, 2002, 2004, 2007 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 0b690afb19f6b39611eb48bae82e870f44faac24..8fc7fdf3753e8a68ef932a84759c538aed2d1444 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P6 mpn_sqr_basecase -- square an mpn number.
 
 dnl  Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index b601c54bcfabd2b0b83c8afa4986501caa76508f..144b627aa367ea54b0f6f303f2a2d0179bb8ff9a 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P6/SSE2 mpn_addmul_1.
 
 dnl  Copyright 2008 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 35de2674899d77b6a647629a72e4671aef53a7a7..69226289a7d64a331ba30760b89a0743cb78ed8f 100644 (file)
@@ -1,26 +1,36 @@
 /* Intel P6/sse2 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2008, 2009, 2010 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2003, 2008-2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 
 /* NOTE: In a fat binary build SQR_TOOM2_THRESHOLD here cannot be more than the
index 64575ea0543ac9bc9c772a9379cd27720d49f03a..8b7b7adaa5f42c8bc438da6b85d353ef036b15f6 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P6/SSE2 mpn_mod_1_1.
 
 dnl  Copyright 2009, 2011 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index e3631dbc8ce19a57464444a4039133f39f515d92..49c96c60b9c22e81629fbf90a17a6afb39346fba 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P6/SSE2 mpn_mod_1_4.
 
 dnl  Copyright 2009, 2011 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index fc3d4e641498e5197f48db2e3d4dbc17edc08492..50e5b6983aafecfb5d922416004cc33be22ba595 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P6/SSE2 mpn_mul_1.
 
 dnl  Copyright 2008 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index f52ece025fe2107d9e0725d99155393bd3eb7ef4..4687625790ca1a7a500d6b011bdfbdf45597601c 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P6/SSE2 mpn_mul_basecase.
 
 dnl  Copyright 2008 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index f818d6e2309afb79f6bd2bcbba93427bc68a720a..4c02b93be288bb6e909680b039b98086b5daea6f 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P6/SSE2 mpn_popcount -- population count.
 
 dnl  Copyright 2008 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 8a7f24974d7f17ec8e0a29fcc611eaae08787276..76b574b6c74d1c034a270c88dc80bebb2dfb6f87 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P6/SSE2 mpn_sqr_basecase.
 
 dnl  Copyright 2008 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index ae97fd6346b005ce1a1bed77d0bd07a6b5b6620d..98a603ce93e32347cbff8a4be41112bedf59f242 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P6/SSE2 mpn_submul_1.
 
 dnl  Copyright 2008 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 6c4d872c47667cb848f9a355f9c1f71b1d528b3c..305936bbd94a3316db1f2e0b60079388fbdf3efe 100644 (file)
@@ -1,19 +1,30 @@
-Copyright 1996, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+Copyright 1996, 1999-2001, 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index aa761290560041ce31e7ccfaf88d72433740d4ae..01ebfb96ae41a3b6154702326a19a8f4e14314f3 100644 (file)
@@ -1,22 +1,32 @@
 dnl  Intel Pentium mpn_add_n/mpn_sub_n -- mpn addition and subtraction.
 
-dnl  Copyright 1992, 1994, 1995, 1996, 1999, 2000, 2002 Free Software
-dnl  Foundation, Inc.
-dnl
+dnl  Copyright 1992, 1994-1996, 1999, 2000, 2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index a50299b5cf4633a815b372bf01150608496ae082..d83cc4513b60b07815a778e8671c5e2c575522a2 100644 (file)
@@ -2,21 +2,32 @@ dnl  Intel Pentium mpn_addmul_1 -- mpn by limb multiplication.
 
 dnl  Copyright 1992, 1994, 1996, 1999, 2000, 2002 Free Software Foundation,
 dnl  Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 7e84fc817305159c256dc0e0c43f13ead6c96080..9fee3cb87a250c775cedcb703c2a247dfe0f7c0e 100644 (file)
@@ -1,23 +1,34 @@
 dnl  Intel Pentium mpn_divexact_1 -- mpn by limb exact division.
 
+dnl  Rearranged from mpn/x86/pentium/dive_1.asm by Marco Bodrato.
+
 dnl  Copyright 2001, 2002, 2011 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
-dnl  Rearranged from mpn/x86/pentium/dive_1.asm by Marco Bodrato.
+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  The GNU MP Library is free software; you can redistribute it and/or
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+dnl  or both in parallel, as here.
 dnl
-dnl  The GNU MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index fbb4ffd3f398fa172db7ab15b2f085f74f0982e6..b0805452a62e50c6fd2c91dceb35f96a611738af 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium mpn_com -- mpn ones complement.
 
 dnl  Copyright 1996, 2001, 2002, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 2be8c765ac8a76679a695eb221b3489c99c99604..72a543b2a3726d7ab781d8d140603475f52dcb04 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium mpn_copyd -- copy limb vector, decrementing.
 
 dnl  Copyright 1996, 2001, 2002, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 9da08e2c0622772602fd8e223d55e31deb041786..d983d6b46ec0f00abf0e3d7dcbfe035c0cf382f7 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium mpn_copyi -- copy limb vector, incrementing.
 
 dnl  Copyright 1996, 2001, 2002, 2006 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 253d1283da8b31db7ce34262c392b505d3824a4c..f80632f4794871955d447d66e35d31073f6378d0 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium mpn_divexact_1 -- mpn by limb exact division.
 
 dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index de293c4a2133fe3124b5b14929972bd0d1ad51fd..befa6e27a95943f7a272cbc8104f4444d3c5db2f 100644 (file)
@@ -1,26 +1,36 @@
 /* Intel P54 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2004 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 
 /* For mpn/x86/pentium/mod_1.asm */
index a129030f74d4cd286687b6779f53f1d5db192c9d..2d7bc99b1267e9545907d7ad032e273faaf1b882 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P5 mpn_hamdist -- mpn hamming distance.
 
 dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 0552e55809d3d6222a035e448b6530c6294b9053..18773172e98881602b2abd1582f06a2cc5a6446e 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium mpn_and_n,...,mpn_xnor_n -- bitwise logical operations.
 
 dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index ece51e06d3a855481d64290a3e791e031d7237e8..2a31f36c6edd21f65516bebe4569f0df57cae0e7 100644 (file)
@@ -1,22 +1,32 @@
 dnl  Intel Pentium mpn_lshift -- mpn left shift.
 
-dnl  Copyright 1992, 1994, 1995, 1996, 1999, 2000, 2002 Free Software
-dnl  Foundation, Inc.
-dnl
+dnl  Copyright 1992, 1994-1996, 1999, 2000, 2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 958a322247c6274fc8fe4b59d049eeb93beef9dc..02a0def127b175979e1c1c99bb315c9bac81ea0a 100644 (file)
@@ -1,26 +1,37 @@
 /* Intel P55 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 2009, 2010 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999-2002, 2004, 2009, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
 
 /* For mpn/x86/pentium/mod_1.asm */
index 185eeaee229bbf5a7e0184f130bcfec70fe32fb2..72e3196697613b2488391862e092f137c549b4e9 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P55 mpn_hamdist -- mpn hamming distance.
 
 dnl  Copyright 2000, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 012d7949529e5d380a88c0d04a646ffe83f5f26c..04b0ddcc8f09e986e394d462acd965e612f64655 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P5 mpn_lshift -- mpn left shift.
 
-dnl  Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index b9fe77ed0743f6af2989aedba9720e56c74da3cc..4ced577b13ae013874f41e800bfa600e369b6881 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium MMX mpn_mul_1 -- mpn by limb multiplication.
 
-dnl  Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index f50b8ab0e0746aaf7288d133921321b824b06ac2..e3b274bb6365aa5b4d73c69afc516bdee5631474 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P5 mpn_rshift -- mpn right shift.
 
 dnl  Copyright 2000, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 201081a437f74e8eca57203b669cdbcf0bbbdd5e..2d88223b847014d5f95c106b2427eb7c75afe7c5 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P5 mpn_mod_34lsub1 -- mpn remainder modulo 2**24-1.
 
-dnl  Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index afb0ebe5bfa6e8ffebc7bb629f70afe5f40f8065..eb2790e1a0844315d066b8873f1d21aa45ece152 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium mpn_modexact_1_odd -- exact division style remainder.
 
-dnl  Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index c6b255c3228698366ac6027efc23960063aeb8d3..a0858af2b41fb4b869294e4113ea1dcbf2744ca1 100644 (file)
@@ -2,21 +2,32 @@ dnl  Intel Pentium mpn_mul_1 -- mpn by limb multiplication.
 
 dnl  Copyright 1992, 1994, 1996, 1999, 2000, 2002 Free Software Foundation,
 dnl  Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 36a025c425de868479b36db1b5f449b1aef13a2c..4c7beb5df2767d7748fb86c587840a33f008ecb4 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium mpn_mul_2 -- mpn by 2-limb multiplication.
 
 dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index fd24fdf7fabe9205082d3d89b237c8823e5d759d..50e15d356720d0e8c585f429b03a0f0473f30867 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium mpn_mul_basecase -- mpn by mpn multiplication.
 
-dnl  Copyright 1996, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1996, 1998-2000, 2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index df53bb8842bdf925ae054ab9d45704e11b3174d4..b8d84ad2e2b2d35aadb428c31e7b20294fe3b06d 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P5 mpn_popcount -- mpn bit population count.
 
 dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 949b0d2e2f003496020c03e5138b4d20571b7dc4..2105c4c93528f5f03bf32437ac9a56b9dbd1d469 100644 (file)
@@ -1,22 +1,32 @@
 dnl  Intel Pentium mpn_rshift -- mpn right shift.
 
-dnl  Copyright 1992, 1994, 1995, 1996, 1999, 2000, 2002 Free Software
-dnl  Foundation, Inc.
-dnl
+dnl  Copyright 1992, 1994-1996, 1999, 2000, 2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index e4fca7c54629b45dd356f8a90d9286afe7ec107b..b11d767da2fe8df40890ad21238252aa1b1c762e 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel P5 mpn_sqr_basecase -- square an mpn number.
 
-dnl  Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 8dc0479f0445261d86b0326d761a55369b7c8d22..90f752e5d5aba4a91772b9c0c432bf67dc457a3d 100644 (file)
@@ -3,17 +3,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index 491ad601281d2734c9292e9a74826b985a38ab4c..82af81c522ba3257d213369cac1fddaf0d98f74d 100644 (file)
@@ -1,22 +1,32 @@
 dnl  Pentium-4 mpn_copyd -- copy limb vector, decrementing.
-dnl
 
-dnl  Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2001 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  The std/rep/movsl/cld is very slow for small blocks on pentium4.  Its
index bf812c822b8fa551a19dd35a9cfcda8e8034e042..b6148879fa47534ae19fe0ebd1b05e6fb368970a 100644 (file)
@@ -1,22 +1,32 @@
 dnl  Pentium-4 mpn_copyi -- copy limb vector, incrementing.
-dnl
 
-dnl  Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2001 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  The rep/movsl is very slow for small blocks on pentium4.  Its startup
index 5d316d5da487a7685e88c8a179464144901516cd..b5eca66698d9e631e70a5f209182f6e61ad05479 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium-4 mpn_lshift -- left shift.
 
 dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 2e79816821e543294bbe86e157e007f0bab66ef0..9563cb57e498c025f8de3c026e5d6619c774fe28 100644 (file)
@@ -1,22 +1,33 @@
 dnl  Intel Pentium 4 mpn_popcount, mpn_hamdist -- population count and
 dnl  hamming distance.
 
-dnl  Copyright 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2002, 2007 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index a7dec54a3a9b5dca53664eb882913f15976d61f4..3ac0094a5a0ae4f4f41c39fc2942818f3bfe12a6 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium-4 mpn_rshift -- right shift.
 
 dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 3c84bacb63795ada51ec3d5141b889bde465ab49..8e2380e493186cd51a879df5ce1146426ba386c8 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium-4 mpn_add_n -- mpn addition.
 
 dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 25b8b4b0f126e7c32783aa5d45325036e03db277..93b63b2018dfeabeb60231ef4ac0953dd7b185d3 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium-4 mpn_addlsh1_n -- mpn x+2*y.
 
-dnl  Copyright 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2001-2004, 2006 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 48c69fb31029436bb5015f16e626b8f369c0a590..78102072bfc783fb1df23838704fbe5f421b86c2 100644 (file)
@@ -1,21 +1,32 @@
 dnl  mpn_addmul_1 for Pentium 4 and P6 models with SSE2 (i.e., 9,D,E,F).
 
 dnl  Copyright 2005, 2007, 2011 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
index ae4f3ffa5bc7a285c3b74a5e08609a19a6b945aa..354300e4de1b01fe0742a325d7a166e7fb61ff65 100644 (file)
@@ -1,23 +1,34 @@
 dnl  Intel Atom  mpn_bdiv_dbm1.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
-dnl
+
 dnl  Copyright 2011 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 81a1a9c80bcefa22104c53a63880fda34de4da89..f7f461d56f0003916e2fcaebb3f871c50ea748ba 100644 (file)
@@ -1,23 +1,34 @@
 dnl  Intel Pentium-4 mpn_divexact_1 -- mpn by limb exact division.
 
+dnl  Rearranged from mpn/x86/pentium4/sse2/dive_1.asm by Marco Bodrato.
+
 dnl  Copyright 2001, 2002, 2007, 2011 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
-dnl  Rearranged from mpn/x86/pentium4/sse2/dive_1.asm by Marco Bodrato.
+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  The GNU MP Library is free software; you can redistribute it and/or
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+dnl  or both in parallel, as here.
 dnl
-dnl  The GNU MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86/pentium4/sse2/cnd_add_n.asm b/mpn/x86/pentium4/sse2/cnd_add_n.asm
new file mode 100644 (file)
index 0000000..b3f3474
--- /dev/null
@@ -0,0 +1,95 @@
+dnl  Intel Pentium-4 mpn_cnd_add_n -- mpn addition.
+
+dnl  Copyright 2001, 2002, 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 P6 model 0-8,10-12            -
+C P6 model 9   (Banias)                 ?
+C P6 model 13  (Dothan)                 4.67
+C P4 model 0-1 (Willamette)     ?
+C P4 model 2   (Northwood)      5
+C P4 model 3-4 (Prescott)       5.25
+
+defframe(PARAM_SIZE, 20)
+defframe(PARAM_SRC2, 16)
+defframe(PARAM_SRC1, 12)
+defframe(PARAM_DST,  8)
+defframe(PARAM_CND,  4)
+
+dnl  re-use parameter space
+define(SAVE_EBX,`PARAM_SRC1')
+
+define(`cnd', `%mm3')
+
+       TEXT
+       ALIGN(8)
+
+       ALIGN(8)
+PROLOGUE(mpn_cnd_add_n)
+deflit(`FRAME',0)
+       pxor    %mm0, %mm0
+
+       mov     PARAM_CND, %eax
+       neg     %eax
+       sbb     %eax, %eax
+       movd    %eax, cnd
+
+       mov     PARAM_SRC1, %eax
+       mov     %ebx, SAVE_EBX
+       mov     PARAM_SRC2, %ebx
+       mov     PARAM_DST, %edx
+       mov     PARAM_SIZE, %ecx
+
+       lea     (%eax,%ecx,4), %eax     C src1 end
+       lea     (%ebx,%ecx,4), %ebx     C src2 end
+       lea     (%edx,%ecx,4), %edx     C dst end
+       neg     %ecx                    C -size
+
+L(top):        movd    (%ebx,%ecx,4), %mm2
+       movd    (%eax,%ecx,4), %mm1
+       pand    cnd, %mm2
+       paddq   %mm2, %mm1
+
+       paddq   %mm1, %mm0
+       movd    %mm0, (%edx,%ecx,4)
+
+       psrlq   $32, %mm0
+
+       add     $1, %ecx
+       jnz     L(top)
+
+       movd    %mm0, %eax
+       mov     SAVE_EBX, %ebx
+       emms
+       ret
+
+EPILOGUE()
diff --git a/mpn/x86/pentium4/sse2/cnd_sub_n.asm b/mpn/x86/pentium4/sse2/cnd_sub_n.asm
new file mode 100644 (file)
index 0000000..339a23e
--- /dev/null
@@ -0,0 +1,114 @@
+dnl  Intel Pentium-4 mpn_cnd_sub_n -- mpn subtraction.
+
+dnl  Copyright 2001, 2002, 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 P6 model 0-8,10-12            -
+C P6 model 9   (Banias)                 ?
+C P6 model 13  (Dothan)                 4.67
+C P4 model 0-1 (Willamette)     ?
+C P4 model 2   (Northwood)      5
+C P4 model 3-4 (Prescott)       5.25
+
+defframe(PARAM_SIZE, 20)
+defframe(PARAM_SRC2, 16)
+defframe(PARAM_SRC1, 12)
+defframe(PARAM_DST,  8)
+defframe(PARAM_CND,  4)
+
+dnl  re-use parameter space
+define(SAVE_EBX,`PARAM_SRC1')
+
+define(`cnd', `%mm3')
+
+       TEXT
+       ALIGN(8)
+
+       ALIGN(8)
+PROLOGUE(mpn_cnd_sub_n)
+deflit(`FRAME',0)
+       pxor    %mm0, %mm0
+
+       mov     PARAM_CND, %eax
+       neg     %eax
+       sbb     %eax, %eax
+       movd    %eax, cnd
+
+       mov     PARAM_SRC1, %eax
+       mov     %ebx, SAVE_EBX
+       mov     PARAM_SRC2, %ebx
+       mov     PARAM_DST, %edx
+       mov     PARAM_SIZE, %ecx
+
+       lea     (%eax,%ecx,4), %eax     C src1 end
+       lea     (%ebx,%ecx,4), %ebx     C src2 end
+       lea     (%edx,%ecx,4), %edx     C dst end
+       neg     %ecx                    C -size
+
+L(top):        movd    (%ebx,%ecx,4), %mm2
+       movd    (%eax,%ecx,4), %mm1
+       pand    cnd, %mm2
+       psubq   %mm2, %mm1
+
+       psubq   %mm0, %mm1
+       movd    %mm1, (%edx,%ecx,4)
+
+       psrlq   $63, %mm1
+
+       add     $1, %ecx
+       jz      L(done_mm1)
+
+       movd    (%ebx,%ecx,4), %mm2
+       movd    (%eax,%ecx,4), %mm0
+       pand    cnd, %mm2
+       psubq   %mm2, %mm0
+
+       psubq   %mm1, %mm0
+       movd    %mm0, (%edx,%ecx,4)
+
+       psrlq   $63, %mm0
+
+       add     $1, %ecx
+       jnz     L(top)
+
+       movd    %mm0, %eax
+       mov     SAVE_EBX, %ebx
+       emms
+       ret
+
+L(done_mm1):
+       movd    %mm1, %eax
+       mov     SAVE_EBX, %ebx
+       emms
+       ret
+
+EPILOGUE()
index 493783a5919267ee9f83045295847c564f9fc095..238f0dd8a50414d00e1cf1aef717d02d12e4d15f 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium-4 mpn_divexact_1 -- mpn by limb exact division.
 
 dnl  Copyright 2001, 2002, 2007 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 7f973dbf983861af7115994fbc43284888d72757..0146fab1177e0dbac80e254efeb769b1a6649749 100644 (file)
@@ -1,22 +1,32 @@
 dnl  Intel Pentium-4 mpn_divrem_1 -- mpn by limb division.
 
-dnl  Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation,
-dnl  Inc.
-dnl
+dnl  Copyright 1999-2004 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 7a324ba196f753cb37331d73b041f4f989e9b707..a94ae868b374c73b33cf7c2cb801f625ec4fe60a 100644 (file)
@@ -1,26 +1,40 @@
 /* Intel Pentium-4 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008,
-2009, 2010 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2005, 2007-2010, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 4
+#define GMP_LIMB_BYTES 4
 
+/* 2600 MHz P4 Northwood */
+/* FFT tuning limit = 12500000 */
+/* Generated by tuneup.c, 2014-03-12, gcc 4.2 */
 
 #define MOD_1_NORM_THRESHOLD                24
 #define MOD_1_UNNORM_THRESHOLD           MP_SIZE_T_MAX  /* never */
@@ -30,118 +44,163 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #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 USE_PREINV_DIVREM_1                  1  /* native */
+#define DIV_QR_1N_PI1_METHOD                 2
+#define DIV_QR_1_NORM_THRESHOLD             19
+#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 MUL_TOOM22_THRESHOLD                29
-#define MUL_TOOM33_THRESHOLD               107
-#define MUL_TOOM44_THRESHOLD               276
-#define MUL_TOOM6H_THRESHOLD               422
-#define MUL_TOOM8H_THRESHOLD               587
+#define MUL_TOOM33_THRESHOLD               113
+#define MUL_TOOM44_THRESHOLD               288
+#define MUL_TOOM6H_THRESHOLD               454
+#define MUL_TOOM8H_THRESHOLD               592
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD     117
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     207
+#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     184
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD     164
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD     186
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     287
 
 #define SQR_BASECASE_THRESHOLD               0  /* always (native) */
-#define SQR_TOOM2_THRESHOLD                 48
+#define SQR_TOOM2_THRESHOLD                 44
 #define SQR_TOOM3_THRESHOLD                173
-#define SQR_TOOM4_THRESHOLD                264
-#define SQR_TOOM6_THRESHOLD                354
+#define SQR_TOOM4_THRESHOLD                390
+#define SQR_TOOM6_THRESHOLD                  0  /* always */
 #define SQR_TOOM8_THRESHOLD                915
 
 #define MULMID_TOOM42_THRESHOLD             66
 
 #define MULMOD_BNM1_THRESHOLD               19
-#define SQRMOD_BNM1_THRESHOLD               19
+#define SQRMOD_BNM1_THRESHOLD               23
 
-#define MUL_FFT_MODF_THRESHOLD            1103  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD            1147  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    904, 6}, {     15, 5}, {     32, 6}, {     17, 5}, \
-    {     35, 6}, {     19, 5}, {     39, 6}, {     29, 7}, \
-    {     15, 6}, {     33, 7}, {     17, 6}, {     35, 7}, \
-    {     19, 6}, {     41, 7}, {     21, 6}, {     43, 7}, \
-    {     23, 6}, {     47, 7}, {     27, 6}, {     55, 7}, \
-    {     31, 6}, {     63, 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}, {    167,10}, \
-    {     95, 9}, {    191,10}, {    111,11}, {     63,10}, \
-    {    127, 9}, {    255,10}, {    159, 9}, {    319,10}, \
-    {    175,11}, {     95,10}, {    207,12}, {     63,11}, \
-    {    127,10}, {    287,11}, {    159,10}, {    319, 9}, \
-    {    639,10}, {    351,11}, {    191,10}, {    383,11}, \
-    {    223,12}, {   4096,13}, {   8192,14}, {  16384,15}, \
-    {  32768,16} }
-#define MUL_FFT_TABLE3_SIZE 77
+  { {   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}, \
+    {    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
 #define MUL_FFT_THRESHOLD                 7808
 
-#define SQR_FFT_MODF_THRESHOLD             824  /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD             896  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    793, 5}, {     28, 6}, {     15, 5}, {     33, 6}, \
-    {     17, 5}, {     35, 6}, {     28, 7}, {     15, 6}, \
-    {     33, 7}, {     17, 6}, {     35, 7}, {     19, 6}, \
-    {     41, 7}, {     23, 6}, {     47, 7}, {     27, 6}, \
-    {     55, 8}, {     15, 7}, {     31, 6}, {     63, 7}, \
-    {     37, 8}, {     19, 7}, {     43, 8}, {     23, 7}, \
-    {     51, 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}, {    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}, {    255, 9}, \
-    {    511,10}, {    271,11}, {    159,10}, {    319, 9}, \
-    {    639,11}, {    191,10}, {    399, 9}, {    799,12}, \
-    {   4096,13}, {   8192,14}, {  16384,15}, {  32768,16} }
-#define SQR_FFT_TABLE3_SIZE 72
+  { {    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
 
-#define MULLO_BASECASE_THRESHOLD            13
-#define MULLO_DC_THRESHOLD                  48
+#define MULLO_BASECASE_THRESHOLD            12
+#define MULLO_DC_THRESHOLD                  55
 #define MULLO_MUL_N_THRESHOLD            14709
 
 #define DC_DIV_QR_THRESHOLD                 38
 #define DC_DIVAPPR_Q_THRESHOLD              77
-#define DC_BDIV_QR_THRESHOLD                54
-#define DC_BDIV_Q_THRESHOLD                 97
+#define DC_BDIV_QR_THRESHOLD                51
+#define DC_BDIV_Q_THRESHOLD                 85
 
-#define INV_MULMOD_BNM1_THRESHOLD           57
-#define INV_NEWTON_THRESHOLD               202
-#define INV_APPR_THRESHOLD                 116
+#define INV_MULMOD_BNM1_THRESHOLD           56
+#define INV_NEWTON_THRESHOLD               121
+#define INV_APPR_THRESHOLD                  93
 
-#define BINV_NEWTON_THRESHOLD              327
-#define REDC_1_TO_REDC_N_THRESHOLD          34
+#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               66
-#define MU_BDIV_QR_THRESHOLD              1787
-#define MU_BDIV_Q_THRESHOLD               2350
+#define MUPI_DIV_QR_THRESHOLD               62
+#define MU_BDIV_QR_THRESHOLD              2172
+#define MU_BDIV_Q_THRESHOLD               2304
 
-#define POWM_SEC_TABLE  2,35,164,1068,2500
+#define POWM_SEC_TABLE  1,19,102,615,2111
 
-#define MATRIX22_STRASSEN_THRESHOLD         30
-#define HGCD_THRESHOLD                      85
-#define HGCD_APPR_THRESHOLD                 95
+#define MATRIX22_STRASSEN_THRESHOLD         23
+#define HGCD_THRESHOLD                      88
+#define HGCD_APPR_THRESHOLD                 93
 #define HGCD_REDUCE_THRESHOLD             5010
-#define GCD_DC_THRESHOLD                   393
-#define GCDEXT_DC_THRESHOLD                253
+#define GCD_DC_THRESHOLD                   379
+#define GCDEXT_DC_THRESHOLD                258
 #define JACOBI_BASE_METHOD                   4
 
-#define GET_STR_DC_THRESHOLD                11
-#define GET_STR_PRECOMPUTE_THRESHOLD        24
-#define SET_STR_DC_THRESHOLD               119
-#define SET_STR_PRECOMPUTE_THRESHOLD      1084
+#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                  342
-#define FAC_ODD_THRESHOLD                   27
+#define FAC_DSC_THRESHOLD                  906
+#define FAC_ODD_THRESHOLD                   28
index 89a0b9ab542259689a13f1465ac493f56f86e345..ee88babeeea3355e5d839ef5c70fb807908e3b1a 100644 (file)
@@ -3,21 +3,32 @@ dnl  x86-32 mpn_mod_1_1p for Pentium 4 and P6 models with SSE2 (i.e., 9,D,E,F).
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
 dnl  Copyright 2009, 2010 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 91d5c381d068cd6391db950007fd24a16c147a29..eb2edb6297d144226502063804483103e7d0e6f7 100644 (file)
@@ -3,21 +3,32 @@ dnl  x86-32 mpn_mod_1s_4p for Pentium 4 and P6 models with SSE2 (i.e. 9,D,E,F).
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
 dnl  Copyright 2009, 2010 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 1598b41785d5d5ff4ab5eaed32ae4b8748cf7868..31e25b79bc3bc9c05fee72941b06a80c15855d08 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium 4 mpn_mod_34lsub1 -- remainder modulo 2^24-1.
 
-dnl  Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2000-2003 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 64d01e892690ad42b6d5e0f888754ba4fea3814c..778c478169d6c7ff26fcfa8f155fc9ba1f140f93 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium-4 mpn_modexact_1_odd -- mpn by limb exact remainder.
 
 dnl  Copyright 2001, 2002, 2007 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index aec737c270b368dec8ce703f7c0720ef5581c83e..6347b8bf624b8cfa7500f5d89f707377a4fe2217 100644 (file)
@@ -1,21 +1,32 @@
 dnl  mpn_mul_1 for Pentium 4 and P6 models with SSE2 (i.e., 9,D,E,F).
 
 dnl  Copyright 2005, 2007, 2011 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
index 2628e5eb72dfe894ffc203d710c6be823b0a6e56..6e3775ae096f655a036b67cd4fad7e1035d18e18 100644 (file)
@@ -1,21 +1,32 @@
 dnl  mpn_mul_basecase for Pentium 4 and P6 models with SSE2 (i.e., 9,D,E,F).
 
 dnl  Copyright 2001, 2002, 2005, 2007 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 2f06984c7d91ee7feaad5cd54c9257e6c9af1edd..b8238b9b66efd8f0755e32a413fd2d82428fcf7e 100644 (file)
@@ -1,21 +1,32 @@
 dnl  X86-32 and X86-64 mpn_popcount using SSE2.
 
 dnl  Copyright 2006, 2007, 2011 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
@@ -49,7 +60,7 @@ C VIA nano                    6.5
 C TODO
 C  * Make a mpn_hamdist based on this.  Alignment could either be handled by
 C    using movdqu for one operand and movdqa for the other, or by painfully
-C    shifting as we go.  Unfortunately, there seem to be no useable shift
+C    shifting as we go.  Unfortunately, there seem to be no usable shift
 C    instruction, except for one that takes an immediate count.
 C  * It would probably be possible to cut a few cycles/limb using software
 C    pipelining.
index bbf43245cb1d43b5810541605a6f119b72a06b7b..f421d1323eb091c81912ccb4baa55f2195549b99 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium-4 mpn_rsh1add_n -- mpn (x+y)/2
 
-dnl  Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2001-2004 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index a10859abcde8ee5d6ca2fb190b52f7f6156bc4c9..2dd57d25d9af113662484df6f99de9cc501a932c 100644 (file)
@@ -1,21 +1,32 @@
 dnl  mpn_sqr_basecase for Pentium 4 and P6 models with SSE2 (i.e., 9,D,E,F).
 
 dnl  Copyright 2001, 2002, 2007 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 5ad0594cbf051bdd093a56e965eebfe19af25395..5ba1c018ecb6fced0b37825610819eabe783a9ac 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Intel Pentium-4 mpn_sub_n -- mpn subtraction.
 
 dnl  Copyright 2001, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 2ef25d31270c183656f76ea0aac2bcd05da6fbbf..020675bd7bbf1e8a6f5946c2971a5460338cb90c 100644 (file)
@@ -2,21 +2,32 @@ dnl  Intel Pentium-4 mpn_submul_1 -- Multiply a limb vector with a limb and
 dnl  subtract the result from a second limb vector.
 
 dnl  Copyright 2001, 2002, 2008, 2010 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index b987c6a7b616e7ded1434cf765bbf8b8b0bcacfd..a60dcaa4b23a3adfbd42c6b68ee96a2f1319d2cc 100644 (file)
@@ -1,22 +1,32 @@
 dnl  x86 mpn_rshift -- mpn right shift.
 
-dnl  Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002 Free Software
-dnl  Foundation, Inc.
-dnl
+dnl  Copyright 1992, 1994, 1996, 1999-2002 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86/sec_tabselect.asm b/mpn/x86/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..c7c2e05
--- /dev/null
@@ -0,0 +1,115 @@
+dnl  x86 mpn_sec_tabselect.
+
+dnl  Copyright 2011 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 P5                            ?
+C P6 model 0-8,10-12            ?
+C P6 model 9  (Banias)          ?
+C P6 model 13 (Dothan)          ?
+C P4 model 0  (Willamette)      ?
+C P4 model 1  (?)               ?
+C P4 model 2  (Northwood)       4.5
+C P4 model 3  (Prescott)        ?
+C P4 model 4  (Nocona)          ?
+C Intel Atom                    ?
+C AMD K6                        ?
+C AMD K7                        3.4
+C AMD K8                        ?
+C AMD K10                       ?
+
+C NOTES
+C  * This has not been tuned for any specific processor.  Its speed should not
+C    be too bad, though.
+C  * Using SSE2 could result in many-fold speedup.
+
+C mpn_sec_tabselect (mp_limb_t *rp, mp_limb_t *tp, mp_size_t n, mp_size_t nents, mp_size_t which)
+define(`rp',     `%edi')
+define(`tp',     `%esi')
+define(`n',      `%ebx')
+define(`nents',  `%ecx')
+define(`which',  `36(%esp)')
+
+define(`i',      `%ebp')
+define(`maskp',  `20(%esp)')
+define(`maskn',  `32(%esp)')
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_sec_tabselect)
+       push    %edi
+       push    %esi
+       push    %ebx
+       push    %ebp
+       mov     20(%esp), rp
+       mov     24(%esp), tp
+       mov     28(%esp), n
+       mov     32(%esp), nents
+
+       lea     (rp,n,4), rp
+       lea     (tp,n,4), tp
+       sub     nents, which
+L(outer):
+       mov     which, %eax
+       add     nents, %eax
+       neg     %eax                    C set CF iff 'which' != k
+       sbb     %eax, %eax
+       mov     %eax, maskn
+       not     %eax
+       mov     %eax, maskp
+
+       mov     n, i
+       neg     i
+
+       ALIGN(16)
+L(top):        mov     (tp,i,4), %eax
+       and     maskp, %eax
+       mov     (rp,i,4), %edx
+       and     maskn, %edx
+       or      %edx, %eax
+       mov     %eax, (rp,i,4)
+       inc     i
+       js      L(top)
+
+L(end):        mov     n, %eax
+       lea     (tp,%eax,4), tp
+       dec     nents
+       jne     L(outer)
+
+L(outer_end):
+       pop     %ebp
+       pop     %ebx
+       pop     %esi
+       pop     %edi
+       ret
+EPILOGUE()
index 53ccfcd747a26e63a20d61d532f59b1145e1da92..39f8a89805fb3529cb1428114883c41099fe1675 100644 (file)
@@ -1,21 +1,32 @@
 dnl  x86 generic mpn_sqr_basecase -- square an mpn number.
 
 dnl  Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
-dnl
+
 dnl  This file is part of the GNU MP Library.
 dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
 dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
index 6c55067b6ca1dec11976edd11987de912806415d..61efdd6c4fffddea3b5020a1e5263c9929a3f383 100755 (executable)
@@ -2,20 +2,31 @@
 #
 # Copyright 2000 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 # Usage: cd $(builddir)/mpn
index f32d070ab67905faa499580364847d26a16e17eb..b441b6579a79c10ecde66bb9e23d5c6cf22a821c 100755 (executable)
@@ -2,20 +2,31 @@
 #
 # Copyright 2001, 2002 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 # Usage: cd $(builddir)/mpn
diff --git a/mpn/x86/tabselect.asm b/mpn/x86/tabselect.asm
deleted file mode 100644 (file)
index 7c8c260..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-dnl  x86 mpn_tabselect.
-
-dnl  Copyright 2011 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 P5                            ?
-C P6 model 0-8,10-12            ?
-C P6 model 9  (Banias)          ?
-C P6 model 13 (Dothan)          ?
-C P4 model 0  (Willamette)      ?
-C P4 model 1  (?)               ?
-C P4 model 2  (Northwood)       4.5
-C P4 model 3  (Prescott)        ?
-C P4 model 4  (Nocona)          ?
-C Intel Atom                    ?
-C AMD K6                        ?
-C AMD K7                        3.4
-C AMD K8                        ?
-C AMD K10                       ?
-
-C NOTES
-C  * This has not been tuned for any specific processor.  Its speed should not
-C    be too bad, though.
-C  * Using SSE2 could result in many-fold speedup.
-
-C mpn_tabselect (mp_limb_t *rp, mp_limb_t *tp, mp_size_t n, mp_size_t nents, mp_size_t which)
-define(`rp',     `%edi')
-define(`tp',     `%esi')
-define(`n',      `%ebx')
-define(`nents',  `%ecx')
-define(`which',  `36(%esp)')
-
-define(`i',      `%ebp')
-define(`maskp',  `20(%esp)')
-define(`maskn',  `32(%esp)')
-
-ASM_START()
-       TEXT
-       ALIGN(16)
-PROLOGUE(mpn_tabselect)
-       push    %edi
-       push    %esi
-       push    %ebx
-       push    %ebp
-       mov     20(%esp), rp
-       mov     24(%esp), tp
-       mov     28(%esp), n
-       mov     32(%esp), nents
-
-       lea     (rp,n,4), rp
-       lea     (tp,n,4), tp
-       sub     nents, which
-L(outer):
-       mov     which, %eax
-       add     nents, %eax
-       neg     %eax                    C set CF iff 'which' != k
-       sbb     %eax, %eax
-       mov     %eax, maskn
-       not     %eax
-       mov     %eax, maskp
-
-       mov     n, i
-       neg     i
-
-       ALIGN(16)
-L(top):        mov     (tp,i,4), %eax
-       and     maskp, %eax
-       mov     (rp,i,4), %edx
-       and     maskn, %edx
-       or      %edx, %eax
-       mov     %eax, (rp,i,4)
-       inc     i
-       js      L(top)
-
-L(end):        mov     n, %eax
-       lea     (tp,%eax,4), tp
-       dec     nents
-       jne     L(outer)
-
-L(outer_end):
-       pop     %ebp
-       pop     %ebx
-       pop     %esi
-       pop     %edi
-       ret
-EPILOGUE()
index 5c7d3f35339aa046748e707e0ac65f9fd9bcfd58..a3ee08860f290b48500cad52656a947ee5270ec2 100644 (file)
@@ -1,21 +1,32 @@
 dnl  x86 mpn_udiv_qrnnd -- 2 by 1 limb division
 
 dnl  Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index d0116de6d98116d879c4a5d04fd04a713ec17d21..34fe43440089480de6e21d19f33d728ff3aa6676 100644 (file)
@@ -1,21 +1,32 @@
 dnl  mpn_umul_ppmm -- 1x1->2 limb multiplication
 
 dnl  Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 9f5649503ef0cef3f42e7291403619cdd51dee43..1538b6820c4bd4033d5a266ba4acd75123f71ff2 100644 (file)
@@ -4,23 +4,33 @@ divert(-1)
 dnl  m4 macros for x86 assembler.
 
 
-dnl  Copyright 1999, 2000, 2001, 2002, 2003, 2007, 2010, 2012 Free Software
-dnl  Foundation, Inc.
-dnl
+dnl  Copyright 1999-2003, 2007, 2010, 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  Notes:
@@ -41,7 +51,7 @@ dnl     This is only a problem in macro definitions, not in ordinary text,
 dnl     and not in macro parameters like text passed to forloop() or ifdef().
 
 
-deflit(BYTES_PER_MP_LIMB, 4)
+deflit(GMP_LIMB_BYTES, 4)
 
 
 dnl  Libtool gives -DPIC -DDLL_EXPORT to indicate a cygwin or mingw DLL.  We
@@ -63,6 +73,8 @@ define(CPUVEC_FUNCS_LIST,
 `addmul_1',
 `addmul_2',
 `bdiv_dbm1c',
+`cnd_add_n',
+`cnd_sub_n',
 `com',
 `copyd',
 `copyi',
index c89f84102764a7c61bf2ddd2c6aae84c430b7e2b..9c8a58662276b2c70e60f63fcd04cd49247a6cdc 100644 (file)
@@ -3,17 +3,28 @@ Copyright 2003, 2004, 2006, 2008 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
index ca7aacd14b2fee7d7179a4fb8055fb240ae44f25..87c21b4aca97c156947e10f53f3d48dbfe9ec7ae 100644 (file)
@@ -3,19 +3,30 @@ dnl  AMD64 mpn_addaddmul_1msb0, R = Au + Bv, u,v < 2^63.
 dnl  Copyright 2008 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 991817dbfa6fa238099b64d48a4b06ca4f841773..18307d719fcc245b6ed8ff8eee1e8dc36e3646f6 100644 (file)
@@ -4,19 +4,30 @@ dnl  add the result to a third limb vector.
 dnl  Copyright 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index ede2a5fb73f71aafa2de43a4fa5558c231846ea9..6ee08728232c26d30d0c82d88e4400e525facd68 100644 (file)
@@ -1,23 +1,33 @@
 dnl  AMD64 mpn_addlsh1_n -- rp[] = up[] + (vp[] << 1)
 dnl  AMD64 mpn_rsblsh1_n -- rp[] = (vp[] << 1) - up[]
 
-dnl  Copyright 2003, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2003, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -25,9 +35,12 @@ include(`../config.m4')
 C           cycles/limb
 C AMD K8,K9     2
 C AMD K10       2
+C AMD bd1       ?
+C AMD bobcat    ?
 C Intel P4      13
 C Intel core2   3.45
-C Intel corei   3.45
+C Intel NHM     ?
+C Intel SBR     ?
 C Intel atom    ?
 C VIA nano      ?
 
index 898d4c01b59889a5332e0e1d0695a35d82b74920..999e972fb46492e2dcaa750554d6225b189ae17c 100644 (file)
@@ -3,22 +3,33 @@ dnl  AMD64 mpn_rsblsh2_n -- rp[] = (vp[] << 2) - up[]
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2009, 2010, 2011 Free Software Foundation, Inc.
+dnl  Copyright 2009-2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 7e37166b91db08bd7ab27f0c7823e1ec1c47c75c..5a9fd4dfb9d690a828795f7dad18b9a12b963a6c 100644 (file)
@@ -1,22 +1,33 @@
 dnl  AMD64 mpn_addlshC_n -- rp[] = up[] + (vp[] << C)
 dnl  AMD64 mpn_rsblshC_n -- rp[] = (vp[] << C) - up[]
 
-dnl  Copyright 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2009-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 C           cycles/limb
index 6e81245d6000ca534b9623be9fb7def28bee5322..5ca128fbf35233e1d2585a9be2ca0f25b973b606 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD64 mpn_addlsh_n and mpn_rsblsh_n.  R = V2^k +- U.
 
-dnl  Copyright 2006, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2006, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index f32910ad7cab36e2b85e598698d3e15169adb7ee..54d0b3f9b75c82153727341ab7786ba9cc63db6c 100644 (file)
@@ -5,24 +5,35 @@ dnl  Contributed by David Harvey.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
-C AMD K8,K9     2.75 (most alignments, degenerates to 3 c/l for some aligments)
+C AMD K8,K9     2.75 (degenerates to 3 c/l for some alignments)
 C AMD K10       ?
 C Intel P4      ?
 C Intel core2   ?
@@ -90,20 +101,20 @@ L(3mod4):
        lea     -24(yp,n,8), yp
        neg     n
 
-        shr     $1, %al            C restore carry
-        mov     (up,n,8), w0
-        mov     8(up,n,8), w1
-        ADCSBB  (vp,n,8), w0
+       shr     $1, %al            C restore carry
+       mov     (up,n,8), w0
+       mov     8(up,n,8), w1
+       ADCSBB  (vp,n,8), w0
        mov     w0, (rp,n,8)
        cmovc   16(yp), el
-        ADCSBB  8(vp,n,8), w1
+       ADCSBB  8(vp,n,8), w1
        mov     w1, 8(rp,n,8)
        cmovc   8(yp), t0
-        mov     16(up,n,8), w0
-        ADCSBB  16(vp,n,8), w0
+       mov     16(up,n,8), w0
+       ADCSBB  16(vp,n,8), w0
        mov     w0, 16(rp,n,8)
        cmovc   (yp), t1
-       setc    %al                C save carry
+       setc    %al                C save carry
        add     t0, el
        adc     $0, eh
        add     t1, el
@@ -128,12 +139,12 @@ L(1mod4):
        lea     -8(yp,n,8), yp
        neg     n
 
-        shr     $1, %al            C restore carry
-        mov     (up,n,8), w0
-        ADCSBB  (vp,n,8), w0
-        mov     w0, (rp,n,8)
+       shr     $1, %al            C restore carry
+       mov     (up,n,8), w0
+       ADCSBB  (vp,n,8), w0
+       mov     w0, (rp,n,8)
        cmovc   (yp), el
-       setc    %al                C save carry
+       setc    %al                C save carry
 
        add     $1, n
        jnz     L(loop)
@@ -147,16 +158,16 @@ L(2mod4):
        lea     -16(yp,n,8), yp
        neg     n
 
-        shr     $1, %al            C restore carry
-        mov     (up,n,8), w0
-        mov     8(up,n,8), w1
-        ADCSBB  (vp,n,8), w0
-        mov     w0, (rp,n,8)
+       shr     $1, %al            C restore carry
+       mov     (up,n,8), w0
+       mov     8(up,n,8), w1
+       ADCSBB  (vp,n,8), w0
+       mov     w0, (rp,n,8)
        cmovc   8(yp), el
-        ADCSBB  8(vp,n,8), w1
-        mov     w1, 8(rp,n,8)
+       ADCSBB  8(vp,n,8), w1
+       mov     w1, 8(rp,n,8)
        cmovc   (yp), t0
-       setc    %al                C save carry
+       setc    %al                C save carry
        add     t0, el
        adc     $0, eh
 
@@ -166,39 +177,39 @@ L(2mod4):
 
        ALIGN(32)
 L(loop):
-        shr     $1, %al            C restore carry
-        mov     -8(yp), t0
-        mov     $0, R32(t3)
-        mov     (up,n,8), w0
-        mov     8(up,n,8), w1
-        ADCSBB  (vp,n,8), w0
-        cmovnc  t3, t0
-        ADCSBB  8(vp,n,8), w1
-        mov     -16(yp), t1
-        mov     w0, (rp,n,8)
-        mov     16(up,n,8), w0
-        mov     w1, 8(rp,n,8)
-        cmovnc  t3, t1
-        mov     -24(yp), t2
-        ADCSBB  16(vp,n,8), w0
-        cmovnc  t3, t2
-        mov     24(up,n,8), w1
-        ADCSBB  24(vp,n,8), w1
-        cmovc   -32(yp), t3
-        setc    %al                C save carry
-        add     t0, el
-        adc     $0, eh
-        add     t1, el
-        adc     $0, eh
-        add     t2, el
-        adc     $0, eh
-        mov     w0, 16(rp,n,8)
-        add     t3, el
-        lea     -32(yp), yp
-        adc     $0, eh
-        mov     w1, 24(rp,n,8)
-        add     $4, n
-        jnz     L(loop)
+       shr     $1, %al            C restore carry
+       mov     -8(yp), t0
+       mov     $0, R32(t3)
+       mov     (up,n,8), w0
+       mov     8(up,n,8), w1
+       ADCSBB  (vp,n,8), w0
+       cmovnc  t3, t0
+       ADCSBB  8(vp,n,8), w1
+       mov     -16(yp), t1
+       mov     w0, (rp,n,8)
+       mov     16(up,n,8), w0
+       mov     w1, 8(rp,n,8)
+       cmovnc  t3, t1
+       mov     -24(yp), t2
+       ADCSBB  16(vp,n,8), w0
+       cmovnc  t3, t2
+       mov     24(up,n,8), w1
+       ADCSBB  24(vp,n,8), w1
+       cmovc   -32(yp), t3
+       setc    %al                C save carry
+       add     t0, el
+       adc     $0, eh
+       add     t1, el
+       adc     $0, eh
+       add     t2, el
+       adc     $0, eh
+       mov     w0, 16(rp,n,8)
+       add     t3, el
+       lea     -32(yp), yp
+       adc     $0, eh
+       mov     w1, 24(rp,n,8)
+       add     $4, n
+       jnz     L(loop)
 
 L(end):
        mov     el, (ep)
index 529b4933009ec9d48106ce5399e4dfcf500225bd..ce5c2a49b6de3f0ee2ca74d2c599bc8548c41b29 100644 (file)
@@ -5,19 +5,30 @@ dnl  Contributed by David Harvey.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -110,39 +121,39 @@ L(odd):
 
        ALIGN(16)
 L(top):
-        mov     (up,n,8), w
-       shr     $1, cy2         C restore carry
-       ADCSBB  (vp,n,8), w
-       mov     w, (rp,n,8)
-       sbb     cy1, cy1        C generate mask, preserve CF
-
-       mov     8(up,n,8), w
-       ADCSBB  8(vp,n,8), w
-       mov     w, 8(rp,n,8)
-       sbb     cy2, cy2        C generate mask, preserve CF
-
-       mov     (yp1), w        C (e1h:e1l) += cy1 * yp1 limb
-       and     cy1, w
-       add     w, e1l
-       adc     $0, e1h
-
-       and     (yp1,yp2), cy1  C (e2h:e2l) += cy1 * yp2 limb
-       add     cy1, e2l
-       adc     $0, e2h
-
-       mov     -8(yp1), w      C (e1h:e1l) += cy2 * next yp1 limb
-       and     cy2, w
-       add     w, e1l
-       adc     $0, e1h
-
-       mov     -8(yp1,yp2), w  C (e2h:e2l) += cy2 * next yp2 limb
-       and     cy2, w
-       add     w, e2l
-       adc     $0, e2h
-
-       add     $2, n
-       lea     -16(yp1), yp1
-       jnz     L(top)
+       mov     (up,n,8), w
+       shr     $1, cy2         C restore carry
+       ADCSBB  (vp,n,8), w
+       mov     w, (rp,n,8)
+       sbb     cy1, cy1        C generate mask, preserve CF
+
+       mov     8(up,n,8), w
+       ADCSBB  8(vp,n,8), w
+       mov     w, 8(rp,n,8)
+       sbb     cy2, cy2        C generate mask, preserve CF
+
+       mov     (yp1), w        C (e1h:e1l) += cy1 * yp1 limb
+       and     cy1, w
+       add     w, e1l
+       adc     $0, e1h
+
+       and     (yp1,yp2), cy1  C (e2h:e2l) += cy1 * yp2 limb
+       add     cy1, e2l
+       adc     $0, e2h
+
+       mov     -8(yp1), w      C (e1h:e1l) += cy2 * next yp1 limb
+       and     cy2, w
+       add     w, e1l
+       adc     $0, e1h
+
+       mov     -8(yp1,yp2), w  C (e2h:e2l) += cy2 * next yp2 limb
+       and     cy2, w
+       add     w, e2l
+       adc     $0, e2h
+
+       add     $2, n
+       lea     -16(yp1), yp1
+       jnz     L(top)
 L(end):
 
        mov     e1l, (ep)
index 2ad4e74574c35fe66528c103cbf93e503202480d..bb6d0c53662e6db0d8f1d852950ad507c3844abf 100644 (file)
@@ -5,19 +5,30 @@ dnl  Contributed by David Harvey.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 95e18c8ed455e55b65775ea42bb5cb00f517d2b0..8941f7a17b9b87801226d3aa8bba074f78711725 100644 (file)
@@ -1,32 +1,45 @@
 dnl  AMD64 mpn_add_n, mpn_sub_n
 
-dnl  Copyright 2003, 2004, 2005, 2007, 2008, 2010, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2003-2005, 2007, 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
 C AMD K8,K9     1.5
 C AMD K10       1.5
-C Intel P4      ?
+C AMD bd1       1.8
+C AMD bobcat    2.5
+C Intel P4
 C Intel core2   4.9
 C Intel NHM     5.5
-C Intel SBR     1.59
+C Intel SBR     1.61
+C Intel IBR     1.61
 C Intel atom    4
 C VIA nano      3.25
 
@@ -38,7 +51,7 @@ 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    (only for mpn_add_nc)
+define(`cy',   `%r8')  C rsp+40    (mpn_add_nc and mpn_sub_nc)
 
 ifdef(`OPERATION_add_n', `
        define(ADCSBB,        adc)
diff --git a/mpn/x86_64/aorscnd_n.asm b/mpn/x86_64/aorscnd_n.asm
deleted file mode 100644 (file)
index 43c0171..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-dnl  AMD64 mpn_addcnd_n, mpn_subcnd_n
-
-dnl  Copyright 2011, 2012 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 AMD K8,K9     2.25
-C AMD K10       2
-C AMD bd1       3.55
-C AMD bobcat    2.5
-C Intel P4     13
-C Intel core2   2.9
-C Intel NHM     2.9
-C Intel SBR     2.4
-C Intel atom    6.5
-C VIA nano      3
-
-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 wheather it
-C    actually reads both source operands and writes the register for a false
-C    condition, we cannot use it.
-C  * Two cases could be optimised: (1) addcnd_n could use ADCSBB-from-memory
-C    to save one insn/limb, and (2) when up=rp addcnd_n and subcnd_n could use
-C    ADCSBB-to-memory, again saving 1 insn/limb.
-C  * This runs optimally at decoder bandwidth on K10.  It has not been tuned
-C    for any other processor.
-
-C INPUT PARAMETERS
-define(`rp',   `%rdi')
-define(`up',   `%rsi')
-define(`vp',   `%rdx')
-define(`n',    `%rcx')
-define(`cnd',  `%r8')
-
-ifdef(`OPERATION_addcnd_n', `
-       define(ADDSUB,        add)
-       define(ADCSBB,        adc)
-       define(func,          mpn_addcnd_n)')
-ifdef(`OPERATION_subcnd_n', `
-       define(ADDSUB,        sub)
-       define(ADCSBB,        sbb)
-       define(func,          mpn_subcnd_n)')
-
-MULFUNC_PROLOGUE(mpn_addcnd_n mpn_subcnd_n)
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
-       TEXT
-       ALIGN(16)
-PROLOGUE(func)
-       FUNC_ENTRY(4)
-IFDOS(`        mov     56(%rsp), %r8   ')
-       push    %rbx
-       push    %rbp
-       push    %r12
-       push    %r13
-       push    %r14
-
-       neg     cnd
-       sbb     cnd, cnd                C make cnd mask
-
-       lea     (vp,n,8), vp
-       lea     (up,n,8), up
-       lea     (rp,n,8), rp
-
-       mov     R32(n), R32(%rax)
-       neg     n
-       and     $3, R32(%rax)
-       jz      L(top)                  C carry-save reg rax = 0 in this arc
-       cmp     $2, R32(%rax)
-       jc      L(b1)
-       jz      L(b2)
-
-L(b3): mov     (vp,n,8), %r12
-       mov     8(vp,n,8), %r13
-       mov     16(vp,n,8), %r14
-       mov     (up,n,8), %r10
-       mov     8(up,n,8), %rbx
-       mov     16(up,n,8), %rbp
-       and     cnd, %r12
-       and     cnd, %r13
-       and     cnd, %r14
-       ADDSUB  %r12, %r10
-       ADCSBB  %r13, %rbx
-       ADCSBB  %r14, %rbp
-       sbb     R32(%rax), R32(%rax)    C save carry
-       mov     %r10, (rp,n,8)
-       mov     %rbx, 8(rp,n,8)
-       mov     %rbp, 16(rp,n,8)
-       add     $3, n
-       js      L(top)
-       jmp     L(end)
-
-L(b2): mov     (vp,n,8), %r12
-       mov     8(vp,n,8), %r13
-       mov     (up,n,8), %r10
-       mov     8(up,n,8), %rbx
-       and     cnd, %r12
-       and     cnd, %r13
-       ADDSUB  %r12, %r10
-       ADCSBB  %r13, %rbx
-       sbb     R32(%rax), R32(%rax)    C save carry
-       mov     %r10, (rp,n,8)
-       mov     %rbx, 8(rp,n,8)
-       add     $2, n
-       js      L(top)
-       jmp     L(end)
-
-L(b1): mov     (vp,n,8), %r12
-       mov     (up,n,8), %r10
-       and     cnd, %r12
-       ADDSUB  %r12, %r10
-       sbb     R32(%rax), R32(%rax)    C save carry
-       mov     %r10, (rp,n,8)
-       add     $1, n
-       jns     L(end)
-
-       ALIGN(16)
-L(top):        mov     (vp,n,8), %r12
-       mov     8(vp,n,8), %r13
-       mov     16(vp,n,8), %r14
-       mov     24(vp,n,8), %r11
-       mov     (up,n,8), %r10
-       mov     8(up,n,8), %rbx
-       mov     16(up,n,8), %rbp
-       mov     24(up,n,8), %r9
-       and     cnd, %r12
-       and     cnd, %r13
-       and     cnd, %r14
-       and     cnd, %r11
-       add     R32(%rax), R32(%rax)    C restore carry
-       ADCSBB  %r12, %r10
-       ADCSBB  %r13, %rbx
-       ADCSBB  %r14, %rbp
-       ADCSBB  %r11, %r9
-       sbb     R32(%rax), R32(%rax)    C save carry
-       mov     %r10, (rp,n,8)
-       mov     %rbx, 8(rp,n,8)
-       mov     %rbp, 16(rp,n,8)
-       mov     %r9, 24(rp,n,8)
-       add     $4, n
-       js      L(top)
-
-L(end):        neg     R32(%rax)
-       pop     %r14
-       pop     %r13
-       pop     %r12
-       pop     %rbp
-       pop     %rbx
-       FUNC_EXIT()
-       ret
-EPILOGUE()
index 08ae46c7fbdbb1a5f82c8e4d299d26a6d48757f9..e3fc005757f328bdf6d4b317d5d06924eb9701f3 100644 (file)
@@ -1,22 +1,32 @@
 dnl  AMD64 mpn_addmul_1 and mpn_submul_1.
 
-dnl  Copyright 2003, 2004, 2005, 2007, 2008, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2003-2005, 2007, 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/atom/addmul_2.asm b/mpn/x86_64/atom/addmul_2.asm
new file mode 100644 (file)
index 0000000..c1dcdc4
--- /dev/null
@@ -0,0 +1,186 @@
+dnl  AMD64 mpn_addmul_2 optimised for Intel Atom.
+
+dnl  Copyright 2008, 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')
+
+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   18.8            this
+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(`v0', `%r8')
+define(`v1', `%r9')
+define(`w0', `%rbx')
+define(`w1', `%rcx')
+define(`w2', `%rbp')
+define(`w3', `%r10')
+define(`n',  `%r11')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_addmul_2)
+       FUNC_ENTRY(4)
+       push    %rbx
+       push    %rbp
+
+       mov     (up), %rax
+
+       mov     (vp), v0
+       mov     8(vp), v1
+
+       mov     n_param, n
+       mul     v0
+
+       test    $1, R8(n)
+       jnz     L(bx1)
+
+L(bx0):        test    $2, R8(n)
+       jnz     L(b10)
+
+L(b00):        mov     %rax, w0
+       mov     (up), %rax
+       mov     %rdx, w1
+       xor     R32(w2), R32(w2)
+       lea     -8(rp), rp
+       jmp     L(lo0)
+
+L(b10):        mov     %rax, w2
+       mov     (up), %rax
+       mov     %rdx, w3
+       xor     R32(w0), R32(w0)
+       lea     -16(up), up
+       lea     -24(rp), rp
+       jmp     L(lo2)
+
+L(bx1):        test    $2, R8(n)
+       jnz     L(b11)
+
+L(b01):        mov     %rax, w3
+       mov     %rdx, w0
+       mov     (up), %rax
+       xor     R32(w1), R32(w1)
+       lea     8(up), up
+       dec     n
+       jmp     L(lo1)
+
+L(b11):        mov     %rax, w1
+       mov     (up), %rax
+       mov     %rdx, w2
+       xor     R32(w3), R32(w3)
+       lea     -8(up), up
+       lea     -16(rp), rp
+       jmp     L(lo3)
+
+       ALIGN(16)
+L(top):
+L(lo1):        mul     v1
+       add     w3, (rp)
+       mov     $0, R32(w2)
+       adc     %rax, w0
+       mov     (up), %rax
+       adc     %rdx, w1
+       mul     v0
+       add     %rax, w0
+       mov     (up), %rax
+       adc     %rdx, w1
+       adc     $0, R32(w2)
+L(lo0):        mul     v1
+       add     w0, 8(rp)
+       adc     %rax, w1
+       mov     8(up), %rax
+       mov     $0, R32(w3)
+       adc     %rdx, w2
+       mul     v0
+       add     %rax, w1
+       mov     8(up), %rax
+       adc     %rdx, w2
+       adc     $0, R32(w3)
+L(lo3):        mul     v1
+       add     w1, 16(rp)
+       adc     %rax, w2
+       mov     16(up), %rax
+       mov     $0, R32(w0)
+       adc     %rdx, w3
+       mul     v0
+       add     %rax, w2
+       mov     16(up), %rax
+       adc     %rdx, w3
+       adc     $0, R32(w0)
+L(lo2):        mul     v1
+       add     w2, 24(rp)
+       adc     %rax, w3
+       mov     24(up), %rax
+       adc     %rdx, w0
+       mov     $0, R32(w1)
+       lea     32(rp), rp
+       mul     v0
+       lea     32(up), up
+       add     %rax, w3
+       adc     %rdx, w0
+       mov     -8(up), %rax
+       adc     $0, R32(w1)
+       sub     $4, n
+       ja      L(top)
+
+L(end):        mul     v1
+       add     w3, (rp)
+       adc     %rax, w0
+       adc     %rdx, w1
+       mov     w0, 8(rp)
+       mov     w1, %rax
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
index 5eee990a261e53ece8c484107c5f714e23f47549..f44de19fefcd9391b11ee8e16657d6ce7be74cb2 100644 (file)
@@ -1,25 +1,35 @@
-dnl  AMD64 mpn_addlsh1_n -- rp[] = up[] + (vp[] << 1)
-dnl  AMD64 mpn_rsblsh1_n -- rp[] = (vp[] << 1) - up[]
-dnl  Optimised for Intel Atom.
+dnl  AMD64 mpn_addlsh1_n, mpn_rsblsh1_n optimised for Intel Atom.
+dnl  Used also for AMD bd1.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
 dnl  Copyright 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -30,6 +40,8 @@ C  * sublsh1_n.asm and this file use the same basic pattern.
 C           cycles/limb
 C AMD K8,K9     ?
 C AMD K10       ?
+C AMD bd1       2.3
+C AMD bobcat    ?
 C Intel P4      ?
 C Intel core2   ?
 C Intel NHM     ?
index 091ffb817a4cbd315721dadb64734d27eeb2e315..02fb29dd74f37c0f436a92a854e1829ed5aba3b2 100644 (file)
@@ -7,19 +7,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund.
 dnl  Copyright 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index f13f97632b0d439c5f9570a76c6607bab97aa748..2c0b7b31a88d3fbaa24d39161eb60af81ecc96fc 100644 (file)
@@ -1,22 +1,32 @@
 dnl  X86-64 mpn_add_n, mpn_sub_n, optimized for Intel Atom.
 
-dnl  Copyright 2003, 2004, 2005, 2007, 2008, 2010, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2003-2005, 2007, 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/atom/aorsmul_1.asm b/mpn/x86_64/atom/aorsmul_1.asm
new file mode 100644 (file)
index 0000000..e953153
--- /dev/null
@@ -0,0 +1,190 @@
+dnl  AMD64 mpn_addmul_1/mpn_submul_1 optimised for Intel Atom.
+
+dnl  Copyright 2003-2005, 2007, 2008, 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')
+
+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 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(`v0',      `%rcx')   C r9
+
+define(`n',       `%rbx')
+
+ifdef(`OPERATION_addmul_1',`
+  define(`ADDSUB', `add')
+  define(`func',   `mpn_addmul_1')
+')
+ifdef(`OPERATION_submul_1',`
+  define(`ADDSUB', `sub')
+  define(`func',   `mpn_submul_1')
+')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(func)
+       FUNC_ENTRY(4)
+       push    %rbx
+
+       mov     (up), %rax
+       lea     -8(up,n_param,8), up
+       lea     -16(rp,n_param,8), rp
+
+       test    $1, R8(n_param)
+       jnz     L(bx1)
+
+L(bx0):        test    $2, R8(n_param)
+       jnz     L(b10)
+
+L(b00):        mov     $1, R32(n)
+       sub     n_param, n
+       mul     v0
+       mov     %rax, %r11
+       mov     8(up,n,8), %rax
+       mov     %rdx, %r10
+       mul     v0
+       mov     %rax, %r8
+       mov     16(up,n,8), %rax
+       jmp     L(lo0)
+
+L(b10):        mov     $3, R32(n)
+       sub     n_param, n
+       mul     v0
+       mov     %rax, %r11
+       mov     -8(up,n,8), %rax
+       mov     %rdx, %r10
+       mul     v0
+       test    n, n
+       jns     L(cj2)
+       mov     %rax, %r8
+       mov     (up,n,8), %rax
+       mov     %rdx, %r9
+       jmp     L(lo2)
+
+L(bx1):        test    $2, R8(n_param)
+       jnz     L(b11)
+
+L(b01):        mov     $2, R32(n)
+       sub     n_param, n
+       mul     v0
+       test    n, n
+       jns     L(cj1)
+       mov     %rax, %r8
+       mov     (up,n,8), %rax
+       mov     %rdx, %r9
+       mul     v0
+       mov     %rax, %r11
+       mov     8(up,n,8), %rax
+       mov     %rdx, %r10
+       jmp     L(lo1)
+
+L(b11):        xor     R32(n), R32(n)
+       sub     n_param, n
+       mul     v0
+       mov     %rax, %r8
+       mov     16(up,n,8), %rax
+       mov     %rdx, %r9
+       mul     v0
+       mov     %rax, %r11
+       mov     24(up,n,8), %rax
+       jmp     L(lo3)
+
+       ALIGN(16)
+L(top):        mul     v0
+       ADDSUB  %r8, -16(rp,n,8)
+       mov     %rax, %r8
+       mov     (up,n,8), %rax
+       adc     %r9, %r11
+       mov     %rdx, %r9
+       adc     $0, %r10
+L(lo2):        mul     v0
+       ADDSUB  %r11, -8(rp,n,8)
+       mov     %rax, %r11
+       mov     8(up,n,8), %rax
+       adc     %r10, %r8
+       mov     %rdx, %r10
+       adc     $0, %r9
+L(lo1):        mul     v0
+       ADDSUB  %r8, (rp,n,8)
+       mov     %rax, %r8
+       adc     %r9, %r11
+       mov     16(up,n,8), %rax
+       adc     $0, %r10
+L(lo0):        mov     %rdx, %r9
+       mul     v0
+       ADDSUB  %r11, 8(rp,n,8)
+       mov     %rax, %r11
+       adc     %r10, %r8
+       mov     24(up,n,8), %rax
+       adc     $0, %r9
+L(lo3):        add     $4, n
+       mov     %rdx, %r10
+       js      L(top)
+
+L(end):        mul     v0
+       ADDSUB  %r8, -16(rp,n,8)
+       adc     %r9, %r11
+       adc     $0, %r10
+L(cj2):        ADDSUB  %r11, -8(rp,n,8)
+       adc     %r10, %rax
+       adc     $0, %rdx
+L(cj1):        ADDSUB  %rax, (rp,n,8)
+       mov     $0, R32(%rax)
+       adc     %rdx, %rax
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
+ASM_END()
diff --git a/mpn/x86_64/atom/com.asm b/mpn/x86_64/atom/com.asm
new file mode 100644 (file)
index 0000000..6b6460f
--- /dev/null
@@ -0,0 +1,37 @@
+dnl  X86-64 mpn_com optimised for Intel Atom.
+
+dnl  Copyright 2012, 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')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_com)
+include_mpn(`x86_64/fastsse/com-palignr.asm')
index 6c6e9db79a6a5c80d1c7f95923a44b2d34853317..e3092794c0eedab7d0d10273ef1ea273e285a2b0 100644 (file)
@@ -1,21 +1,32 @@
-dnl  X86-64 mpn_copyd optimised for Intel Sandy Bridge.
+dnl  X86-64 mpn_copyd optimised for Intel Atom.
 
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 47144498cc41853f43843c0679d51406688b3ca5..00ec3c23c664dceda5fe5318b49bd45bfd112d4e 100644 (file)
@@ -1,21 +1,32 @@
-dnl  X86-64 mpn_copyi optimised for Intel Sandy Bridge.
+dnl  X86-64 mpn_copyi optimised for Intel Atom.
 
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 543d1a28f2d9a6b69919360e99e3627f5d378bfe..d9ba5fe6f022c31101e47536fd014fe4d0ee6d42 100644 (file)
@@ -3,19 +3,30 @@ dnl  AMD64 mpn_divexact_1 -- mpn by limb exact division.
 dnl  Copyright 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 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  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
+dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index bc19a095c70d2c493c38a6b44c7e93944624937b..6816dfc362895c49d68638d9c8727aa5dd0fbd3f 100644 (file)
 /* Intel Atom/64 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2010, 2012, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 #define SHLD_SLOW 1
 #define SHRD_SLOW 1
 
-/* These routines exists for all x86_64 chips, but they are slower on Atom
-   than separate add/sub and shift.  Make sure they are not really used.  */
-#undef HAVE_NATIVE_mpn_rsh1add_n
-#undef HAVE_NATIVE_mpn_rsh1sub_n
+/* 1667 MHz Pineview (Atom D510) */
+/* FFT tuning limit = 25000000 */
+/* Generated by tuneup.c, 2014-03-13, 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_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     MP_SIZE_T_MAX
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD         0
-#define PREINV_MOD_1_TO_MOD_1_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_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           15
 
-#define MUL_TOOM22_THRESHOLD                10
-#define MUL_TOOM33_THRESHOLD                66
+#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_TOOM8H_THRESHOLD               212
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD      65
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     131
+#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      78
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD      88
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD      80
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD      58
 
-#define SQR_BASECASE_THRESHOLD               0  /* always (native) */
-#define SQR_TOOM2_THRESHOLD                 16
-#define SQR_TOOM3_THRESHOLD                 65
-#define SQR_TOOM4_THRESHOLD                166
-#define SQR_TOOM6_THRESHOLD                222
-#define SQR_TOOM8_THRESHOLD                333
+#define SQR_BASECASE_THRESHOLD               6
+#define SQR_TOOM2_THRESHOLD                 23
+#define SQR_TOOM3_THRESHOLD                 49
+#define SQR_TOOM4_THRESHOLD                130
+#define SQR_TOOM6_THRESHOLD                173
+#define SQR_TOOM8_THRESHOLD                238
 
-#define MULMID_TOOM42_THRESHOLD             14
+#define MULMID_TOOM42_THRESHOLD             16
 
-#define MULMOD_BNM1_THRESHOLD                7
-#define SQRMOD_BNM1_THRESHOLD               10
+#define MULMOD_BNM1_THRESHOLD               10
+#define SQRMOD_BNM1_THRESHOLD               12
 
-#define MUL_FFT_MODF_THRESHOLD             212  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             252  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    220, 5}, {      7, 4}, {     15, 5}, {     13, 6}, \
+  { {    252, 5}, {     11, 6}, {      6, 5}, {     13, 6}, \
     {      7, 5}, {     15, 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}, \
-    {     15, 7}, {     31, 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}, {     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,10}, {     71, 9}, {    143,10}, \
-    {     79, 9}, {    159,11}, {     47,10}, {     95, 9}, \
-    {    191, 8}, {    383,12}, {     31,11}, {     63, 9}, \
-    {    255,10}, {    143, 9}, {    287,11}, {     79,10}, \
+    {     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}, {     15, 7}, {     31, 8}, \
+    {     19, 9}, {     11, 8}, {     25, 9}, {     15, 8}, \
+    {     33, 9}, {     19, 8}, {     39, 9}, {     23,10}, \
+    {     15, 9}, {     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,10}, {     79,11}, {     47,10}, {     95,12}, \
+    {     31,11}, {     63,10}, {    127, 9}, {    255, 8}, \
+    {    511, 9}, {    287, 8}, {    575,11}, {     79,10}, \
     {    159, 9}, {    319,10}, {    175, 9}, {    351, 8}, \
-    {    703,11}, {     95,10}, {    191, 9}, {    383,10}, \
-    {    207, 9}, {    415,11}, {    111,10}, {    223, 9}, \
-    {    447,12}, {     63,11}, {    127,10}, {    255, 9}, \
-    {    511,11}, {    143, 9}, {    575,10}, {    319,11}, \
-    {    175,10}, {    351, 9}, {    703,11}, {    191,10}, \
-    {    383,11}, {    223,13}, {   8192,14}, {  16384,15}, \
+    {    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, 8}, {   1151,10}, \
+    {    319, 9}, {    639,11}, {    175,10}, {    351, 9}, \
+    {    703, 8}, {   1407, 7}, {   2815,10}, {    383,11}, \
+    {    207,10}, {    415,11}, {    223,10}, {    447,13}, \
+    {     63,12}, {    127,11}, {    255,10}, {    511,11}, \
+    {    287,10}, {    575, 9}, {   1151,12}, {    159,11}, \
+    {    319,10}, {    639,11}, {    351,10}, {    703, 9}, \
+    {   1407,12}, {    191,11}, {    415,12}, {    223,11}, \
+    {    447,10}, {    895,11}, {    479,13}, {    127,12}, \
+    {    255,11}, {    511,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,12}, {    447,11}, \
+    {    895,12}, {    479,14}, {    127,13}, {    255,12}, \
+    {    511,11}, {   1023,12}, {    575,11}, {   1151,13}, \
+    {    319,12}, {    703,11}, {   1407,13}, {    383,12}, \
+    {    831,13}, {    447,12}, {    895,11}, {   1791,14}, \
+    {    255,13}, {    511,12}, {   1023,13}, {    575,12}, \
+    {   1151,13}, {    703,12}, {   1407,14}, {    383,13}, \
+    {    831,12}, {   1663,13}, {    895,12}, {   1791,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,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 101
-#define MUL_FFT_THRESHOLD                 2112
+#define MUL_FFT_TABLE3_SIZE 185
+#define MUL_FFT_THRESHOLD                 2240
 
-#define SQR_FFT_MODF_THRESHOLD             184  /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD             208  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    188, 5}, {      6, 4}, {     13, 5}, {      7, 4}, \
-    {     15, 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}, {     33, 9}, \
-    {     19, 8}, {     39, 9}, {     23,10}, {     15, 9}, \
-    {     39,10}, {     23, 9}, {     47,11}, {     15,10}, \
-    {     31, 9}, {     67,10}, {     39, 9}, {     79,10}, \
-    {     47, 7}, {    383, 9}, {    103,11}, {     31,10}, \
-    {     63, 9}, {    127, 8}, {    255, 7}, {    511, 8}, \
-    {    287, 7}, {    575,10}, {     79, 9}, {    159, 8}, \
-    {    319,11}, {     47, 9}, {    191,12}, {     31,11}, \
-    {     63,10}, {    127, 9}, {    255,10}, {    143, 7}, \
-    {   1151, 9}, {    351,11}, {     95,10}, {    191,11}, \
-    {    111,10}, {    223,12}, {     63, 9}, {    511,11}, \
+  { {    208, 5}, {     11, 6}, {      6, 5}, {     13, 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}, {     23,10}, {      7, 9}, \
+    {     15, 8}, {     31, 9}, {     23,10}, {     15, 9}, \
+    {     39,10}, {     23,11}, {     15,10}, {     31, 9}, \
+    {     63, 8}, {    127,10}, {     39, 9}, {     79, 8}, \
+    {    159,10}, {     47, 8}, {    191,10}, {     55,11}, \
+    {     31,10}, {     63, 9}, {    127, 8}, {    255,10}, \
+    {     71, 9}, {    143, 8}, {    287, 7}, {    575,10}, \
+    {     79, 9}, {    159,11}, {     47, 9}, {    191,12}, \
+    {     31,11}, {     63,10}, {    127, 9}, {    255, 8}, \
+    {    511,10}, {    143, 9}, {    287, 8}, {    575,10}, \
+    {    159, 9}, {    319, 8}, {    639,10}, {    175, 9}, \
+    {    351, 8}, {    703,10}, {    191, 9}, {    383,10}, \
+    {    207,11}, {    111,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,11}, \
-    {    207,10}, {    415,11}, {    223,10}, {    447,13}, \
-    {   8192,14}, {  16384,15}, {  32768,16}, {  65536,17}, \
+    {    703,11}, {    191,10}, {    383,11}, {    207,10}, \
+    {    415,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}, {    383,10}, \
+    {    767,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}, {    383,11}, \
+    {    767,12}, {    415,11}, {    831,12}, {    447,11}, \
+    {    895,14}, {    127,13}, {    255,12}, {    511,11}, \
+    {   1023,12}, {    575,11}, {   1151,13}, {    319,12}, \
+    {    703,11}, {   1407,13}, {    383,12}, {    831,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}, \
+    {   1791,12}, {   3583,15}, {    511,14}, {   1023,13}, \
+    {   2047,14}, {   1151,13}, {   2431,12}, {   4863,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 95
+#define SQR_FFT_TABLE3_SIZE 175
 #define SQR_FFT_THRESHOLD                 1600
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
-#define MULLO_DC_THRESHOLD                  33
-#define MULLO_MUL_N_THRESHOLD             4141
-
-#define DC_DIV_QR_THRESHOLD                 27
-#define DC_DIVAPPR_Q_THRESHOLD              94
-#define DC_BDIV_QR_THRESHOLD                27
-#define DC_BDIV_Q_THRESHOLD                 54
-
-#define INV_MULMOD_BNM1_THRESHOLD           18
-#define INV_NEWTON_THRESHOLD               131
-#define INV_APPR_THRESHOLD                 106
-
-#define BINV_NEWTON_THRESHOLD              165
-#define REDC_1_TO_REDC_2_THRESHOLD          14
-#define REDC_2_TO_REDC_N_THRESHOLD          36
-
-#define MU_DIV_QR_THRESHOLD                792
-#define MU_DIVAPPR_Q_THRESHOLD             807
-#define MUPI_DIV_QR_THRESHOLD               67
-#define MU_BDIV_QR_THRESHOLD               654
-#define MU_BDIV_Q_THRESHOLD                748
-
-#define POWM_SEC_TABLE  4,32,204,724,1926
-
-#define MATRIX22_STRASSEN_THRESHOLD         15
-#define HGCD_THRESHOLD                      84
-#define HGCD_APPR_THRESHOLD                 87
-#define HGCD_REDUCE_THRESHOLD             1182
-#define GCD_DC_THRESHOLD                   195
-#define GCDEXT_DC_THRESHOLD                180
-#define JACOBI_BASE_METHOD                   2
-
-#define GET_STR_DC_THRESHOLD                18
-#define GET_STR_PRECOMPUTE_THRESHOLD        32
-#define SET_STR_DC_THRESHOLD               256
-#define SET_STR_PRECOMPUTE_THRESHOLD      1151
+#define MULLO_DC_THRESHOLD                  34
+#define MULLO_MUL_N_THRESHOLD             4392
+
+#define DC_DIV_QR_THRESHOLD                 32
+#define DC_DIVAPPR_Q_THRESHOLD             122
+#define DC_BDIV_QR_THRESHOLD                35
+#define DC_BDIV_Q_THRESHOLD                 76
+
+#define INV_MULMOD_BNM1_THRESHOLD           22
+#define INV_NEWTON_THRESHOLD               163
+#define INV_APPR_THRESHOLD                 134
+
+#define BINV_NEWTON_THRESHOLD              179
+#define REDC_1_TO_REDC_2_THRESHOLD          17
+#define REDC_2_TO_REDC_N_THRESHOLD          43
+
+#define MU_DIV_QR_THRESHOLD                855
+#define MU_DIVAPPR_Q_THRESHOLD             872
+#define MUPI_DIV_QR_THRESHOLD               83
+#define MU_BDIV_QR_THRESHOLD               748
+#define MU_BDIV_Q_THRESHOLD                807
+
+#define POWM_SEC_TABLE  1,16,114,452,1603
+
+#define MATRIX22_STRASSEN_THRESHOLD         13
+#define HGCD_THRESHOLD                     102
+#define HGCD_APPR_THRESHOLD                 95
+#define HGCD_REDUCE_THRESHOLD             1329
+#define GCD_DC_THRESHOLD                   268
+#define GCDEXT_DC_THRESHOLD                221
+#define JACOBI_BASE_METHOD                   4
+
+#define GET_STR_DC_THRESHOLD                14
+#define GET_STR_PRECOMPUTE_THRESHOLD        26
+#define SET_STR_DC_THRESHOLD               418
+#define SET_STR_PRECOMPUTE_THRESHOLD      1420
 
 #define FAC_DSC_THRESHOLD                 1065
 #define FAC_ODD_THRESHOLD                    0  /* always */
index f62d6ce41e99a6b156d63459f577dab6bb3ac689..1b37d5dccf950705ccd9d192f1a7625be6ac0a96 100644 (file)
@@ -5,19 +5,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund.
 dnl  Copyright 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index f566835b210d50dbc2bbdcb0d7a1d7f2b0d0bf3f..7385f8fd44478d19265e684db10751b268bb7927 100644 (file)
@@ -5,19 +5,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund.
 dnl  Copyright 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/atom/mul_1.asm b/mpn/x86_64/atom/mul_1.asm
new file mode 100644 (file)
index 0000000..d76a3d3
--- /dev/null
@@ -0,0 +1,143 @@
+dnl  AMD64 mpn_mul_1 optimised for Intel Atom.
+
+dnl  Copyright 2003-2005, 2007, 2008, 2012, 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        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 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(`v0',      `%rcx')   C r9
+
+define(`n',       `%r11')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_mul_1)
+       FUNC_ENTRY(4)
+       xor     %r8, %r8
+L(com):        mov     (up), %rax
+       lea     -16(up,n_param,8), up
+       lea     -8(rp,n_param,8), rp
+       test    $1, R8(n_param)
+       jnz     L(bx1)
+
+L(bx0):        mov     %r8, %r9
+       test    $2, R8(n_param)
+       jnz     L(b10)
+
+L(b00):        mov     $2, R32(n)
+       sub     n_param, n
+       jmp     L(lo0)
+
+L(bx1):        test    $2, R8(n_param)
+       jnz     L(b11)
+
+L(b01):        mov     $3, R32(n)
+       sub     n_param, n
+       mul     v0
+       cmp     $2, n
+       jnz     L(lo1)
+       jmp     L(cj1)
+
+L(b11):        mov     $1, R32(n)
+       sub     n_param, n
+       jmp     L(lo3)
+
+L(b10):        xor     R32(n), R32(n)
+       sub     n_param, n
+       jmp     L(lo2)
+
+L(top):        mul     v0
+       mov     %r9, -24(rp,n,8)
+L(lo1):        xor     %r9d, %r9d
+       add     %rax, %r8
+       mov     (up,n,8), %rax
+       adc     %rdx, %r9
+       mov     %r8, -16(rp,n,8)
+L(lo0):        xor     %r8d, %r8d
+       mul     v0
+       add     %rax, %r9
+       mov     8(up,n,8), %rax
+       adc     %rdx, %r8
+       mov     %r9, -8(rp,n,8)
+L(lo3):        xor     %r9d, %r9d
+       mul     v0
+       add     %rax, %r8
+       mov     16(up,n,8), %rax
+       adc     %rdx, %r9
+       mov     %r8, (rp,n,8)
+L(lo2):        xor     %r8d, %r8d
+       mul     v0
+       add     %rax, %r9
+       mov     24(up,n,8), %rax
+       adc     %rdx, %r8
+       add     $4, n
+       js      L(top)
+
+L(end):        mul     v0
+       mov     %r9, -8(rp)
+L(cj1):        add     %rax, %r8
+       mov     $0, R32(%rax)
+       adc     %rdx, %rax
+       mov     %r8, (rp)
+       FUNC_EXIT()
+       ret
+EPILOGUE()
+
+PROLOGUE(mpn_mul_1c)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8   ')
+       jmp     L(com)
+EPILOGUE()
+ASM_END()
diff --git a/mpn/x86_64/atom/mul_2.asm b/mpn/x86_64/atom/mul_2.asm
new file mode 100644 (file)
index 0000000..f3fc3af
--- /dev/null
@@ -0,0 +1,186 @@
+dnl  AMD64 mpn_mul_2 optimised for Intel Atom.
+
+dnl  Copyright 2008, 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')
+
+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 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(`v0', `%r8')
+define(`v1', `%r9')
+define(`w0', `%rbx')
+define(`w1', `%rcx')
+define(`w2', `%rbp')
+define(`w3', `%r10')
+define(`n',  `%r11')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_mul_2)
+       FUNC_ENTRY(4)
+       push    %rbx
+       push    %rbp
+
+       mov     (up), %rax
+
+       mov     (vp), v0
+       mov     8(vp), v1
+
+       mov     n_param, n
+       mul     v0
+
+       test    $1, R8(n)
+       jnz     L(bx1)
+
+L(bx0):        test    $2, R8(n)
+       jnz     L(b10)
+
+L(b00):        mov     %rax, w0
+       mov     (up), %rax
+       mov     %rdx, w1
+       xor     R32(w2), R32(w2)
+       lea     -8(rp), rp
+       jmp     L(lo0)
+
+L(b10):        mov     %rax, w2
+       mov     (up), %rax
+       mov     %rdx, w3
+       xor     R32(w0), R32(w0)
+       lea     -16(up), up
+       lea     -24(rp), rp
+       jmp     L(lo2)
+
+L(bx1):        test    $2, R8(n)
+       jnz     L(b11)
+
+L(b01):        mov     %rax, w3
+       mov     %rdx, w0
+       mov     (up), %rax
+       xor     R32(w1), R32(w1)
+       lea     8(up), up
+       dec     n
+       jmp     L(lo1)
+
+L(b11):        mov     %rax, w1
+       mov     (up), %rax
+       mov     %rdx, w2
+       xor     R32(w3), R32(w3)
+       lea     -8(up), up
+       lea     -16(rp), rp
+       jmp     L(lo3)
+
+       ALIGN(16)
+L(top):
+L(lo1):        mul     v1
+       add     %rax, w0
+       mov     (up), %rax
+       mov     $0, R32(w2)
+       mov     w3, (rp)
+       adc     %rdx, w1
+       mul     v0
+       add     %rax, w0
+       mov     (up), %rax
+       adc     %rdx, w1
+       adc     $0, R32(w2)
+L(lo0):        mul     v1
+       add     %rax, w1
+       mov     8(up), %rax
+       mov     w0, 8(rp)
+       adc     %rdx, w2
+       mul     v0
+       add     %rax, w1
+       mov     8(up), %rax
+       adc     %rdx, w2
+       mov     $0, R32(w3)
+       adc     $0, R32(w3)
+L(lo3):        mul     v1
+       add     %rax, w2
+       mov     16(up), %rax
+       mov     w1, 16(rp)
+       mov     $0, R32(w0)
+       adc     %rdx, w3
+       mul     v0
+       add     %rax, w2
+       mov     16(up), %rax
+       adc     %rdx, w3
+L(lo2):        mov     $0, R32(w1)
+       mov     w2, 24(rp)
+       adc     $0, R32(w0)
+       mul     v1
+       add     %rax, w3
+       mov     24(up), %rax
+       lea     32(up), up
+       adc     %rdx, w0
+       mul     v0
+       lea     32(rp), rp
+       add     %rax, w3
+       adc     %rdx, w0
+       mov     -8(up), %rax
+       adc     $0, R32(w1)
+       sub     $4, n
+       ja      L(top)
+
+L(end):        mul     v1
+       mov     w3, (rp)
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     w0, 8(rp)
+       mov     w1, %rax
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
index 4753acfb6a7a3d910629994461a14164d56bd07e..fb14dd3d318c2f8cdaf92f41ee0cec8273d56c35 100644 (file)
@@ -3,19 +3,30 @@ dnl  x86-64 mpn_popcount.
 dnl  Copyright 2007, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
diff --git a/mpn/x86_64/atom/redc_1.asm b/mpn/x86_64/atom/redc_1.asm
new file mode 100644 (file)
index 0000000..d93c19f
--- /dev/null
@@ -0,0 +1,574 @@
+dnl  X86-64 mpn_redc_1 optimised for Intel Atom.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2003-2005, 2007, 2008, 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')
+
+C           cycles/limb
+C AMD K8,K9     ?
+C AMD K10       ?
+C AMD bull      ?
+C AMD pile      ?
+C AMD steam     ?
+C AMD bobcat    5.0
+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 VIA nano      ?
+
+C TODO
+C  * Micro-optimise, none performed thus far.
+C  * Consider inlining mpn_add_n.
+C  * Single basecases out before the pushes.
+C  * Make lead-in code for the inner loops be more similar.
+
+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')   C rcx
+define(`up',          `%rsi')   C rdx
+define(`mp_param',    `%rdx')   C r8
+define(`n',           `%rcx')   C r9
+define(`u0inv',       `%r8')    C stack
+
+define(`i',           `%r14')
+define(`j',           `%r15')
+define(`mp',          `%r12')
+define(`q0',          `%r13')
+define(`w0',          `%rbp')
+define(`w1',          `%r9')
+define(`w2',          `%r10')
+define(`w3',          `%r11')
+
+C rax rbx rcx rdx rdi rsi rbp r8 r9 r10 r11 r12 r13 r14 r15
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+define(`ALIGNx', `ALIGN(16)')
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_redc_1)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8   ')
+       push    %rbx
+       push    %rbp
+       push    %r12
+       push    %r13
+       push    %r14
+       push    %r15
+
+       mov     (up), q0
+       mov     n, j                    C outer loop induction var
+       lea     (mp_param,n,8), mp
+       lea     (up,n,8), up
+       neg     n
+       imul    u0inv, q0               C first iteration q0
+
+       test    $1, R8(n)
+       jz      L(bx0)
+
+L(bx1):        test    $2, R8(n)
+       jz      L(b3)
+
+L(b1): cmp     $-1, R32(n)
+       jz      L(n1)
+
+L(otp1):lea    1(n), i
+       mov     (mp,n,8), %rax
+       mul     q0
+       mov     %rax, %rbp
+       mov     8(mp,n,8), %rax
+       mov     %rdx, %r9
+       mul     q0
+       mov     %rax, %rbx
+       mov     16(mp,n,8), %rax
+       mov     %rdx, %r10
+       mul     q0
+       add     (up,n,8), %rbp
+       mov     %rax, %rbp
+       adc     %r9, %rbx
+       mov     24(mp,n,8), %rax
+       adc     $0, %r10
+       mov     %rdx, %r9
+       mul     q0
+       add     8(up,n,8), %rbx
+       mov     %rbx, 8(up,n,8)
+       mov     %rax, %r11
+       adc     %r10, %rbp
+       mov     32(mp,n,8), %rax
+       adc     $0, %r9
+       imul    u0inv, %rbx             C next q limb
+       jmp     L(e1)
+
+       ALIGNx
+L(tp1):        mul     q0
+       add     %rbp, -24(up,i,8)
+       mov     %rax, %rbp
+       mov     (mp,i,8), %rax
+       adc     %r9, %r11
+       mov     %rdx, %r9
+       adc     $0, %r10
+       mul     q0
+       add     %r11, -16(up,i,8)
+       mov     %rax, %r11
+       mov     8(mp,i,8), %rax
+       adc     %r10, %rbp
+       mov     %rdx, %r10
+       adc     $0, %r9
+       mul     q0
+       add     %rbp, -8(up,i,8)
+       mov     %rax, %rbp
+       adc     %r9, %r11
+       mov     16(mp,i,8), %rax
+       adc     $0, %r10
+       mov     %rdx, %r9
+       mul     q0
+       add     %r11, (up,i,8)
+       mov     %rax, %r11
+       adc     %r10, %rbp
+       mov     24(mp,i,8), %rax
+       adc     $0, %r9
+L(e1): add     $4, i
+       mov     %rdx, %r10
+       js      L(tp1)
+
+L(ed1):        mul     q0
+       add     %rbp, I(-24(up),-24(up,i,8))
+       adc     %r9, %r11
+       adc     $0, %r10
+       add     %r11, I(-16(up),-16(up,i,8))
+       adc     %r10, %rax
+       adc     $0, %rdx
+       add     %rax, I(-8(up),-8(up,i,8))
+       adc     $0, %rdx
+       mov     %rdx, (up,n,8)          C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp1)
+       jmp     L(cj)
+
+L(b3): cmp     $-3, R32(n)
+       jz      L(n3)
+
+L(otp3):lea    3(n), i
+       mov     (mp,n,8), %rax
+       mul     q0
+       mov     %rax, %rbp
+       mov     8(mp,n,8), %rax
+       mov     %rdx, %r9
+       mul     q0
+       mov     %rax, %rbx
+       mov     16(mp,n,8), %rax
+       mov     %rdx, %r10
+       mul     q0
+       add     (up,n,8), %rbp
+       mov     %rax, %rbp
+       mov     24(mp,n,8), %rax
+       adc     %r9, %rbx
+       mov     %rdx, %r9
+       adc     $0, %r10
+       mul     q0
+       add     8(up,n,8), %rbx
+       mov     %rbx, 8(up,n,8)
+       mov     %rax, %r11
+       mov     32(mp,n,8), %rax
+       adc     %r10, %rbp
+       mov     %rdx, %r10
+       adc     $0, %r9
+       imul    u0inv, %rbx             C next q limb
+       jmp     L(e3)
+
+       ALIGNx
+L(tp3):        mul     q0
+       add     %rbp, -24(up,i,8)
+       mov     %rax, %rbp
+       mov     (mp,i,8), %rax
+       adc     %r9, %r11
+       mov     %rdx, %r9
+       adc     $0, %r10
+       mul     q0
+       add     %r11, -16(up,i,8)
+       mov     %rax, %r11
+       mov     8(mp,i,8), %rax
+       adc     %r10, %rbp
+       mov     %rdx, %r10
+       adc     $0, %r9
+L(e3): mul     q0
+       add     %rbp, -8(up,i,8)
+       mov     %rax, %rbp
+       adc     %r9, %r11
+       mov     16(mp,i,8), %rax
+       adc     $0, %r10
+       mov     %rdx, %r9
+       mul     q0
+       add     %r11, (up,i,8)
+       mov     %rax, %r11
+       adc     %r10, %rbp
+       mov     24(mp,i,8), %rax
+       adc     $0, %r9
+       add     $4, i
+       mov     %rdx, %r10
+       js      L(tp3)
+
+L(ed3):        mul     q0
+       add     %rbp, I(-24(up),-24(up,i,8))
+       adc     %r9, %r11
+       adc     $0, %r10
+       add     %r11, I(-16(up),-16(up,i,8))
+       adc     %r10, %rax
+       adc     $0, %rdx
+       add     %rax, I(-8(up),-8(up,i,8))
+       adc     $0, %rdx
+       mov     %rdx, (up,n,8)          C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp3)
+C      jmp     L(cj)
+
+L(cj):
+IFSTD(`        lea     (up,n,8), up            C param 2: up
+       lea     (up,n,8), %rdx          C param 3: up - n
+       neg     R32(n)          ')      C param 4: n
+
+IFDOS(`        lea     (up,n,8), %rdx          C param 2: up
+       lea     (%rdx,n,8), %r8         C param 3: up - n
+       neg     R32(n)
+       mov     n, %r9                  C param 4: n
+       mov     rp, %rcx        ')      C param 1: rp
+
+       CALL(   mpn_add_n)
+
+L(ret):        pop     %r15
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+L(bx0):        test    $2, R8(n)
+       jnz     L(b2)
+
+L(b0): cmp     $-4, R32(n)
+       jz      L(n4)
+
+L(otp0):lea    4(n), i
+       mov     (mp,n,8), %rax
+       mul     q0
+       mov     %rax, %r11
+       mov     8(mp,n,8), %rax
+       mov     %rdx, %r10
+       mul     q0
+       mov     %rax, %rbx
+       mov     16(mp,n,8), %rax
+       mov     %rdx, %r9
+       mul     q0
+       add     (up,n,8), %r11
+       mov     %rax, %r11
+       adc     %r10, %rbx
+       mov     24(mp,n,8), %rax
+       adc     $0, %r9
+       mov     %rdx, %r10
+       mul     q0
+       add     8(up,n,8), %rbx
+       mov     %rbx, 8(up,n,8)
+       mov     %rax, %rbp
+       mov     32(mp,n,8), %rax
+       adc     %r9, %r11
+       mov     %rdx, %r9
+       adc     $0, %r10
+       imul    u0inv, %rbx             C next q limb
+       jmp     L(e0)
+
+       ALIGNx
+L(tp0):        mul     q0
+       add     %rbp, -24(up,i,8)
+       mov     %rax, %rbp
+       mov     (mp,i,8), %rax
+       adc     %r9, %r11
+       mov     %rdx, %r9
+       adc     $0, %r10
+L(e0): mul     q0
+       add     %r11, -16(up,i,8)
+       mov     %rax, %r11
+       mov     8(mp,i,8), %rax
+       adc     %r10, %rbp
+       mov     %rdx, %r10
+       adc     $0, %r9
+       mul     q0
+       add     %rbp, -8(up,i,8)
+       mov     %rax, %rbp
+       adc     %r9, %r11
+       mov     16(mp,i,8), %rax
+       adc     $0, %r10
+       mov     %rdx, %r9
+       mul     q0
+       add     %r11, (up,i,8)
+       mov     %rax, %r11
+       adc     %r10, %rbp
+       mov     24(mp,i,8), %rax
+       adc     $0, %r9
+       add     $4, i
+       mov     %rdx, %r10
+       js      L(tp0)
+
+L(ed0):        mul     q0
+       add     %rbp, I(-24(up),-24(up,i,8))
+       adc     %r9, %r11
+       adc     $0, %r10
+       add     %r11, I(-16(up),-16(up,i,8))
+       adc     %r10, %rax
+       adc     $0, %rdx
+       add     %rax, I(-8(up),-8(up,i,8))
+       adc     $0, %rdx
+       mov     %rdx, (up,n,8)          C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp0)
+       jmp     L(cj)
+
+L(b2): cmp     $-2, R32(n)
+       jz      L(n2)
+
+L(otp2):lea    2(n), i
+       mov     (mp,n,8), %rax
+       mul     q0
+       mov     %rax, %r11
+       mov     8(mp,n,8), %rax
+       mov     %rdx, %r10
+       mul     q0
+       mov     %rax, %rbx
+       mov     16(mp,n,8), %rax
+       mov     %rdx, %r9
+       mul     q0
+       add     (up,n,8), %r11
+       mov     %rax, %r11
+       adc     %r10, %rbx
+       mov     24(mp,n,8), %rax
+       adc     $0, %r9
+       mov     %rdx, %r10
+       mul     q0
+       add     8(up,n,8), %rbx
+       mov     %rbx, 8(up,n,8)
+       mov     %rax, %rbp
+       mov     32(mp,n,8), %rax
+       adc     %r9, %r11
+       mov     %rdx, %r9
+       adc     $0, %r10
+       imul    u0inv, %rbx             C next q limb
+       jmp     L(e2)
+
+       ALIGNx
+L(tp2):        mul     q0
+       add     %rbp, -24(up,i,8)
+       mov     %rax, %rbp
+       mov     (mp,i,8), %rax
+       adc     %r9, %r11
+       mov     %rdx, %r9
+       adc     $0, %r10
+       mul     q0
+       add     %r11, -16(up,i,8)
+       mov     %rax, %r11
+       mov     8(mp,i,8), %rax
+       adc     %r10, %rbp
+       mov     %rdx, %r10
+       adc     $0, %r9
+       mul     q0
+       add     %rbp, -8(up,i,8)
+       mov     %rax, %rbp
+       adc     %r9, %r11
+       mov     16(mp,i,8), %rax
+       adc     $0, %r10
+       mov     %rdx, %r9
+L(e2): mul     q0
+       add     %r11, (up,i,8)
+       mov     %rax, %r11
+       adc     %r10, %rbp
+       mov     24(mp,i,8), %rax
+       adc     $0, %r9
+       add     $4, i
+       mov     %rdx, %r10
+       js      L(tp2)
+
+L(ed2):        mul     q0
+       add     %rbp, I(-24(up),-24(up,i,8))
+       adc     %r9, %r11
+       adc     $0, %r10
+       add     %r11, I(-16(up),-16(up,i,8))
+       adc     %r10, %rax
+       adc     $0, %rdx
+       add     %rax, I(-8(up),-8(up,i,8))
+       adc     $0, %rdx
+       mov     %rdx, (up,n,8)          C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp2)
+       jmp     L(cj)
+
+L(n1): mov     (mp_param), %rax
+       mul     q0
+       add     -8(up), %rax
+       adc     (up), %rdx
+       mov     %rdx, (rp)
+       mov     $0, R32(%rax)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+
+L(n2): mov     (mp_param), %rax
+       mov     -16(up), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     %rdx, %r9
+       adc     $0, %r9
+       mov     -8(mp), %rax
+       mov     -8(up), %r10
+       mul     q0
+       add     %rax, %r10
+       mov     %rdx, %r11
+       adc     $0, %r11
+       add     %r9, %r10
+       adc     $0, %r11
+       mov     %r10, q0
+       imul    u0inv, q0               C next q0
+       mov     -16(mp), %rax
+       mul     q0
+       add     %rax, %r10
+       mov     %rdx, %r9
+       adc     $0, %r9
+       mov     -8(mp), %rax
+       mov     (up), %r14
+       mul     q0
+       add     %rax, %r14
+       adc     $0, %rdx
+       add     %r9, %r14
+       adc     $0, %rdx
+       xor     R32(%rax), R32(%rax)
+       add     %r11, %r14
+       adc     8(up), %rdx
+       mov     %r14, (rp)
+       mov     %rdx, 8(rp)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+
+       ALIGNx
+L(n3): mov     -24(mp), %rax
+       mov     -24(up), %r10
+       mul     q0
+       add     %rax, %r10
+       mov     -16(mp), %rax
+       mov     %rdx, %r11
+       adc     $0, %r11
+       mov     -16(up), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     %rdx, %r9
+       adc     $0, %r9
+       mov     -8(mp), %rax
+       add     %r11, %rbp
+       mov     -8(up), %r10
+       adc     $0, %r9
+       mul     q0
+       mov     %rbp, q0
+       imul    u0inv, q0               C next q0
+       add     %rax, %r10
+       mov     %rdx, %r11
+       adc     $0, %r11
+       mov     %rbp, -16(up)
+       add     %r9, %r10
+       adc     $0, %r11
+       mov     %r10, -8(up)
+       mov     %r11, -24(up)           C up[0]
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(n3)
+
+       mov     -48(up), %rdx
+       mov     -40(up), %rbx
+       xor     R32(%rax), R32(%rax)
+       add     %rbp, %rdx
+       adc     %r10, %rbx
+       adc     -8(up), %r11
+       mov     %rdx, (rp)
+       mov     %rbx, 8(rp)
+       mov     %r11, 16(rp)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+
+L(n4): mov     -32(mp), %rax
+       mul     q0
+       mov     %rax, %r11
+       mov     -24(mp), %rax
+       mov     %rdx, %r10
+       mul     q0
+       mov     %rax, %rbx
+       mov     -16(mp), %rax
+       mov     %rdx, %r9
+       mul     q0
+       add     -32(up), %r11
+       mov     %rax, %r11
+       adc     %r10, %rbx
+       mov     -8(mp), %rax
+       adc     $0, %r9
+       mov     %rdx, %r10
+       mul     q0
+       add     -24(up), %rbx
+       mov     %rbx, -24(up)
+       adc     %r9, %r11
+       adc     $0, %r10
+       imul    u0inv, %rbx             C next q limb
+       add     %r11, -16(up)
+       adc     %r10, %rax
+       adc     $0, %rdx
+       add     %rax, -8(up)
+       adc     $0, %rdx
+       mov     %rdx, -32(up)           C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       dec     j
+       lea     8(up), up               C up++
+       jnz     L(n4)
+       jmp     L(cj)
+EPILOGUE()
+ASM_END()
index b1db9a639500032f2d455be2fc515cbf7fa08b1b..6f5f6384a7d124054e205f4f7a5a0a42588fbea2 100644 (file)
@@ -5,19 +5,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund.
 dnl  Copyright 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index a986b83164292cf8d285eabb2178cea8901e87b4..29c027de4995adb4ce045f149562f3828fa28d99 100644 (file)
@@ -5,19 +5,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund.
 dnl  Copyright 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 3e194488340638d107333e4dbfdbb2c1d910af78..1306acde2bea1601c8fbb8084829d4152eba8077 100644 (file)
@@ -1,23 +1,35 @@
-dnl  AMD64 mpn_sublsh1_n -- rp[] = up[] - (vp[] << 1) optimised for Intel Atom.
+dnl  AMD64 mpn_sublsh1_n optimised for Intel Atom.
+dnl  Used also for AMD bd1.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
 dnl  Copyright 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -28,6 +40,8 @@ C  * aorrlsh1_n.asm and this file use the same basic pattern.
 C           cycles/limb
 C AMD K8,K9     ?
 C AMD K10       ?
+C AMD bd1       2.3
+C AMD bobcat    ?
 C Intel P4      ?
 C Intel core2   ?
 C Intel NHM     ?
diff --git a/mpn/x86_64/bd1/README b/mpn/x86_64/bd1/README
new file mode 100644 (file)
index 0000000..ccd210e
--- /dev/null
@@ -0,0 +1,11 @@
+This directory contains code for AMD bulldozer including its piledriver update.
+
+We currently make limited use of SIMD instructions, both via the MPN_PATH and
+via inclusion of x86_64/fastsse files.
+
+The bd1 cores share one SIMD/FPU pipeline for two integer units.  This probably
+means that an all-core GMP load (such as a HPC load) might run slower if there
+is significant SIMD dependency.
+
+We should perhaps allow a special 'bd1nosimd' pseudo cpu-name excluding any
+SIMD code.
diff --git a/mpn/x86_64/bd1/aorrlsh1_n.asm b/mpn/x86_64/bd1/aorrlsh1_n.asm
new file mode 100644 (file)
index 0000000..c34a5fa
--- /dev/null
@@ -0,0 +1,37 @@
+dnl  AMD64 mpn_addlsh1_n and mpn_rsblsh1_n
+
+dnl  Copyright 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')
+
+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')
index 9cf5db9620a49d1e286f2e62fc714989eca5f849..96fec9f5ac51dff8707d2f086310da20f44489c5 100644 (file)
@@ -1,22 +1,32 @@
 dnl  AMD64 mpn_addmul_1 and mpn_submul_1 optimised for AMD Bulldozer.
 
-dnl  Copyright 2003, 2004, 2005, 2007, 2008, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2003-2005, 2007, 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/bd1/com.asm b/mpn/x86_64/bd1/com.asm
new file mode 100644 (file)
index 0000000..43f3561
--- /dev/null
@@ -0,0 +1,37 @@
+dnl  X86-64 mpn_com optimised for AMD bd1.
+
+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-palignr.asm')
diff --git a/mpn/x86_64/bd1/copyd.asm b/mpn/x86_64/bd1/copyd.asm
new file mode 100644 (file)
index 0000000..675cdc3
--- /dev/null
@@ -0,0 +1,37 @@
+dnl  X86-64 mpn_copyd optimised for AMD bd1.
+
+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-palignr.asm')
diff --git a/mpn/x86_64/bd1/copyi.asm b/mpn/x86_64/bd1/copyi.asm
new file mode 100644 (file)
index 0000000..ceef036
--- /dev/null
@@ -0,0 +1,37 @@
+dnl  X86-64 mpn_copyi optimised for AMD bd1.
+
+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-palignr.asm')
index bbbdbcd8248887cc1caf6129e5c2540a70b705d4..3d8e5c7ab12a17367073df93486bdf5fa1abd105 100644 (file)
@@ -3,19 +3,30 @@ dnl  AMD64 mpn_gcd_1.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index f64c49181d8671cfe7c5c0ccccf6e834884e47fa..5014f9f469c6b337feb355d881756458dfdd2710 100644 (file)
-/* AMD Bulldozer-1 gmp-mparam.h -- Compiler/machine parameter header file.
+/* AMD bd1 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2010, 2012, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
+
+/* 3600 MHz Bulldozer Zambezi */
+/* FFT tuning limit = 40000000 */
+/* Generated by tuneup.c, 2014-03-13, 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          5
-#define MOD_1U_TO_MOD_1_1_THRESHOLD          3
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD        24
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD        34
+#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        28
 #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           20
+#define BMOD_1_TO_MOD_1_THRESHOLD           22
 
-#define MUL_TOOM22_THRESHOLD                16
-#define MUL_TOOM33_THRESHOLD                57
-#define MUL_TOOM44_THRESHOLD               154
-#define MUL_TOOM6H_THRESHOLD               250
-#define MUL_TOOM8H_THRESHOLD               309
+#define MUL_TOOM22_THRESHOLD                20
+#define MUL_TOOM33_THRESHOLD                59
+#define MUL_TOOM44_THRESHOLD               166
+#define MUL_TOOM6H_THRESHOLD               274
+#define MUL_TOOM8H_THRESHOLD               333
 
 #define MUL_TOOM32_TO_TOOM43_THRESHOLD      97
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     108
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD     107
 #define MUL_TOOM42_TO_TOOM53_THRESHOLD     105
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD     109
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD     143
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD     115
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     150
 
 #define SQR_BASECASE_THRESHOLD               0  /* always (native) */
-#define SQR_TOOM2_THRESHOLD                 24
-#define SQR_TOOM3_THRESHOLD                139
-#define SQR_TOOM4_THRESHOLD                218
+#define SQR_TOOM2_THRESHOLD                 22
+#define SQR_TOOM3_THRESHOLD                 85
+#define SQR_TOOM4_THRESHOLD                242
 #define SQR_TOOM6_THRESHOLD                318
-#define SQR_TOOM8_THRESHOLD                434
+#define SQR_TOOM8_THRESHOLD                478
 
 #define MULMID_TOOM42_THRESHOLD             22
 
 #define MULMOD_BNM1_THRESHOLD               11
-#define SQRMOD_BNM1_THRESHOLD               13
+#define SQRMOD_BNM1_THRESHOLD               14
 
-#define MUL_FFT_MODF_THRESHOLD             396  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             404  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    380, 5}, {     21, 6}, {     11, 5}, {     23, 6}, \
-    {     23, 7}, {     12, 6}, {     25, 7}, {     13, 6}, \
-    {     27, 7}, {     15, 6}, {     31, 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}, {     31, 8}, {     63, 9}, {     35, 8}, \
-    {     71, 9}, {     39,10}, {     23, 9}, {     51,11}, \
-    {     15,10}, {     31, 9}, {     71,10}, {     39, 9}, \
-    {     87,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,12}, {     63,11}, {    127,10}, \
+  { {    404, 5}, {     19, 6}, {     11, 5}, {     23, 6}, \
+    {     19, 7}, {     10, 6}, {     25, 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}, {     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,10}, \
-    {    303,11}, {    159,12}, {     95,11}, {    191,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                 4736
-
-#define SQR_FFT_MODF_THRESHOLD             340  /* k = 5 */
+    {    303,11}, {    159,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, 9}, {   1279,11}, {    367,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,10}, {   1215,12}, \
+    {    319,10}, {   1279,11}, {    671,12}, {    351,11}, \
+    {    703,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,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,12}, {    959,14}, {    255,13}, {    511,12}, \
+    {   1087,11}, {   2175,13}, {    575,12}, {   1215,11}, \
+    {   2431,10}, {   4863,12}, {   1343,13}, {    703,12}, \
+    {   1407,14}, {    383,13}, {    767,12}, {   1599,13}, \
+    {    831,12}, {   1727,11}, {   3455,13}, {    895,12}, \
+    {   1791,13}, {    959,15}, {    255,14}, {    511,13}, \
+    {   1087,12}, {   2175,13}, {   1151,12}, {   2303,13}, \
+    {   1215,12}, {   2431,11}, {   4863,13}, {   1343,12}, \
+    {   2687,13}, {   1471,12}, {   2943,11}, {   5887,14}, \
+    {    767,13}, {   1599,12}, {   3199,13}, {   1727,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,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}, \
+    {  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                 3712
+
+#define SQR_FFT_MODF_THRESHOLD             380  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    332, 5}, {     19, 6}, {     10, 5}, {     21, 6}, \
-    {     11, 5}, {     23, 6}, {     25, 7}, {     25, 8}, \
+  { {    380, 5}, {     17, 6}, {      9, 5}, {     23, 6}, \
+    {     21, 7}, {     11, 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}, {     47,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,10}, \
-    {    159,11}, {     95,10}, {    191,12}, {     63,11}, \
-    {    127,10}, {    255, 9}, {    511,10}, {    271,11}, \
-    {    143,10}, {    303,11}, {    159,10}, {    319,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 71
+    {     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,11}, {     79,10}, {    159,11}, {     95,10}, \
+    {    191,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,13}, \
+    {     63,12}, {    127,11}, {    255,10}, {    511,11}, \
+    {    271,10}, {    543, 9}, {   1087,11}, {    303,10}, \
+    {    607,12}, {    159,11}, {    319,10}, {    639,11}, \
+    {    335,10}, {    671, 9}, {   1343,11}, {    351,12}, \
+    {    191,11}, {    383,10}, {    767,11}, {    415,12}, \
+    {    223,11}, {    447,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,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}, {   1599,10}, \
+    {   3199,12}, {    831,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,11}, \
+    {   3199,13}, {    831,12}, {   1727,13}, {    895,15}, \
+    {    255,14}, {    511,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,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,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}, {   4351,14}, {   2303,13}, \
+    {   4607,14}, {   2431,13}, {   4863,15}, {  32768,16}, \
+    {  65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
+    {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 220
 #define SQR_FFT_THRESHOLD                 3264
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
-#define MULLO_DC_THRESHOLD                  37
-#define MULLO_MUL_N_THRESHOLD             8648
+#define MULLO_DC_THRESHOLD                  39
+#define MULLO_MUL_N_THRESHOLD             7246
 
-#define DC_DIV_QR_THRESHOLD                 57
-#define DC_DIVAPPR_Q_THRESHOLD             204
-#define DC_BDIV_QR_THRESHOLD                48
-#define DC_BDIV_Q_THRESHOLD                107
+#define DC_DIV_QR_THRESHOLD                 54
+#define DC_DIVAPPR_Q_THRESHOLD             180
+#define DC_BDIV_QR_THRESHOLD                47
+#define DC_BDIV_Q_THRESHOLD                 80
 
-#define INV_MULMOD_BNM1_THRESHOLD           30
-#define INV_NEWTON_THRESHOLD               228
-#define INV_APPR_THRESHOLD                 214
+#define INV_MULMOD_BNM1_THRESHOLD           38
+#define INV_NEWTON_THRESHOLD               226
+#define INV_APPR_THRESHOLD                 188
 
 #define BINV_NEWTON_THRESHOLD              248
-#define REDC_1_TO_REDC_2_THRESHOLD          51
+#define REDC_1_TO_REDC_2_THRESHOLD          52
 #define REDC_2_TO_REDC_N_THRESHOLD           0  /* always */
 
 #define MU_DIV_QR_THRESHOLD               1334
-#define MU_DIVAPPR_Q_THRESHOLD            1387
+#define MU_DIVAPPR_Q_THRESHOLD            1360
 #define MUPI_DIV_QR_THRESHOLD              108
 #define MU_BDIV_QR_THRESHOLD              1142
-#define MU_BDIV_Q_THRESHOLD               1308
+#define MU_BDIV_Q_THRESHOLD               1360
 
-#define POWM_SEC_TABLE  2,44,411,580,2246
+#define POWM_SEC_TABLE  1,16,194,386,452,2245
 
-#define MATRIX22_STRASSEN_THRESHOLD         17
-#define HGCD_THRESHOLD                     117
-#define HGCD_APPR_THRESHOLD                 50
+#define MATRIX22_STRASSEN_THRESHOLD         15
+#define HGCD_THRESHOLD                     108
+#define HGCD_APPR_THRESHOLD                 51
 #define HGCD_REDUCE_THRESHOLD             2681
-#define GCD_DC_THRESHOLD                   487
-#define GCDEXT_DC_THRESHOLD                318
+#define GCD_DC_THRESHOLD                   474
+#define GCDEXT_DC_THRESHOLD                298
 #define JACOBI_BASE_METHOD                   4
 
 #define GET_STR_DC_THRESHOLD                13
-#define GET_STR_PRECOMPUTE_THRESHOLD        20
+#define GET_STR_PRECOMPUTE_THRESHOLD        21
 #define SET_STR_DC_THRESHOLD               418
-#define SET_STR_PRECOMPUTE_THRESHOLD      1340
+#define SET_STR_PRECOMPUTE_THRESHOLD      1289
 
-#define FAC_DSC_THRESHOLD                  462
-#define FAC_ODD_THRESHOLD                    0  /* always */
+#define FAC_DSC_THRESHOLD                  252
+#define FAC_ODD_THRESHOLD                   23
index 9e35f2d6cf52a2b80220f7195b836dabc8677a11..93e1e5632b252e927102c843edabb2146a2fa29d 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD64 mpn_hamdist -- hamming distance.
 
-dnl  Copyright 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index bf556c3b23fd304dacd9b640f481bd4c00433216..e59667c0853fa0d3746e912f404787f90a54f2eb 100644 (file)
@@ -1,22 +1,32 @@
 dnl  AMD64 mpn_mul_1 optimised for AMD Bulldozer.
 
-dnl  Copyright 2003, 2004, 2005, 2007, 2008, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2003-2005, 2007, 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/bd1/mul_2.asm b/mpn/x86_64/bd1/mul_2.asm
new file mode 100644 (file)
index 0000000..4ed5f30
--- /dev/null
@@ -0,0 +1,192 @@
+dnl  AMD64 mpn_mul_2 optimised for AMD Bulldozer.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2008, 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')
+
+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 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
+define(`n_param', `%rdx')   C r8
+define(`vp',      `%rcx')   C r9
+
+define(`v0', `%r8')
+define(`v1', `%r9')
+define(`w0', `%rbx')
+define(`w1', `%rcx')
+define(`w2', `%rbp')
+define(`w3', `%r10')
+define(`n',  `%r11')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_mul_2)
+       FUNC_ENTRY(4)
+       push    %rbx
+       push    %rbp
+
+       mov     (up), %rax
+
+       mov     (vp), v0
+       mov     8(vp), v1
+
+       lea     (up,n_param,8), up
+       lea     (rp,n_param,8), rp
+
+       mov     n_param, n
+       mul     v0
+       neg     n
+
+       test    $1, R8(n)
+       jnz     L(bx1)
+
+L(bx0):        test    $2, R8(n)
+       jnz     L(b10)
+
+L(b00):        mov     %rax, w0
+       mov     %rdx, w1
+       xor     R32(w2), R32(w2)
+       mov     (up,n,8), %rax
+       jmp     L(lo0)
+
+L(b10):        mov     %rax, w2
+       mov     %rdx, w3
+       mov     (up,n,8), %rax
+       xor     R32(w0), R32(w0)
+       mul     v1
+       add     $-2, n
+       jmp     L(lo2)
+
+L(bx1):        test    $2, R8(n)
+       jz      L(b11)
+
+L(b01):        mov     %rax, w3
+       mov     %rdx, w0
+       mov     (up,n,8), %rax
+       mul     v1
+       xor     R32(w1), R32(w1)
+       inc     n
+       jmp     L(lo1)
+
+L(b11):        mov     %rax, w1
+       mov     %rdx, w2
+       mov     (up,n,8), %rax
+       xor     R32(w3), R32(w3)
+       dec     n
+       jmp     L(lo3)
+
+       ALIGN(32)
+L(top):        mov     -8(up,n,8), %rax
+       mul     v1
+       mov     w2, -16(rp,n,8)
+L(lo1):        add     %rax, w0
+       mov     w3, -8(rp,n,8)
+       adc     %rdx, w1
+       mov     (up,n,8), %rax
+       mul     v0
+       mov     $0, R32(w2)
+       add     %rax, w0
+       adc     %rdx, w1
+       adc     $0, R32(w2)
+       mov     (up,n,8), %rax
+L(lo0):        mul     v1
+       add     %rax, w1
+       adc     %rdx, w2
+       mov     8(up,n,8), %rax
+       mul     v0
+       add     %rax, w1
+       mov     w0, (rp,n,8)
+       mov     $0, R32(w3)
+       mov     8(up,n,8), %rax
+       adc     %rdx, w2
+       adc     $0, R32(w3)
+L(lo3):        mul     v1
+       add     %rax, w2
+       mov     16(up,n,8), %rax
+       adc     %rdx, w3
+       mul     v0
+       add     %rax, w2
+       mov     16(up,n,8), %rax
+       mov     $0, R32(w0)
+       adc     %rdx, w3
+       adc     $0, R32(w0)
+       mul     v1
+       mov     w1, 8(rp,n,8)
+L(lo2):        add     %rax, w3
+       adc     %rdx, w0
+       mov     24(up,n,8), %rax
+       mul     v0
+       add     %rax, w3
+       adc     %rdx, w0
+       mov     $0, R32(w1)
+       adc     $0, R32(w1)
+       add     $4, n
+       jnc     L(top)
+
+L(end):        mov     -8(up,n,8), %rax
+       mul     v1
+       mov     w2, -16(rp,n,8)
+       add     %rax, w0
+       mov     w3, -8(rp,n,8)
+       adc     %rdx, w1
+       mov     w0, (rp,n,8)
+       mov     w1, %rax
+
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
diff --git a/mpn/x86_64/bd1/mul_basecase.asm b/mpn/x86_64/bd1/mul_basecase.asm
new file mode 100644 (file)
index 0000000..e47ba58
--- /dev/null
@@ -0,0 +1,416 @@
+dnl  AMD64 mpn_mul_basecase optimised for AMD Bulldozer and Piledriver.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2003-2005, 2007, 2008, 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')
+
+C cycles/limb  mul_1           mul_2           mul_3           addmul_2
+C AMD K8,K9
+C AMD K10
+C AMD bull     ~4.8            ~4.55           -               ~4.3
+C AMD pile     ~4.6            ~4.55           -               ~4.55
+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 VIA nano
+
+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.
+
+C TODO
+C  * Merge bull-specific mul_1, if it is not slower the TOOM22 range.
+C    Alternatively, we could tweak the present code (which was loopmixed for a
+C    different CPU).
+C  * Merge faster mul_2, such as the one in the same directory as this file.
+C  * Further 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(`un_param',`%rdx')
+define(`vp',      `%rcx')
+define(`vn',      `%r8')
+
+define(`un',      `%rbx')
+
+define(`w0',   `%r10')
+define(`w1',   `%r11')
+define(`w2',   `%r12')
+define(`w3',   `%r13')
+define(`n',    `%rbp')
+define(`v0',   `%r9')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_mul_basecase)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8d  ')
+       push    %rbx
+       push    %rbp
+       mov     un_param, un            C free up rdx
+       neg     un
+
+       mov     (up), %rax              C shared for mul_1 and mul_2
+       lea     (up,un_param,8), up     C point at operand end
+       lea     (rp,un_param,8), rp     C point at rp[un-1]
+
+       mov     (vp), v0                C shared for mul_1 and mul_2
+       mul     v0                      C shared for mul_1 and mul_2
+
+       test    $1, R8(vn)
+       jz      L(do_mul_2)
+
+L(do_mul_1):
+       test    $1, R8(un)
+       jnz     L(m1x1)
+
+L(m1x0):mov    %rax, w0                C un = 2, 4, 6, 8, ...
+       mov     %rdx, w1
+       mov     8(up,un,8), %rax
+       test    $2, R8(un)
+       jnz     L(m110)
+
+L(m100):lea    2(un), n                C un = 4, 8, 12, ...
+       jmp     L(m1l0)
+
+L(m110):lea    (un), n                 C un = 2, 6, 10, ...
+       jmp     L(m1l2)
+
+L(m1x1):mov    %rax, w1                C un = 1, 3, 5, 7, ...
+       mov     %rdx, w0
+       test    $2, R8(un)
+       jz      L(m111)
+
+L(m101):lea    3(un), n                C un = 1, 5, 9, ...
+       test    n, n
+       js      L(m1l1)
+       mov     %rax, -8(rp)
+       mov     %rdx, (rp)
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+L(m111):lea    1(un), n                C un = 3, 7, 11, ...
+       mov     8(up,un,8), %rax
+       jmp     L(m1l3)
+
+       ALIGN(16)
+L(m1tp):mov    %rdx, w0
+       add     %rax, w1
+L(m1l1):mov    -16(up,n,8), %rax
+       adc     $0, w0
+       mul     v0
+       add     %rax, w0
+       mov     w1, -24(rp,n,8)
+       mov     -8(up,n,8), %rax
+       mov     %rdx, w1
+       adc     $0, w1
+L(m1l0):mul    v0
+       mov     w0, -16(rp,n,8)
+       add     %rax, w1
+       mov     %rdx, w0
+       mov     (up,n,8), %rax
+       adc     $0, w0
+L(m1l3):mul    v0
+       mov     w1, -8(rp,n,8)
+       mov     %rdx, w1
+       add     %rax, w0
+       mov     8(up,n,8), %rax
+       adc     $0, w1
+L(m1l2):mul    v0
+       mov     w0, (rp,n,8)
+       add     $4, n
+       jnc     L(m1tp)
+
+L(m1ed):add    %rax, w1
+       adc     $0, %rdx
+       mov     w1, I(-8(rp),-24(rp,n,8))
+       mov     %rdx, I((rp),-16(rp,n,8))
+
+       dec     R32(vn)
+       jz      L(ret2)
+
+       lea     8(vp), vp
+       lea     8(rp), rp
+       push    %r12
+       push    %r13
+       push    %r14
+       jmp     L(do_addmul)
+
+L(do_mul_2):
+define(`v1',   `%r14')
+       push    %r12
+       push    %r13
+       push    %r14
+
+       mov     8(vp), v1
+
+       test    $1, R8(un)
+       jnz     L(m2b1)
+
+L(m2b0):lea    (un), n
+       mov     %rax, w2                C 0
+       mov     (up,un,8), %rax
+       mov     %rdx, w1                C 1
+       mul     v1
+       mov     %rax, w0                C 1
+       mov     w2, (rp,un,8)           C 0
+       mov     8(up,un,8), %rax
+       mov     %rdx, w2                C 2
+       jmp     L(m2l0)
+
+L(m2b1):lea    1(un), n
+       mov     %rax, w0                C 1
+       mov     %rdx, w3                C 2
+       mov     (up,un,8), %rax
+       mul     v1
+       mov     w0, (rp,un,8)           C 1
+       mov     %rdx, w0                C 3
+       mov     %rax, w2                C 0
+       mov     8(up,un,8), %rax
+       jmp     L(m2l1)
+
+       ALIGN(32)
+L(m2tp):add    %rax, w2                C 0
+       mov     (up,n,8), %rax
+       adc     $0, w0                  C 1
+L(m2l1):mul    v0
+       add     %rax, w2                C 0
+       mov     (up,n,8), %rax
+       mov     %rdx, w1                C 1
+       adc     $0, w1                  C 1
+       mul     v1
+       add     w3, w2                  C 0
+       adc     $0, w1                  C 1
+       add     %rax, w0                C 1
+       mov     w2, (rp,n,8)            C 0
+       mov     8(up,n,8), %rax
+       mov     %rdx, w2                C 2
+       adc     $0, w2                  C 2
+L(m2l0):mul    v0
+       add     %rax, w0                C 1
+       mov     %rdx, w3                C 2
+       adc     $0, w3                  C 2
+       add     w1, w0                  C 1
+       adc     $0, w3                  C 2
+       mov     8(up,n,8), %rax
+       mul     v1
+       add     $2, n
+       mov     w0, -8(rp,n,8)          C 1
+       mov     %rdx, w0                C 3
+       jnc     L(m2tp)
+
+L(m2ed):add    %rax, w2
+       adc     $0, %rdx
+       add     w3, w2
+       adc     $0, %rdx
+       mov     w2, I((rp),(rp,n,8))
+       mov     %rdx, I(8(rp),8(rp,n,8))
+
+       add     $-2, R32(vn)
+       jz      L(ret5)
+
+       lea     16(vp), vp
+       lea     16(rp), rp
+
+
+L(do_addmul):
+       push    %r15
+       push    vn                      C save vn in new stack slot
+define(`vn',   `(%rsp)')
+define(`X0',   `%r14')
+define(`X1',   `%r15')
+define(`v1',   `%r8')
+
+L(outer):
+       mov     (vp), v0
+       mov     8(vp), v1
+
+       mov     (up,un,8), %rax
+       mul     v0
+
+       test    $1, R8(un)
+       jnz     L(bx1)
+
+L(bx0):        mov     %rax, X1
+       mov     (up,un,8), %rax
+       mov     %rdx, X0
+       mul     v1
+       test    $2, R8(un)
+       jnz     L(b10)
+
+L(b00):        lea     (un), n                 C un = 4, 8, 12, ...
+       mov     (rp,un,8), w3
+       mov     %rax, w0
+       mov     8(up,un,8), %rax
+       mov     %rdx, w1
+       jmp     L(lo0)
+
+L(b10):        lea     2(un), n                C un = 2, 6, 10, ...
+       mov     (rp,un,8), w1
+       mov     %rdx, w3
+       mov     %rax, w2
+       mov     8(up,un,8), %rax
+       jmp     L(lo2)
+
+L(bx1):        mov     %rax, X0
+       mov     (up,un,8), %rax
+       mov     %rdx, X1
+       mul     v1
+       test    $2, R8(un)
+       jz      L(b11)
+
+L(b01):        lea     1(un), n                C un = 1, 5, 9, ...
+       mov     (rp,un,8), w2
+       mov     %rdx, w0
+       mov     %rax, w3
+       jmp     L(lo1)
+
+L(b11):        lea     -1(un), n               C un = 3, 7, 11, ...
+       mov     (rp,un,8), w0
+       mov     %rax, w1
+       mov     8(up,un,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, I(-16(rp),-16(rp,n,8))
+       mov     %rdx, X1
+       adc     %rax, X0
+       adc     $0, X1
+       mov     I(-8(up),-8(up,n,8)), %rax
+       mul     v1
+       mov     I(-8(rp),-8(rp,n,8)), w1
+       add     w1, w2
+       adc     %rax, w3
+       adc     $0, %rdx
+       add     w2, X0
+       adc     $0, X1
+       mov     X0, I(-8(rp),-8(rp,n,8))
+       add     w3, X1
+       mov     X1, I((rp),(rp,n,8))
+       adc     $0, %rdx
+       mov     %rdx, I(8(rp),8(rp,n,8))
+
+
+       addl    $-2, vn
+       lea     16(vp), vp
+       lea     16(rp), rp
+       jnz     L(outer)
+
+       pop     %rax            C deallocate vn slot
+       pop     %r15
+L(ret5):pop    %r14
+       pop     %r13
+       pop     %r12
+L(ret2):pop    %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
index c93c93ba50ca99a49162203a15cf1bda92ef8156..8f22a715b661d52e7cc8e7a81ae6f61745141a84 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD64 mpn_popcount -- population count.
 
-dnl  Copyright 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
diff --git a/mpn/x86_64/bd1/sec_tabselect.asm b/mpn/x86_64/bd1/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..e436034
--- /dev/null
@@ -0,0 +1,37 @@
+dnl  X86-64 mpn_sec_tabselect.
+
+dnl  Copyright 2012, 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')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_sec_tabselect)
+include_mpn(`x86_64/fastsse/sec_tabselect.asm')
diff --git a/mpn/x86_64/bd1/sublsh1_n.asm b/mpn/x86_64/bd1/sublsh1_n.asm
new file mode 100644 (file)
index 0000000..4ba673d
--- /dev/null
@@ -0,0 +1,37 @@
+dnl  AMD64 mpn_sublsh1_n
+
+dnl  Copyright 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')
+
+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/mpn/x86_64/bd2/gmp-mparam.h b/mpn/x86_64/bd2/gmp-mparam.h
new file mode 100644 (file)
index 0000000..16f25c4
--- /dev/null
@@ -0,0 +1,237 @@
+/* AMD bd2 gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 1991, 1993, 1994, 2000-2010, 2012, 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 64
+#define GMP_LIMB_BYTES 8
+
+/* 3200 MHz Piledriver Vishera  */
+/* FFT tuning limit = 40000000 */
+/* Generated by tuneup.c, 2014-03-12, 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          4
+#define MOD_1U_TO_MOD_1_1_THRESHOLD          4
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD        17
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD        34
+#define PREINV_MOD_1_TO_MOD_1_THRESHOLD     10
+#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 */
+#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           21
+
+#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_TOOM32_TO_TOOM43_THRESHOLD      97
+#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     147
+
+#define SQR_BASECASE_THRESHOLD               0  /* always (native) */
+#define SQR_TOOM2_THRESHOLD                 22
+#define SQR_TOOM3_THRESHOLD                 81
+#define SQR_TOOM4_THRESHOLD                218
+#define SQR_TOOM6_THRESHOLD                303
+#define SQR_TOOM8_THRESHOLD                430
+
+#define MULMID_TOOM42_THRESHOLD             20
+
+#define MULMOD_BNM1_THRESHOLD               12
+#define SQRMOD_BNM1_THRESHOLD               13
+
+#define MUL_FFT_MODF_THRESHOLD             376  /* k = 5 */
+#define MUL_FFT_TABLE3                                      \
+  { {    376, 5}, {     19, 6}, {     10, 5}, {     21, 6}, \
+    {     11, 5}, {     23, 6}, {     21, 7}, {     11, 6}, \
+    {     23, 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}, \
+    {     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}, {     79,11}, \
+    {     47,10}, {     95,12}, {     31,11}, {     63,10}, \
+    {    135, 6}, {   2175, 7}, {   1151, 9}, {    303,10}, \
+    {    159, 9}, {    319, 8}, {    639, 9}, {    335,11}, \
+    {     95,10}, {    191,11}, {    111,12}, {     63,11}, \
+    {    127,10}, {    255,11}, {    143,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}, {    351,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,10}, {   1279,12}, {    351,13}, \
+    {    191,12}, {    383,11}, {    767,12}, {    415,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}, {    639,11}, {   1279,12}, {    671,11}, \
+    {   1343,10}, {   2687,12}, {    703,11}, {   1407,10}, \
+    {   2815,12}, {    735,13}, {    383,12}, {    767,11}, \
+    {   1599,12}, {    831,11}, {   1663,13}, {    447,12}, \
+    {    895,11}, {   1791,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,12}, {   1343,11}, {   2687,13}, {    703,12}, \
+    {   1407,11}, {   2815,14}, {    383,13}, {    767,12}, \
+    {   1599,13}, {    831,12}, {   1663,13}, {    895,12}, \
+    {   1791,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}, {   1343,12}, {   2687,13}, {   1407,12}, \
+    {   2815,13}, {   1471,12}, {   2943,11}, {   5887,14}, \
+    {    767,13}, {   1599,12}, {   3199,13}, {   1727,14}, \
+    {    895,13}, {   1791,12}, {   3583,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}, {   1791,13}, \
+    {   3583,14}, {   1919,13}, {   3839,12}, {   7679,16}, \
+    {    511,15}, {   1023,14}, {   2175,13}, {   4479,14}, \
+    {   2303,13}, {   4607,14}, {   2431,13}, {   4863,15}, \
+    {  32768,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             344  /* k = 5 */
+#define SQR_FFT_TABLE3                                      \
+  { {    344, 5}, {     11, 4}, {     23, 5}, {     19, 6}, \
+    {     10, 5}, {     21, 6}, {     21, 7}, {     11, 6}, \
+    {     25, 7}, {     13, 6}, {     27, 7}, {     17, 6}, \
+    {     35, 8}, {      9, 7}, {     21, 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}, {     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,11}, \
+    {     31,10}, {     79,11}, {     47,10}, {     95,12}, \
+    {     31,11}, {     63,10}, {    127, 9}, {    255,10}, \
+    {    135,11}, {     95,10}, {    191, 6}, {   3199, 7}, \
+    {   1727, 9}, {    447,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,11}, {    207,13}, \
+    {     63,12}, {    127,11}, {    255,10}, {    511,11}, \
+    {    271,10}, {    543,11}, {    287,10}, {    575,11}, \
+    {    351,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,12}, {    319,10}, \
+    {   1279,12}, {    351,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,13}, {    319,11}, {   1279,12}, {    671,11}, \
+    {   1343,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,11}, {   2303,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}, \
+    {   2239,11}, {   4479,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}, {   1599,12}, {   3199,13}, {   1727,14}, \
+    {    895,13}, {   1791,12}, {   3583,13}, {   1919,12}, \
+    {   3839,15}, {    511,14}, {   1023,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}, {  32768,16}, {  65536,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                 3264
+
+#define MULLO_BASECASE_THRESHOLD             0  /* always */
+#define MULLO_DC_THRESHOLD                  37
+#define MULLO_MUL_N_THRESHOLD             8397
+
+#define DC_DIV_QR_THRESHOLD                 42
+#define DC_DIVAPPR_Q_THRESHOLD             173
+#define DC_BDIV_QR_THRESHOLD                42
+#define DC_BDIV_Q_THRESHOLD                 77
+
+#define INV_MULMOD_BNM1_THRESHOLD           30
+#define INV_NEWTON_THRESHOLD               202
+#define INV_APPR_THRESHOLD                 172
+
+#define BINV_NEWTON_THRESHOLD              238
+#define REDC_1_TO_REDC_2_THRESHOLD          44
+#define REDC_2_TO_REDC_N_THRESHOLD           0  /* always */
+
+#define MU_DIV_QR_THRESHOLD               1308
+#define MU_DIVAPPR_Q_THRESHOLD            1334
+#define MUPI_DIV_QR_THRESHOLD               85
+#define MU_BDIV_QR_THRESHOLD              1142
+#define MU_BDIV_Q_THRESHOLD               1308
+
+#define POWM_SEC_TABLE  1,16,257,452,1099,2079
+
+#define MATRIX22_STRASSEN_THRESHOLD         14
+#define HGCD_THRESHOLD                     110
+#define HGCD_APPR_THRESHOLD                 96
+#define HGCD_REDUCE_THRESHOLD             2479
+#define GCD_DC_THRESHOLD                   372
+#define GCDEXT_DC_THRESHOLD                293
+#define JACOBI_BASE_METHOD                   4
+
+#define GET_STR_DC_THRESHOLD                12
+#define GET_STR_PRECOMPUTE_THRESHOLD        20
+#define SET_STR_DC_THRESHOLD               204
+#define SET_STR_PRECOMPUTE_THRESHOLD      1160
+
+#define FAC_DSC_THRESHOLD                  166
+#define FAC_ODD_THRESHOLD                   24
index f3d7084d1f1d8572e29811e046551c1ea407d216..a53bd52beb3df20ce7636208e89764374d5077d4 100644 (file)
@@ -3,19 +3,30 @@ dnl  x86_64 mpn_bdiv_dbm1.
 dnl  Copyright 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index a814e284356c0c59d6a71b29192d712c75ffb55f..02eacbe6a8b8325cea99c41ef37f268e97b47691 100644 (file)
@@ -1,23 +1,34 @@
 dnl  AMD64 mpn_bdiv_q_1, mpn_pi1_bdiv_q_1 -- schoolbook Hensel division by
 dnl  1-limb divisor, returning quotient only.
 
-dnl  Copyright 2001, 2002, 2004, 2005, 2006, 2009, 2011, 2012 Free Software
+dnl  Copyright 2001, 2002, 2004-2006, 2009, 2011, 2012 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/bobcat/aors_n.asm b/mpn/x86_64/bobcat/aors_n.asm
new file mode 100644 (file)
index 0000000..22287b8
--- /dev/null
@@ -0,0 +1,150 @@
+dnl  AMD64 mpn_add_n, mpn_sub_n optimised for bobcat.
+
+dnl  Copyright 2003-2005, 2007, 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
+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 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)
+       FUNC_ENTRY(4)
+       xor     %r8, %r8
+L(ent):        test    $1, R8(n)
+       jnz     L(bx1)
+
+L(bx0):        test    $2, R8(n)
+       jnz     L(b10)
+
+L(b00):        shr     $2, n
+       neg     %r8
+       mov     $3, R32(%rax)
+       mov     (up), %r10
+       mov     8(up), %r11
+       jmp     L(lo0)
+
+L(b10):        shr     $2, n
+       neg     %r8
+       mov     $1, R32(%rax)
+       mov     (up), %r8
+       mov     8(up), %r9
+       jrcxz   L(cj2)
+       jmp     L(top)
+
+L(bx1):        test    $2, R8(n)
+       jnz     L(b11)
+
+L(b01):        shr     $2, n
+       neg     %r8
+       mov     $0, R32(%rax)
+       mov     (up), %r9
+       jrcxz   L(cj1)
+       mov     8(up), %r10
+       jmp     L(lo1)
+
+       ALIGN(8)
+L(b11):        inc     n
+       shr     $2, n
+       neg     %r8
+       mov     $2, R32(%rax)
+       mov     (up), %r11
+       jmp     L(lo3)
+
+       ALIGN(4)
+L(top):        mov     8(up,%rax,8), %r10
+       ADCSBB  -8(vp,%rax,8), %r8
+       mov     %r8, -8(rp,%rax,8)
+L(lo1):        mov     16(up,%rax,8), %r11
+       ADCSBB  (vp,%rax,8), %r9
+       lea     4(%rax), %rax
+       mov     %r9, -32(rp,%rax,8)
+L(lo0):        ADCSBB  -24(vp,%rax,8), %r10
+       mov     %r10, -24(rp,%rax,8)
+L(lo3):        ADCSBB  -16(vp,%rax,8), %r11
+       dec     n
+       mov     -8(up,%rax,8), %r8
+       mov     %r11, -16(rp,%rax,8)
+L(lo2):        mov     (up,%rax,8), %r9
+       jnz     L(top)
+
+L(cj2):        ADCSBB  -8(vp,%rax,8), %r8
+       mov     %r8, -8(rp,%rax,8)
+L(cj1):        ADCSBB  (vp,%rax,8), %r9
+       mov     %r9, (rp,%rax,8)
+
+       mov     $0, R32(%rax)
+       adc     $0, R32(%rax)
+
+       FUNC_EXIT()
+       ret
+EPILOGUE()
+
+       ALIGN(16)
+PROLOGUE(func_nc)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8   ')
+       jmp     L(ent)
+EPILOGUE()
index 412d5e21f886f4d76b8535e2a657f5c098d3ed1b..415a17cb7ff1bcb5811e9289f2d81576bc6744ce 100644 (file)
@@ -1,22 +1,32 @@
 dnl  AMD64 mpn_addmul_1 and mpn_submul_1 optimised for AMD bobcat.
 
-dnl  Copyright 2003, 2004, 2005, 2007, 2008, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2003-2005, 2007, 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -32,9 +42,6 @@ C Intel SBR    3.92
 C Intel atom   23
 C VIA nano      5.63
 
-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.
-
 ABI_SUPPORT(DOS64)
 ABI_SUPPORT(STD64)
 
index ca47bbd80380c882dcd5641ca1423aea178f92fc..877714e903c3a41cb4add4e2a902b727017b126e 100644 (file)
@@ -3,19 +3,30 @@ dnl  AMD64 mpn_copyd optimised for AMD bobcat.
 dnl  Copyright 2003, 2005, 2007, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 7ce0811d180001ef7174682b65d897b169ea719f..ee0f578652b6fe7a9b7516dfe5d0b0ec2f0b5879 100644 (file)
@@ -3,19 +3,30 @@ dnl  AMD64 mpn_copyi optimised for AMD bobcat.
 dnl  Copyright 2003, 2005, 2007, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index da0936abcd2b4945d973149fb0f3003b38ef7570..de4c4e4528c60c72269a8b42d0b45d5556a64aa4 100644 (file)
 /* AMD Bobcat gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2012, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
-/* 1600 MHz AMD Bobcat E-350 */
+#undef HAVE_NATIVE_mpn_mul_2
+#undef HAVE_NATIVE_mpn_addmul_2
+
+/* 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          3
-#define MOD_1U_TO_MOD_1_1_THRESHOLD          2
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD        39
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD         0  /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD      7
+#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        32
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD        43
+#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                27
-#define MUL_TOOM33_THRESHOLD                32
-#define MUL_TOOM44_THRESHOLD               272
-#define MUL_TOOM6H_THRESHOLD               357
-#define MUL_TOOM8H_THRESHOLD                 0  /* always */
+#define MUL_TOOM22_THRESHOLD                24
+#define MUL_TOOM33_THRESHOLD                36
+#define MUL_TOOM44_THRESHOLD               268
+#define MUL_TOOM6H_THRESHOLD               396
+#define MUL_TOOM8H_THRESHOLD               517
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD     115
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     172
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD     119
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD     128
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD     160
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD      69
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD     195
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD     181
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD      72
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     103
 
 #define SQR_BASECASE_THRESHOLD               0  /* always (native) */
-#define SQR_TOOM2_THRESHOLD                 28
+#define SQR_TOOM2_THRESHOLD                 26
 #define SQR_TOOM3_THRESHOLD                 93
-#define SQR_TOOM4_THRESHOLD                372
+#define SQR_TOOM4_THRESHOLD                375
 #define SQR_TOOM6_THRESHOLD                  0  /* always */
-#define SQR_TOOM8_THRESHOLD                430
+#define SQR_TOOM8_THRESHOLD                478
 
-#define MULMID_TOOM42_THRESHOLD             24
+#define MULMID_TOOM42_THRESHOLD             22
 
 #define MULMOD_BNM1_THRESHOLD               11
 #define SQRMOD_BNM1_THRESHOLD               13
 
-#define MUL_FFT_MODF_THRESHOLD             460  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             400  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    372, 5}, {     17, 6}, {      9, 5}, {     19, 6}, \
+  { {    400, 5}, {     17, 6}, {      9, 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}, {     21, 8}, \
-    {     11, 7}, {     25, 8}, {     13, 7}, {     28, 8}, \
-    {     15, 7}, {     31, 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}, {     55,11}, \
-    {     15,10}, {     31, 9}, {     67,10}, {     39, 9}, \
-    {     83,10}, {     47, 9}, {     95,10}, {     55,11}, \
-    {     31,10}, {     79,11}, {     47,10}, {     95, 8}, \
-    {    383,10}, {    111,12}, {     31,11}, {     63,10}, \
-    {    143,11}, {     79, 9}, {    319,10}, {    167,11}, \
-    {     95,10}, {    191, 9}, {    383,10}, {    207,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}, {   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 86
-#define MUL_FFT_THRESHOLD                 5760
-
-#define SQR_FFT_MODF_THRESHOLD             376  /* k = 5 */
+    {     20, 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}, \
+    {     37, 9}, {     19, 8}, {     43, 9}, {     23, 8}, \
+    {     49, 9}, {     27,10}, {     15, 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}, {     63, 9}, \
+    {    127,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}, {    383,10}, {    767,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}, {   1407,14}, \
+    {    767,13}, {   1663,14}, {    895,15}, {    511,14}, \
+    {   1023,13}, {   2175,14}, {   1151,13}, {   2431,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 156
+#define MUL_FFT_THRESHOLD                 5504
+
+#define SQR_FFT_MODF_THRESHOLD             380  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    340, 5}, {     19, 6}, {     10, 5}, {     21, 6}, \
-    {     21, 7}, {     11, 6}, {     23, 7}, {     13, 6}, \
-    {     27, 7}, {     21, 8}, {     11, 7}, {     25, 8}, \
+  { {    380, 5}, {     17, 6}, {      9, 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}, \
-    {     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,11}, {     95,10}, {    191, 9}, {    383,12}, \
-    {     63,11}, {    127,10}, {    255, 9}, {    511,10}, \
-    {    271, 9}, {    543,10}, {    287, 9}, {    575,10}, \
+    {     27, 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,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}, {    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,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 77
-#define SQR_FFT_THRESHOLD                 3648
+    {    207,10}, {    415,13}, {     63,12}, {    127,11}, \
+    {    255,10}, {    511,11}, {    271,10}, {    575,11}, \
+    {    303,12}, {    159,11}, {    319,10}, {    639,11}, \
+    {    335,10}, {    671,11}, {    351,10}, {    703,11}, \
+    {    367,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}, {    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,14}, {   1279,13}, \
+    {   2687,15}, {  32768,16}, {  65536,17}, { 131072,18}, \
+    { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
+    {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 162
+#define SQR_FFT_THRESHOLD                 3712
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
-#define MULLO_DC_THRESHOLD                  52
-#define MULLO_MUL_N_THRESHOLD            11278
+#define MULLO_DC_THRESHOLD                  26
+#define MULLO_MUL_N_THRESHOLD            10950
 
-#define DC_DIV_QR_THRESHOLD                 71
-#define DC_DIVAPPR_Q_THRESHOLD             202
-#define DC_BDIV_QR_THRESHOLD                76
-#define DC_BDIV_Q_THRESHOLD                151
+#define DC_DIV_QR_THRESHOLD                 63
+#define DC_DIVAPPR_Q_THRESHOLD             198
+#define DC_BDIV_QR_THRESHOLD                56
+#define DC_BDIV_Q_THRESHOLD                127
 
-#define INV_MULMOD_BNM1_THRESHOLD           51
-#define INV_NEWTON_THRESHOLD               248
+#define INV_MULMOD_BNM1_THRESHOLD           46
+#define INV_NEWTON_THRESHOLD               236
 #define INV_APPR_THRESHOLD                 204
 
-#define BINV_NEWTON_THRESHOLD              252
-#define REDC_1_TO_REDC_2_THRESHOLD          46
+#define BINV_NEWTON_THRESHOLD              286
+#define REDC_1_TO_REDC_2_THRESHOLD          63
 #define REDC_2_TO_REDC_N_THRESHOLD           0  /* always */
 
-#define MU_DIV_QR_THRESHOLD               1470
-#define MU_DIVAPPR_Q_THRESHOLD            1589
-#define MUPI_DIV_QR_THRESHOLD              122
+#define MU_DIV_QR_THRESHOLD               1499
+#define MU_DIVAPPR_Q_THRESHOLD            1499
+#define MUPI_DIV_QR_THRESHOLD               84
 #define MU_BDIV_QR_THRESHOLD              1334
-#define MU_BDIV_Q_THRESHOLD               1442
+#define MU_BDIV_Q_THRESHOLD               1470
 
-#define POWM_SEC_TABLE  1,41,322,840,1421
+#define POWM_SEC_TABLE  1,16,194,904,1167
 
 #define MATRIX22_STRASSEN_THRESHOLD         15
-#define HGCD_THRESHOLD                      86
+#define HGCD_THRESHOLD                     102
 #define HGCD_APPR_THRESHOLD                 50
-#define HGCD_REDUCE_THRESHOLD             3014
-#define GCD_DC_THRESHOLD                   483
-#define GCDEXT_DC_THRESHOLD                303
+#define HGCD_REDUCE_THRESHOLD             2681
+#define GCD_DC_THRESHOLD                   416
+#define GCDEXT_DC_THRESHOLD                293
 #define JACOBI_BASE_METHOD                   4
 
-#define GET_STR_DC_THRESHOLD                16
-#define GET_STR_PRECOMPUTE_THRESHOLD        31
-#define SET_STR_DC_THRESHOLD               266
-#define SET_STR_PRECOMPUTE_THRESHOLD      1424
+#define GET_STR_DC_THRESHOLD                15
+#define GET_STR_PRECOMPUTE_THRESHOLD        26
+#define SET_STR_DC_THRESHOLD               248
+#define SET_STR_PRECOMPUTE_THRESHOLD      1160
 
-#define FAC_DSC_THRESHOLD                  906
-#define FAC_ODD_THRESHOLD                   46
+#define FAC_DSC_THRESHOLD                  746
+#define FAC_ODD_THRESHOLD                   44
index dd9560c4c95aecfc55a30987d1f9517d3f6f8b4f..cb58bef0b3564d8143fa0d227ca81373b94bb232 100644 (file)
@@ -1,22 +1,32 @@
 dnl  AMD64 mpn_mul_1 optimised for AMD bobcat.
 
-dnl  Copyright 2003, 2004, 2005, 2007, 2008, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2003-2005, 2007, 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 74870123c1b9be56e3f66493c12850866a63fa86..e7d46bfcff6cf201cebea49f7f89ff4d6b7a1290 100644 (file)
@@ -1,22 +1,32 @@
 dnl  AMD64 mpn_mul_basecase optimised for AMD bobcat.
 
-dnl  Copyright 2003, 2004, 2005, 2007, 2008, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2003-2005, 2007, 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/bobcat/redc_1.asm b/mpn/x86_64/bobcat/redc_1.asm
new file mode 100644 (file)
index 0000000..c379802
--- /dev/null
@@ -0,0 +1,502 @@
+dnl  X86-64 mpn_redc_1 optimised for AMD bobcat.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2003-2005, 2007, 2008, 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')
+
+C           cycles/limb
+C AMD K8,K9     ?
+C AMD K10       ?
+C AMD bull      ?
+C AMD pile      ?
+C AMD steam     ?
+C AMD bobcat    5.0
+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 VIA nano      ?
+
+C TODO
+C  * Micro-optimise, none performed thus far.
+C  * Consider inlining mpn_add_n.
+C  * Single basecases out before the pushes.
+
+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')   C rcx
+define(`up',          `%rsi')   C rdx
+define(`mp_param',    `%rdx')   C r8
+define(`n',           `%rcx')   C r9
+define(`u0inv',       `%r8')    C stack
+
+define(`i',           `%r14')
+define(`j',           `%r15')
+define(`mp',          `%r12')
+define(`q0',          `%r13')
+define(`w0',          `%rbp')
+define(`w1',          `%r9')
+define(`w2',          `%r10')
+define(`w3',          `%r11')
+
+C rax rbx rcx rdx rdi rsi rbp r8 r9 r10 r11 r12 r13 r14 r15
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+define(`ALIGNx', `ALIGN(16)')
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_redc_1)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8   ')
+       push    %rbx
+       push    %rbp
+       push    %r12
+       push    %r13
+       push    %r14
+       push    %r15
+
+       mov     (up), q0
+       mov     n, j                    C outer loop induction var
+       lea     (mp_param,n,8), mp
+       lea     (up,n,8), up
+       neg     n
+       imul    u0inv, q0               C first iteration q0
+
+       test    $1, R8(n)
+       jz      L(bx0)
+
+L(bx1):        test    $2, R8(n)
+       jz      L(b3)
+
+L(b1): cmp     $-1, R32(n)
+       jz      L(n1)
+
+L(otp1):lea    1(n), i
+       mov     (mp,n,8), %rax
+       mul     q0
+       mov     %rax, w2
+       mov     %rdx, w3
+       mov     8(mp,n,8), %rax
+       mul     q0
+       mov     %rax, %rbx
+       mov     %rdx, w1
+       add     (up,n,8), w2
+       adc     w3, %rbx
+       adc     $0, w1
+       mov     16(mp,n,8), %rax
+       mul     q0
+       mov     %rax, w2
+       mov     %rdx, w3
+       add     8(up,n,8), %rbx
+       mov     %rbx, 8(up,n,8)
+       adc     w1, w2
+       adc     $0, w3
+       imul    u0inv, %rbx             C next q limb
+       jmp     L(e1)
+
+       ALIGNx
+L(tp1):        add     w0, -16(up,i,8)
+       adc     w1, w2
+       adc     $0, w3
+       mov     (mp,i,8), %rax
+       mul     q0
+       mov     %rax, w0
+       mov     %rdx, w1
+       add     w2, -8(up,i,8)
+       adc     w3, w0
+       adc     $0, w1
+       mov     8(mp,i,8), %rax
+       mul     q0
+       mov     %rax, w2
+       mov     %rdx, w3
+       add     w0, (up,i,8)
+       adc     w1, w2
+       adc     $0, w3
+L(e1): mov     16(mp,i,8), %rax
+       mul     q0
+       mov     %rax, w0
+       mov     %rdx, w1
+       add     w2, 8(up,i,8)
+       adc     w3, w0
+       adc     $0, w1
+       mov     24(mp,i,8), %rax
+       mul     q0
+       mov     %rax, w2
+       mov     %rdx, w3
+       add     $4, i
+       js      L(tp1)
+
+L(ed1):        add     w0, I(-16(up),-16(up,i,8))
+       adc     w1, w2
+       adc     $0, w3
+       add     w2, I(-8(up),-8(up,i,8))
+       adc     $0, w3
+       mov     w3, (up,n,8)            C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp1)
+       jmp     L(cj)
+
+L(b3): cmp     $-3, R32(n)
+       jz      L(n3)
+
+L(otp3):lea    3(n), i
+       mov     (mp,n,8), %rax
+       mul     q0
+       mov     %rax, w2
+       mov     %rdx, w3
+       mov     8(mp,n,8), %rax
+       mul     q0
+       mov     %rax, %rbx
+       mov     %rdx, w1
+       add     (up,n,8), w2
+       adc     w3, %rbx
+       adc     $0, w1
+       mov     16(mp,n,8), %rax
+       mul     q0
+       mov     %rax, w2
+       mov     %rdx, w3
+       add     8(up,n,8), %rbx
+       mov     %rbx, 8(up,n,8)
+       adc     w1, w2
+       adc     $0, w3
+       imul    u0inv, %rbx             C next q limb
+       jmp     L(e3)
+
+       ALIGNx
+L(tp3):        add     w0, -16(up,i,8)
+       adc     w1, w2
+       adc     $0, w3
+L(e3): mov     (mp,i,8), %rax
+       mul     q0
+       mov     %rax, w0
+       mov     %rdx, w1
+       add     w2, -8(up,i,8)
+       adc     w3, w0
+       adc     $0, w1
+       mov     8(mp,i,8), %rax
+       mul     q0
+       mov     %rax, w2
+       mov     %rdx, w3
+       add     w0, (up,i,8)
+       adc     w1, w2
+       adc     $0, w3
+       mov     16(mp,i,8), %rax
+       mul     q0
+       mov     %rax, w0
+       mov     %rdx, w1
+       add     w2, 8(up,i,8)
+       adc     w3, w0
+       adc     $0, w1
+       mov     24(mp,i,8), %rax
+       mul     q0
+       mov     %rax, w2
+       mov     %rdx, w3
+       add     $4, i
+       js      L(tp3)
+
+L(ed3):        add     w0, I(-16(up),-16(up,i,8))
+       adc     w1, w2
+       adc     $0, w3
+       add     w2, I(-8(up),-8(up,i,8))
+       adc     $0, w3
+       mov     w3, (up,n,8)            C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp3)
+C      jmp     L(cj)
+
+L(cj):
+IFSTD(`        lea     (up,n,8), up            C param 2: up
+       lea     (up,n,8), %rdx          C param 3: up - n
+       neg     R32(n)          ')      C param 4: n
+
+IFDOS(`        lea     (up,n,8), %rdx          C param 2: up
+       lea     (%rdx,n,8), %r8         C param 3: up - n
+       neg     R32(n)
+       mov     n, %r9                  C param 4: n
+       mov     rp, %rcx        ')      C param 1: rp
+
+       CALL(   mpn_add_n)
+
+L(ret):        pop     %r15
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+L(bx0):        test    $2, R8(n)
+       jnz     L(b2)
+
+L(b0):
+L(otp0):lea    (n), i
+       mov     (mp,n,8), %rax
+       mul     q0
+       mov     %rax, w0
+       mov     %rdx, w1
+       mov     8(mp,n,8), %rax
+       mul     q0
+       mov     %rax, %rbx
+       mov     %rdx, w3
+       add     (up,n,8), w0
+       adc     w1, %rbx
+       adc     $0, w3
+       mov     16(mp,n,8), %rax
+       mul     q0
+       mov     %rax, w0
+       mov     %rdx, w1
+       add     8(up,n,8), %rbx
+       mov     %rbx, 8(up,n,8)
+       adc     w3, w0
+       adc     $0, w1
+       imul    u0inv, %rbx             C next q limb
+       jmp     L(e0)
+
+       ALIGNx
+L(tp0):        add     w0, -16(up,i,8)
+       adc     w1, w2
+       adc     $0, w3
+       mov     (mp,i,8), %rax
+       mul     q0
+       mov     %rax, w0
+       mov     %rdx, w1
+       add     w2, -8(up,i,8)
+       adc     w3, w0
+       adc     $0, w1
+       mov     8(mp,i,8), %rax
+       mul     q0
+       mov     %rax, w2
+       mov     %rdx, w3
+       add     w0, (up,i,8)
+       adc     w1, w2
+       adc     $0, w3
+       mov     16(mp,i,8), %rax
+       mul     q0
+       mov     %rax, w0
+       mov     %rdx, w1
+       add     w2, 8(up,i,8)
+       adc     w3, w0
+       adc     $0, w1
+L(e0): mov     24(mp,i,8), %rax
+       mul     q0
+       mov     %rax, w2
+       mov     %rdx, w3
+       add     $4, i
+       js      L(tp0)
+
+L(ed0):        add     w0, I(-16(up),-16(up,i,8))
+       adc     w1, w2
+       adc     $0, w3
+       add     w2, I(-8(up),-8(up,i,8))
+       adc     $0, w3
+       mov     w3, (up,n,8)            C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp0)
+       jmp     L(cj)
+
+L(b2): cmp     $-2, R32(n)
+       jz      L(n2)
+
+L(otp2):lea    2(n), i
+       mov     (mp,n,8), %rax
+       mul     q0
+       mov     %rax, w0
+       mov     %rdx, w1
+       mov     8(mp,n,8), %rax
+       mul     q0
+       mov     %rax, %rbx
+       mov     %rdx, w3
+       add     (up,n,8), w0
+       adc     w1, %rbx
+       adc     $0, w3
+       mov     16(mp,n,8), %rax
+       mul     q0
+       mov     %rax, w0
+       mov     %rdx, w1
+       add     8(up,n,8), %rbx
+       mov     %rbx, 8(up,n,8)
+       adc     w3, w0
+       adc     $0, w1
+       imul    u0inv, %rbx             C next q limb
+       jmp     L(e2)
+
+       ALIGNx
+L(tp2):        add     w0, -16(up,i,8)
+       adc     w1, w2
+       adc     $0, w3
+       mov     (mp,i,8), %rax
+       mul     q0
+       mov     %rax, w0
+       mov     %rdx, w1
+       add     w2, -8(up,i,8)
+       adc     w3, w0
+       adc     $0, w1
+L(e2): mov     8(mp,i,8), %rax
+       mul     q0
+       mov     %rax, w2
+       mov     %rdx, w3
+       add     w0, (up,i,8)
+       adc     w1, w2
+       adc     $0, w3
+       mov     16(mp,i,8), %rax
+       mul     q0
+       mov     %rax, w0
+       mov     %rdx, w1
+       add     w2, 8(up,i,8)
+       adc     w3, w0
+       adc     $0, w1
+       mov     24(mp,i,8), %rax
+       mul     q0
+       mov     %rax, w2
+       mov     %rdx, w3
+       add     $4, i
+       js      L(tp2)
+
+L(ed2):        add     w0, I(-16(up),-16(up,i,8))
+       adc     w1, w2
+       adc     $0, w3
+       add     w2, I(-8(up),-8(up,i,8))
+       adc     $0, w3
+       mov     w3, (up,n,8)            C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp2)
+       jmp     L(cj)
+
+L(n1): mov     (mp_param), %rax
+       mul     q0
+       add     -8(up), %rax
+       adc     (up), %rdx
+       mov     %rdx, (rp)
+       mov     $0, R32(%rax)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+
+L(n2): mov     (mp_param), %rax
+       mov     -16(up), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     %rdx, %r9
+       adc     $0, %r9
+       mov     -8(mp), %rax
+       mov     -8(up), %r10
+       mul     q0
+       add     %rax, %r10
+       mov     %rdx, %r11
+       adc     $0, %r11
+       add     %r9, %r10
+       adc     $0, %r11
+       mov     %r10, q0
+       imul    u0inv, q0               C next q0
+       mov     -16(mp), %rax
+       mul     q0
+       add     %rax, %r10
+       mov     %rdx, %r9
+       adc     $0, %r9
+       mov     -8(mp), %rax
+       mov     (up), %r14
+       mul     q0
+       add     %rax, %r14
+       adc     $0, %rdx
+       add     %r9, %r14
+       adc     $0, %rdx
+       xor     R32(%rax), R32(%rax)
+       add     %r11, %r14
+       adc     8(up), %rdx
+       mov     %r14, (rp)
+       mov     %rdx, 8(rp)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+
+       ALIGNx
+L(n3): mov     -24(mp), %rax
+       mov     -24(up), %r10
+       mul     q0
+       add     %rax, %r10
+       mov     -16(mp), %rax
+       mov     %rdx, %r11
+       adc     $0, %r11
+       mov     -16(up), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     %rdx, %r9
+       adc     $0, %r9
+       mov     -8(mp), %rax
+       add     %r11, %rbp
+       mov     -8(up), %r10
+       adc     $0, %r9
+       mul     q0
+       mov     %rbp, q0
+       imul    u0inv, q0               C next q0
+       add     %rax, %r10
+       mov     %rdx, %r11
+       adc     $0, %r11
+       mov     %rbp, -16(up)
+       add     %r9, %r10
+       adc     $0, %r11
+       mov     %r10, -8(up)
+       mov     %r11, -24(up)           C up[0]
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(n3)
+
+       mov     -48(up), %rdx
+       mov     -40(up), %rbx
+       xor     R32(%rax), R32(%rax)
+       add     %rbp, %rdx
+       adc     %r10, %rbx
+       adc     -8(up), %r11
+       mov     %rdx, (rp)
+       mov     %rbx, 8(rp)
+       mov     %r11, 16(rp)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+EPILOGUE()
+ASM_END()
index 248ec70179589fdd9425c948dae050843ae59868..0e417a1ebeb058e189a9a7e2cb0a22e9f25c3e4c 100644 (file)
@@ -1,22 +1,32 @@
 dnl  AMD64 mpn_sqr_basecase optimised for AMD bobcat.
 
-dnl  Copyright 2003, 2004, 2005, 2007, 2008, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2003-2005, 2007, 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/cnd_aors_n.asm b/mpn/x86_64/cnd_aors_n.asm
new file mode 100644 (file)
index 0000000..13a2ab3
--- /dev/null
@@ -0,0 +1,183 @@
+dnl  AMD64 mpn_cnd_add_n, mpn_cnd_sub_n
+
+dnl  Copyright 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')
+
+C           cycles/limb
+C AMD K8,K9     2
+C AMD K10       2
+C AMD bd1       2.32
+C AMD bobcat    3
+C Intel P4     13
+C Intel core2   2.9
+C Intel NHM     2.8
+C Intel SBR     2.4
+C Intel atom    5.33
+C VIA nano      3
+
+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  * Two cases could be optimised: (1) cnd_add_n could use ADCSBB-from-memory
+C    to save one insn/limb, and (2) when up=rp cnd_add_n and cnd_sub_n could use
+C    ADCSBB-to-memory, again saving 1 insn/limb.
+C  * This runs optimally at decoder bandwidth on K10.  It has not been tuned
+C    for any other processor.
+
+C INPUT PARAMETERS
+define(`cnd',  `%rdi') dnl rcx
+define(`rp',   `%rsi') dnl rdx
+define(`up',   `%rdx') dnl r8
+define(`vp',   `%rcx') dnl r9
+define(`n',    `%r8')  dnl rsp+40
+
+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
+       push    %r14
+
+       neg     cnd
+       sbb     cnd, cnd                C make cnd mask
+
+       lea     (vp,n,8), vp
+       lea     (up,n,8), up
+       lea     (rp,n,8), rp
+
+       mov     R32(n), R32(%rax)
+       neg     n
+       and     $3, R32(%rax)
+       jz      L(top)                  C carry-save reg rax = 0 in this arc
+       cmp     $2, R32(%rax)
+       jc      L(b1)
+       jz      L(b2)
+
+L(b3): mov     (vp,n,8), %r12
+       mov     8(vp,n,8), %r13
+       mov     16(vp,n,8), %r14
+       and     cnd, %r12
+       mov     (up,n,8), %r10
+       and     cnd, %r13
+       mov     8(up,n,8), %rbx
+       and     cnd, %r14
+       mov     16(up,n,8), %rbp
+       ADDSUB  %r12, %r10
+       mov     %r10, (rp,n,8)
+       ADCSBB  %r13, %rbx
+       mov     %rbx, 8(rp,n,8)
+       ADCSBB  %r14, %rbp
+       mov     %rbp, 16(rp,n,8)
+       sbb     R32(%rax), R32(%rax)    C save carry
+       add     $3, n
+       js      L(top)
+       jmp     L(end)
+
+L(b2): mov     (vp,n,8), %r12
+       mov     8(vp,n,8), %r13
+       mov     (up,n,8), %r10
+       and     cnd, %r12
+       mov     8(up,n,8), %rbx
+       and     cnd, %r13
+       ADDSUB  %r12, %r10
+       mov     %r10, (rp,n,8)
+       ADCSBB  %r13, %rbx
+       mov     %rbx, 8(rp,n,8)
+       sbb     R32(%rax), R32(%rax)    C save carry
+       add     $2, n
+       js      L(top)
+       jmp     L(end)
+
+L(b1): mov     (vp,n,8), %r12
+       mov     (up,n,8), %r10
+       and     cnd, %r12
+       ADDSUB  %r12, %r10
+       mov     %r10, (rp,n,8)
+       sbb     R32(%rax), R32(%rax)    C save carry
+       add     $1, n
+       jns     L(end)
+
+       ALIGN(16)
+L(top):        mov     (vp,n,8), %r12
+       mov     8(vp,n,8), %r13
+       mov     16(vp,n,8), %r14
+       mov     24(vp,n,8), %r11
+       and     cnd, %r12
+       mov     (up,n,8), %r10
+       and     cnd, %r13
+       mov     8(up,n,8), %rbx
+       and     cnd, %r14
+       mov     16(up,n,8), %rbp
+       and     cnd, %r11
+       mov     24(up,n,8), %r9
+       add     R32(%rax), R32(%rax)    C restore carry
+       ADCSBB  %r12, %r10
+       mov     %r10, (rp,n,8)
+       ADCSBB  %r13, %rbx
+       mov     %rbx, 8(rp,n,8)
+       ADCSBB  %r14, %rbp
+       mov     %rbp, 16(rp,n,8)
+       ADCSBB  %r11, %r9
+       mov     %r9, 24(rp,n,8)
+       sbb     R32(%rax), R32(%rax)    C save carry
+       add     $4, n
+       js      L(top)
+
+L(end):        neg     R32(%rax)
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
index 9c018cd0862d8ee1dad6b628b98b9d3cd0cc96fa..006acaf64864ef42984a1b1c6e5b2cba73b350ff 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD64 mpn_com.
 
-dnl  Copyright 2004, 2005, 2006, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2004-2006, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 556933f2df6dbc23e916ab57d4807b2a51c7910c..a5e6e595e7d975eb51303c2529bccd5daca2b40b 100644 (file)
@@ -3,19 +3,30 @@ dnl  AMD64 mpn_copyd -- copy limb vector, decrementing.
 dnl  Copyright 2003, 2005, 2007, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 32f9e14c189c3621027dbdbbfdf48a0054d68bb0..bafce7a09eb1c3ce0e673e5c95c00d3bd77d9727 100644 (file)
@@ -3,19 +3,30 @@ dnl  AMD64 mpn_copyi -- copy limb vector, incrementing.
 dnl  Copyright 2003, 2005, 2007, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index a272eadaf2f6829d797c07b50bebae5e21a3498d..7066bb43720ad5f3775dda034080cc8d71a44795 100644 (file)
@@ -3,22 +3,33 @@ dnl  AMD64 mpn_rsblsh1_n -- rp[] = (vp[] << 1) - up[]
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d4e92ba9b9ab5cbc7172eb57254a3a132433d4b5..5065120857b8a1ecc45c2c181b56516e62377399 100644 (file)
@@ -3,22 +3,33 @@ dnl  AMD64 mpn_rsblsh2_n -- rp[] = (vp[] << 2) - up[]
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 4fc177fa09a5b78accbe8b47ea6d8a16b15a7138..57abf315796766355857f92ac39c77418fb6287d 100644 (file)
@@ -3,19 +3,30 @@ dnl  AMD64 mpn_addlsh_n and mpn_rsblsh_n.  R = V2^k +- U.
 dnl  Copyright 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 6ebb2cfd28da8eb84fd4307c1968e4253a705df6..3f875aefa42ecda8f50da5caf91b2531d27c0bb9 100644 (file)
@@ -5,19 +5,30 @@ dnl  Contributed by David Harvey.
 dnl  Copyright 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -90,20 +101,20 @@ L(3mod4):
        lea     -24(yp,n,8), yp
        neg     n
 
-        shr     $1, %al            C restore carry
-        mov     (up,n,8), w0
-        mov     8(up,n,8), w1
-        ADCSBB  (vp,n,8), w0
+       shr     $1, %al            C restore carry
+       mov     (up,n,8), w0
+       mov     8(up,n,8), w1
+       ADCSBB  (vp,n,8), w0
        mov     w0, (rp,n,8)
        cmovc   16(yp), el
-        ADCSBB  8(vp,n,8), w1
+       ADCSBB  8(vp,n,8), w1
        mov     w1, 8(rp,n,8)
        cmovc   8(yp), t0
-        mov     16(up,n,8), w0
-        ADCSBB  16(vp,n,8), w0
+       mov     16(up,n,8), w0
+       ADCSBB  16(vp,n,8), w0
        mov     w0, 16(rp,n,8)
        cmovc   (yp), t1
-       setc    %al                C save carry
+       setc    %al                C save carry
        add     t0, el
        adc     $0, eh
        add     t1, el
@@ -128,12 +139,12 @@ L(1mod4):
        lea     -8(yp,n,8), yp
        neg     n
 
-        shr     $1, %al            C restore carry
-        mov     (up,n,8), w0
-        ADCSBB  (vp,n,8), w0
-        mov     w0, (rp,n,8)
+       shr     $1, %al            C restore carry
+       mov     (up,n,8), w0
+       ADCSBB  (vp,n,8), w0
+       mov     w0, (rp,n,8)
        cmovc   (yp), el
-       setc    %al                C save carry
+       setc    %al                C save carry
 
        add     $1, n
        jnz     L(loop)
@@ -147,16 +158,16 @@ L(2mod4):
        lea     -16(yp,n,8), yp
        neg     n
 
-        shr     $1, %al            C restore carry
-        mov     (up,n,8), w0
-        mov     8(up,n,8), w1
-        ADCSBB  (vp,n,8), w0
-        mov     w0, (rp,n,8)
+       shr     $1, %al            C restore carry
+       mov     (up,n,8), w0
+       mov     8(up,n,8), w1
+       ADCSBB  (vp,n,8), w0
+       mov     w0, (rp,n,8)
        cmovc   8(yp), el
-        ADCSBB  8(vp,n,8), w1
-        mov     w1, 8(rp,n,8)
+       ADCSBB  8(vp,n,8), w1
+       mov     w1, 8(rp,n,8)
        cmovc   (yp), t0
-       setc    %al                C save carry
+       setc    %al                C save carry
        add     t0, el
        adc     $0, eh
 
@@ -166,39 +177,39 @@ L(2mod4):
 
        ALIGN(32)
 L(loop):
-        mov     (up,n,8), w0
-        shr     $1, %al            C restore carry
-        mov     -8(yp), t0
+       mov     (up,n,8), w0
+       shr     $1, %al            C restore carry
+       mov     -8(yp), t0
        mov     $0, R32(t3)
-        ADCSBB  (vp,n,8), w0
-        cmovnc  t3, t0
-        mov     w0, (rp,n,8)
-        mov     8(up,n,8), w1
-        mov     16(up,n,8), w0
-        ADCSBB  8(vp,n,8), w1
-        mov     -16(yp), t1
-        cmovnc  t3, t1
-        mov     -24(yp), t2
-        mov     w1, 8(rp,n,8)
-        ADCSBB  16(vp,n,8), w0
-        cmovnc  t3, t2
-        mov     24(up,n,8), w1
-        ADCSBB  24(vp,n,8), w1
-        cmovc   -32(yp), t3
-       setc    %al                C save carry
-        add     t0, el
-        adc     $0, eh
-        add     t1, el
-        adc     $0, eh
-        add     t2, el
-        adc     $0, eh
-        lea     -32(yp), yp
-        mov     w0, 16(rp,n,8)
-        add     t3, el
-        adc     $0, eh
-        add     $4, n
-        mov     w1, -8(rp,n,8)
-       jnz     L(loop)
+       ADCSBB  (vp,n,8), w0
+       cmovnc  t3, t0
+       mov     w0, (rp,n,8)
+       mov     8(up,n,8), w1
+       mov     16(up,n,8), w0
+       ADCSBB  8(vp,n,8), w1
+       mov     -16(yp), t1
+       cmovnc  t3, t1
+       mov     -24(yp), t2
+       mov     w1, 8(rp,n,8)
+       ADCSBB  16(vp,n,8), w0
+       cmovnc  t3, t2
+       mov     24(up,n,8), w1
+       ADCSBB  24(vp,n,8), w1
+       cmovc   -32(yp), t3
+       setc    %al                C save carry
+       add     t0, el
+       adc     $0, eh
+       add     t1, el
+       adc     $0, eh
+       add     t2, el
+       adc     $0, eh
+       lea     -32(yp), yp
+       mov     w0, 16(rp,n,8)
+       add     t3, el
+       adc     $0, eh
+       add     $4, n
+       mov     w1, -8(rp,n,8)
+       jnz     L(loop)
 
 L(end):
        mov     el, (ep)
index 020b880b40028c087866d72216055d2d4de8899d..74a1bce48a2d3957c2d0aa0bad11add162cff875 100644 (file)
@@ -1,34 +1,45 @@
-dnl  Intel P6-15 mpn_add_n/mpn_sub_n -- mpn add or subtract.
+dnl  Intel mpn_add_n/mpn_sub_n optimised for Conroe, Nehalem.
 
-dnl  Copyright 2006, 2007, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2006, 2007, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 
 C           cycles/limb
-C AMD K8,K9     2.25
+C AMD K8,K9     2
 C AMD K10       2
 C Intel P4     10
-C Intel core2   2.05
-C Intel NHM     2.3
-C Intel SBR     1.9
-C Intel atom    ?
-C VIA nano      ?
+C Intel core2   2
+C Intel NHM     2
+C Intel SBR     2
+C Intel atom    9
+C VIA nano      3
 
 C INPUT PARAMETERS
 define(`rp',   `%rdi')
@@ -54,12 +65,6 @@ ABI_SUPPORT(STD64)
 ASM_START()
        TEXT
        ALIGN(16)
-PROLOGUE(func_nc)
-       FUNC_ENTRY(4)
-IFDOS(`        mov     56(%rsp), %r8   ')
-       jmp     L(start)
-EPILOGUE()
-
 PROLOGUE(func)
        FUNC_ENTRY(4)
        xor     %r8, %r8
@@ -67,10 +72,10 @@ L(start):
        mov     (up), %r10
        mov     (vp), %r11
 
-       lea     -8(up,n,8), up
-       lea     -8(vp,n,8), vp
-       lea     -16(rp,n,8), rp
-       mov     R32(%rcx), R32(%rax)
+       lea     (up,n,8), up
+       lea     (vp,n,8), vp
+       lea     (rp,n,8), rp
+       mov     R32(n), R32(%rax)
        neg     n
        and     $3, R32(%rax)
        je      L(b00)
@@ -79,54 +84,58 @@ L(start):
        jl      L(b01)
        je      L(b10)
 
-L(b11):        shr     %r8                     C set cy
+L(b11):        neg     %r8                     C set cy
        jmp     L(e11)
 
-L(b00):        shr     %r8                     C set cy
+L(b00):        neg     %r8                     C set cy
        mov     %r10, %r8
        mov     %r11, %r9
        lea     4(n), n
        jmp     L(e00)
 
-L(b01):        shr     %r8                     C set cy
-       jmp     L(e01)
+       nop
+       nop
+       nop
+L(b01):        neg     %r8                     C set cy
+       jmp     L(top)
 
-L(b10):        shr     %r8                     C set cy
+L(b10):        neg     %r8                     C set cy
        mov     %r10, %r8
        mov     %r11, %r9
        jmp     L(e10)
 
 L(end):        ADCSBB  %r11, %r10
-       mov     %r10, 8(rp)
+       mov     %r10, -8(rp)
        mov     R32(%rcx), R32(%rax)    C clear eax, ecx contains 0
        adc     R32(%rax), R32(%rax)
        FUNC_EXIT()
        ret
 
        ALIGN(16)
-L(top):
-       mov     -24(up,n,8), %r8
-       mov     -24(vp,n,8), %r9
+L(top):        jrcxz   L(end)
+       mov     (up,n,8), %r8
+       mov     (vp,n,8), %r9
+       lea     4(n), n
        ADCSBB  %r11, %r10
-       mov     %r10, -24(rp,n,8)
-L(e00):
-       mov     -16(up,n,8), %r10
-       mov     -16(vp,n,8), %r11
+       mov     %r10, -40(rp,n,8)
+L(e00):        mov     -24(up,n,8), %r10
+       mov     -24(vp,n,8), %r11
        ADCSBB  %r9, %r8
-       mov     %r8, -16(rp,n,8)
-L(e11):
-       mov     -8(up,n,8), %r8
-       mov     -8(vp,n,8), %r9
+       mov     %r8, -32(rp,n,8)
+L(e11):        mov     -16(up,n,8), %r8
+       mov     -16(vp,n,8), %r9
        ADCSBB  %r11, %r10
-       mov     %r10, -8(rp,n,8)
-L(e10):
-       mov     (up,n,8), %r10
-       mov     (vp,n,8), %r11
+       mov     %r10, -24(rp,n,8)
+L(e10):        mov     -8(up,n,8), %r10
+       mov     -8(vp,n,8), %r11
        ADCSBB  %r9, %r8
-       mov     %r8, (rp,n,8)
-L(e01):
-       jrcxz   L(end)
-       lea     4(n), n
+       mov     %r8, -16(rp,n,8)
        jmp     L(top)
+EPILOGUE()
 
+PROLOGUE(func_nc)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8   ')
+       jmp     L(start)
 EPILOGUE()
+
index 4f889cfe91ef62ac03508d1ae123072355d27fe1..6b313dd836e2c16f24a15dfe799ac16b8c0e7e0d 100644 (file)
@@ -1,22 +1,32 @@
 dnl  x86-64 mpn_addmul_1 and mpn_submul_1, optimized for "Core 2".
 
-dnl  Copyright 2003, 2004, 2005, 2007, 2008, 2009, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2003-2005, 2007-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 6c6e9db79a6a5c80d1c7f95923a44b2d34853317..f0dc54a55e772b7d9ed594af64f5ef499bd92814 100644 (file)
@@ -3,19 +3,30 @@ dnl  X86-64 mpn_copyd optimised for Intel Sandy Bridge.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 47144498cc41853f43843c0679d51406688b3ca5..9c26e00c522afcb9a89104da43145a3f2c737fde 100644 (file)
@@ -3,19 +3,30 @@ dnl  X86-64 mpn_copyi optimised for Intel Sandy Bridge.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d5d2ad8c291d5c2d0d0c9bcf8d13656cdd371a61..623bea386ca77633ec312182ec582e2639fe0ee7 100644 (file)
@@ -1,22 +1,32 @@
 dnl  x86-64 mpn_divrem_1 -- mpn by limb division.
 
-dnl  Copyright 2004, 2005, 2007, 2008, 2009, 2010, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2004, 2005, 2007-2010, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 21165552388e50eee9d9c9751bf399ddc2481f14..e0cab9b4e45e17a19e15fd8887318ca52146bdcc 100644 (file)
@@ -3,23 +3,33 @@ 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, 2001, 2002, 2005, 2009, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index f5593ea4165eaff7387793b9485f1c3d7facfe65..0f4f88f78074374192f077999bd48125feb1c562 100644 (file)
 /* Core 2 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2010, 2012, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 /* 2133 MHz Core 2 (65nm) */
+/* FFT tuning limit = 60000000 */
+/* Generated by tuneup.c, 2014-03-13, 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          3
-#define MOD_1U_TO_MOD_1_1_THRESHOLD          2
+#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        11
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD        15
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD      6
+#define MOD_1_2_TO_MOD_1_4_THRESHOLD        16
+#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           23
+#define BMOD_1_TO_MOD_1_THRESHOLD           24
 
 #define MUL_TOOM22_THRESHOLD                23
 #define MUL_TOOM33_THRESHOLD                65
-#define MUL_TOOM44_THRESHOLD               106
-#define MUL_TOOM6H_THRESHOLD               224
-#define MUL_TOOM8H_THRESHOLD                 0  /* always */
+#define MUL_TOOM44_THRESHOLD               179
+#define MUL_TOOM6H_THRESHOLD               268
+#define MUL_TOOM8H_THRESHOLD               357
 
 #define MUL_TOOM32_TO_TOOM43_THRESHOLD      69
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD      76
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD     114
 #define MUL_TOOM42_TO_TOOM53_THRESHOLD      73
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD      72
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD      78
 #define MUL_TOOM43_TO_TOOM54_THRESHOLD     100
 
 #define SQR_BASECASE_THRESHOLD               0  /* always (native) */
 #define SQR_TOOM2_THRESHOLD                 28
-#define SQR_TOOM3_THRESHOLD                101
-#define SQR_TOOM4_THRESHOLD                148
-#define SQR_TOOM6_THRESHOLD                206
+#define SQR_TOOM3_THRESHOLD                102
+#define SQR_TOOM4_THRESHOLD                160
+#define SQR_TOOM6_THRESHOLD                222
 #define SQR_TOOM8_THRESHOLD                296
 
-#define MULMID_TOOM42_THRESHOLD             24
+#define MULMID_TOOM42_THRESHOLD             28
 
-#define MULMOD_BNM1_THRESHOLD               18
-#define SQRMOD_BNM1_THRESHOLD               17
+#define MULMOD_BNM1_THRESHOLD               12
+#define SQRMOD_BNM1_THRESHOLD               13
 
-#define MUL_FFT_MODF_THRESHOLD             380  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             372  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    380, 5}, {     15, 6}, {      8, 5}, {     17, 6}, \
-    {      9, 5}, {     19, 6}, {     19, 7}, {     10, 6}, \
-    {     21, 7}, {     11, 6}, {     23, 7}, {     13, 6}, \
-    {     27, 7}, {     21, 8}, {     11, 7}, {     23, 8}, \
-    {     13, 7}, {     27, 8}, {     15, 7}, {     31, 8}, \
-    {     17, 7}, {     35, 8}, {     19, 7}, {     39, 8}, \
+  { {    372, 5}, {     17, 6}, {      9, 5}, {     19, 6}, \
+    {     21, 7}, {     11, 6}, {     23, 7}, {     12, 6}, \
+    {     25, 7}, {     21, 8}, {     11, 7}, {     25, 8}, \
+    {     13, 7}, {     27, 8}, {     15, 7}, {     32, 8}, \
+    {     17, 7}, {     36, 8}, {     19, 7}, {     40, 8}, \
     {     21, 9}, {     11, 8}, {     27, 9}, {     15, 8}, \
     {     35, 9}, {     19, 8}, {     41, 9}, {     23, 8}, \
     {     47, 9}, {     27,10}, {     15, 9}, {     43,10}, \
-    {     23, 9}, {     55,11}, {     15,10}, {     31, 9}, \
-    {     67,10}, {     39, 9}, {     79,10}, {     55,11}, \
-    {     31, 9}, {    127,10}, {     71, 8}, {    287,10}, \
-    {     79,11}, {     47,12}, {     31,11}, {     63, 9}, \
-    {    255,10}, {    135, 9}, {    271,11}, {     79, 9}, \
-    {    319,10}, {    175,11}, {     95,10}, {    191, 9}, \
-    {    383,11}, {    111,12}, {     63,11}, {    127,10}, \
-    {    271, 9}, {    543,11}, {    143,10}, {    287,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}, \
-    {    271,10}, {    543,11}, {    287,12}, {    159,11}, \
-    {    319,10}, {    671,11}, {    351,12}, {    191,11}, \
-    {    415,12}, {    223,11}, {    447,10}, {    895,11}, \
-    {    479,13}, {    127,12}, {    287,11}, {    607,12}, \
-    {    319,11}, {    671,12}, {    351,13}, {    191,12}, \
-    {    415,11}, {    831,10}, {   1663,12}, {    479,14}, \
-    {    127,13}, {    255,12}, {    543,11}, {   1087,12}, \
-    {    607,13}, {    319,12}, {    703,13}, {    383,12}, \
-    {    767,10}, {   3071,12}, {    831,13}, {    447,12}, \
-    {    959,14}, {    255,13}, {    511,12}, {   1023,13}, \
-    {    575,12}, {   1151,11}, {   2303,13}, {    639,12}, \
-    {   1343,13}, {    703,14}, {    383,13}, {    831,12}, \
-    {   1727,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}, {   1663,14}, {    895,13}, {   1919,15}, \
-    {    511,14}, {   1023,13}, {   2175,14}, {   1151,13}, \
-    {   2431,12}, {   4863,13}, {   2495,14}, {   1279,13}, \
-    {   2687,14}, {   1407,15}, {    767,14}, {   1663,13}, \
-    {   3327,12}, {   6655,13}, {   3455,12}, {   6911,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 170
+    {     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, 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,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,10}, {    607,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,11}, \
+    {    703,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}, {    895,15}, {    255,14}, {    511,13}, \
+    {   1151,14}, {    639,13}, {   1343,14}, {    767,13}, \
+    {   1599,14}, {    895,15}, {    511,14}, {   1279,13}, \
+    {   2687,14}, {   1407,13}, {   2815,15}, {    767,14}, \
+    {   1535,13}, {   3199,14}, {   1663,13}, {   3455,16}, \
+    {    511,15}, {   1023,14}, {   2047,13}, {   4095,14}, \
+    {   2175,12}, {   8959,14}, {   2303,13}, {   4607,12}, \
+    {   9471,14}, {   2431,13}, {   4863,12}, {   9983,15}, \
+    {   1279,14}, {   2559,12}, {  10239,14}, {   2687,12}, \
+    {  11775,15}, {   1535,14}, {   3327,13}, {   6655,14}, \
+    {   3455,13}, {   6911,14}, {   3583,12}, {  14335,11}, \
+    {  28671,10}, {  57343,11}, {   2048,12}, {   4096,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 183
 #define MUL_FFT_THRESHOLD                 4736
 
-#define SQR_FFT_MODF_THRESHOLD             308  /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD             340  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    308, 5}, {     17, 6}, {      9, 5}, {     19, 6}, \
-    {     21, 7}, {     11, 6}, {     23, 7}, {     12, 6}, \
-    {     25, 7}, {     21, 8}, {     11, 7}, {     24, 8}, \
+  { {    340, 5}, {     15, 6}, {      8, 5}, {     17, 6}, \
+    {      9, 5}, {     19, 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}, \
-    {     47, 9}, {     27,10}, {     15, 9}, {     39,10}, \
-    {     23, 9}, {     59,11}, {     15,10}, {     31, 8}, \
-    {    125, 9}, {     67,10}, {     39, 9}, {     79,10}, \
-    {     47, 9}, {    103,10}, {     79, 9}, {    159,10}, \
-    {     87, 9}, {    175, 8}, {    351,11}, {     47,10}, \
-    {     95,11}, {     63,10}, {    127, 8}, {    511, 9}, \
-    {    271, 8}, {    543,11}, {     79,10}, {    175,11}, \
-    {     95,10}, {    191, 9}, {    415,12}, {     63,11}, \
-    {    127,10}, {    255,11}, {    143,10}, {    287, 9}, \
-    {    575,11}, {    159,10}, {    319,11}, {    175,10}, \
-    {    351,12}, {     95,11}, {    191,10}, {    383,11}, \
+    {     33, 9}, {     19, 8}, {     41, 9}, {     23, 8}, \
+    {     47, 9}, {     27,10}, {     15, 9}, {     43,10}, \
+    {     23, 9}, {     55,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, 9}, \
+    {    271, 8}, {    543,11}, {     79, 9}, {    319, 8}, \
+    {    639,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}, \
-    {    255,10}, {    511, 9}, {   1023,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}, {    479,13}, {    127,12}, {    255,11}, \
-    {    543,12}, {    287,11}, {    575,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}, \
-    {    639,11}, {   1279,12}, {    703,13}, {    383,12}, \
-    {    831,13}, {    447,12}, {    959,14}, {    255,13}, \
-    {    511,12}, {   1087,13}, {    575,12}, {   1215,13}, \
-    {    639,12}, {   1279,13}, {    703,14}, {    383,13}, \
-    {    767,12}, {   1535,13}, {    831,12}, {   1663,13}, \
+    {    271,10}, {    543,11}, {    287,10}, {    575,11}, \
+    {    303,10}, {    607,11}, {    319,10}, {    639,11}, \
+    {    351,12}, {    191,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}, {    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}, {   1087,12}, \
     {   2175,13}, {   1215,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}, {   2303,12}, {   4607,13}, {   2431,12}, \
-    {   4863,14}, {   1279,13}, {   2687,14}, {   1407,13}, \
-    {   2815,15}, {    767,14}, {   1535,13}, {   3071,14}, \
-    {   1663,13}, {   3327,12}, {   6655,13}, {   3455,12}, \
-    {   6911,14}, {   1791,16}, {  65536,17}, { 131072,18}, \
-    { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
-    {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 178
-#define SQR_FFT_THRESHOLD                 3520
+    {   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}, {   3071,14}, \
+    {   1663,13}, {   3455,12}, {   6911,14}, {   1791,13}, \
+    {   3583,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}, {   3455,13}, \
+    {   6911,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 179
+#define SQR_FFT_THRESHOLD                 3008
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
-#define MULLO_DC_THRESHOLD                  55
+#define MULLO_DC_THRESHOLD                  62
 #define MULLO_MUL_N_THRESHOLD             9174
 
-#define DC_DIV_QR_THRESHOLD                 54
-#define DC_DIVAPPR_Q_THRESHOLD             179
-#define DC_BDIV_QR_THRESHOLD                53
-#define DC_BDIV_Q_THRESHOLD                125
+#define DC_DIV_QR_THRESHOLD                 46
+#define DC_DIVAPPR_Q_THRESHOLD             155
+#define DC_BDIV_QR_THRESHOLD                50
+#define DC_BDIV_Q_THRESHOLD                 94
 
-#define INV_MULMOD_BNM1_THRESHOLD           62
-#define INV_NEWTON_THRESHOLD               173
-#define INV_APPR_THRESHOLD                 172
+#define INV_MULMOD_BNM1_THRESHOLD           48
+#define INV_NEWTON_THRESHOLD               156
+#define INV_APPR_THRESHOLD                 155
 
-#define BINV_NEWTON_THRESHOLD              230
-#define REDC_1_TO_REDC_2_THRESHOLD          10
-#define REDC_2_TO_REDC_N_THRESHOLD          63
+#define BINV_NEWTON_THRESHOLD              234
+#define REDC_1_TO_REDC_2_THRESHOLD          22
+#define REDC_2_TO_REDC_N_THRESHOLD          48
 
-#define MU_DIV_QR_THRESHOLD               1334
-#define MU_DIVAPPR_Q_THRESHOLD            1210
-#define MUPI_DIV_QR_THRESHOLD               79
-#define MU_BDIV_QR_THRESHOLD              1057
+#define MU_DIV_QR_THRESHOLD               1187
+#define MU_DIVAPPR_Q_THRESHOLD            1142
+#define MUPI_DIV_QR_THRESHOLD               74
+#define MU_BDIV_QR_THRESHOLD              1017
 #define MU_BDIV_Q_THRESHOLD               1187
 
-#define POWM_SEC_TABLE  2,65,322,780
-
+#define POWM_SEC_TABLE  1,64,131,269,466
 
-#define MATRIX22_STRASSEN_THRESHOLD         17
-#define HGCD_THRESHOLD                     135
-#define HGCD_APPR_THRESHOLD                178
+#define MATRIX22_STRASSEN_THRESHOLD         19
+#define HGCD_THRESHOLD                     117
+#define HGCD_APPR_THRESHOLD                151
 #define HGCD_REDUCE_THRESHOLD             2121
-#define GCD_DC_THRESHOLD                   416
-#define GCDEXT_DC_THRESHOLD                361
+#define GCD_DC_THRESHOLD                   427
+#define GCDEXT_DC_THRESHOLD                342
 #define JACOBI_BASE_METHOD                   4
 
-#define GET_STR_DC_THRESHOLD                12
-#define GET_STR_PRECOMPUTE_THRESHOLD        21
+#define GET_STR_DC_THRESHOLD                11
+#define GET_STR_PRECOMPUTE_THRESHOLD        18
 #define SET_STR_DC_THRESHOLD               552
-#define SET_STR_PRECOMPUTE_THRESHOLD      1815
+#define SET_STR_PRECOMPUTE_THRESHOLD      1561
 
-#define FAC_DSC_THRESHOLD                  608
-#define FAC_ODD_THRESHOLD                   28
+#define FAC_DSC_THRESHOLD                  656
+#define FAC_ODD_THRESHOLD                   23
index f076eb8316bba64fe9fcbb1fd6b06d10b07656d4..8ccafeca6c6a208615413b0eb2b193bdff6b3f58 100644 (file)
@@ -3,19 +3,30 @@ dnl  x86-64 mpn_lshift optimized for "Core 2".
 dnl  Copyright 2007, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index fb46f966cdc0a4a0d88ed3f0939dc2b31256310f..65c7b2f1b8680c78619cf0c2945e84914e99cfaf 100644 (file)
@@ -3,19 +3,30 @@ dnl  x86-64 mpn_lshiftc optimized for "Core 2".
 dnl  Copyright 2007, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/core2/mul_basecase.asm b/mpn/x86_64/core2/mul_basecase.asm
new file mode 100644 (file)
index 0000000..d16be85
--- /dev/null
@@ -0,0 +1,975 @@
+dnl  X86-64 mpn_mul_basecase optimised for Intel Nehalem/Westmere.
+dnl  It also seems good for Conroe/Wolfdale.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2008, 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')
+
+C cycles/limb  mul_1           mul_2           mul_3           addmul_2
+C AMD K8,K9
+C AMD K10
+C AMD bull
+C AMD pile
+C AMD steam
+C AMD bobcat
+C AMD jaguar
+C Intel P4
+C Intel core    4.0             4.0             -              4.18-4.25
+C Intel NHM     3.75            3.8             -              4.06-4.2
+C Intel SBR
+C Intel IBR
+C Intel HWL
+C Intel BWL
+C Intel atom
+C VIA nano
+
+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 Torbjörn Granlund.
+
+C Code structure:
+C
+C
+C               m_1(0m4)        m_1(1m4)        m_1(2m4)        m_1(3m4)
+C                  |               |               |               |
+C        m_2(0m4)  |     m_2(1m4)  |     m_2(2m4)  |     m_2(3m4)  |
+C           |      /        |      /        |      /        |      /
+C           |     /         |     /         |     /         |     /
+C           |    /          |    /          |    /          |    /
+C          \|/ |/_         \|/ |/_         \|/ |/_         \|/ |/_
+C             _____           _____           _____           _____
+C            /     \         /     \         /     \         /     \
+C          \|/      |      \|/      |      \|/      |      \|/      |
+C        am_2(0m4)  |    am_2(1m4)  |    am_2(2m4)  |    am_2(3m4)  |
+C           \      /|\      \      /|\      \      /|\      \      /|\
+C            \_____/         \_____/         \_____/         \_____/
+
+C TODO
+C  * Tune.  None done so far.
+C  * Currently 2687 bytes, making it smaller would be nice.
+C  * Implement some basecases, say for un < 4.
+C  * Try zeroing with xor in m2 loops.
+C  * Try re-rolling the m2 loops to avoid the current 9 insn code duplication
+C    between loop header and wind-down code.
+C  * Consider adc reg,reg instead of adc $0,reg in m2 loops.  This save a byte.
+
+C When playing with pointers, set this to $2 to fall back to conservative
+C indexing in wind-down code.
+define(`I',`$1')
+
+C Define this to $1 to use late loop index variable as zero, $2 to use an
+C explicit $0.
+define(`Z',`$1')
+
+define(`rp',       `%rdi')
+define(`up',       `%rsi')
+define(`un_param', `%rdx')
+define(`vp_param', `%rcx')     C FIXME reallocate vp to rcx but watch performance!
+define(`vn_param', `%r8')
+
+define(`un',       `%r9')
+define(`vn',       `(%rsp)')
+
+define(`v0',       `%r10')
+define(`v1',       `%r11')
+define(`w0',       `%rbx')
+define(`w1',       `%rcx')
+define(`w2',       `%rbp')
+define(`w3',       `%r12')
+define(`i',        `%r13')
+define(`vp',       `%r14')
+
+define(`X0',       `%r8')
+define(`X1',       `%r15')
+
+C rax rbx rcx rdx rdi rsi rbp r8 r9 r10 r11 r12 r13 r14 r15
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+define(`ALIGNx', `ALIGN(16)')
+
+define(`N', 85)
+ifdef(`N',,`define(`N',0)')
+define(`MOV', `ifelse(eval(N & $3),0,`mov      $1, $2',`lea    ($1), $2')')
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_mul_basecase)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8d  ')
+       mov     (up), %rax              C shared for mul_1 and mul_2
+       push    %rbx
+       push    %rbp
+       push    %r12
+       push    %r13
+       push    %r14
+
+       mov     (vp_param), v0          C shared for mul_1 and mul_2
+
+       xor     un, un
+       sub     un_param, un            C un = -un_param
+
+       lea     (up,un_param,8), up
+       lea     (rp,un_param,8), rp
+
+       mul     v0                      C shared for mul_1 and mul_2
+
+       test    $1, R8(vn_param)
+       jz      L(m2)
+
+       lea     8(vp_param), vp         C FIXME: delay until known needed
+
+       test    $1, R8(un)
+       jnz     L(m1x1)
+
+L(m1x0):test   $2, R8(un)
+       jnz     L(m1s2)
+
+L(m1s0):
+       lea     (un), i
+       mov     %rax, (rp,un,8)
+       mov     8(up,un,8), %rax
+       mov     %rdx, w0                C FIXME: Use lea?
+       lea     L(do_am0)(%rip), %rbp
+       jmp     L(m1e0)
+
+L(m1s2):
+       lea     2(un), i
+       mov     %rax, (rp,un,8)
+       mov     8(up,un,8), %rax
+       mov     %rdx, w0                C FIXME: Use lea?
+       mul     v0
+       lea     L(do_am2)(%rip), %rbp
+       test    i, i
+       jnz     L(m1e2)
+       add     %rax, w0
+       adc     $0, %rdx
+       mov     w0, I(-8(rp),8(rp,un,8))
+       mov     %rdx, I((rp),16(rp,un,8))
+       jmp     L(ret2)
+
+L(m1x1):test   $2, R8(un)
+       jz      L(m1s3)
+
+L(m1s1):
+       lea     1(un), i
+       mov     %rax, (rp,un,8)
+       test    i, i
+       jz      L(1)
+       mov     8(up,un,8), %rax
+       mov     %rdx, w1                C FIXME: Use lea?
+       lea     L(do_am1)(%rip), %rbp
+       jmp     L(m1e1)
+L(1):  mov     %rdx, I((rp),8(rp,un,8))
+       jmp     L(ret2)
+
+L(m1s3):
+       lea     -1(un), i
+       mov     %rax, (rp,un,8)
+       mov     8(up,un,8), %rax
+       mov     %rdx, w1                C FIXME: Use lea?
+       lea     L(do_am3)(%rip), %rbp
+       jmp     L(m1e3)
+
+       ALIGNx
+L(m1top):
+       mul     v0
+       mov     w1, -16(rp,i,8)
+L(m1e2):xor    R32(w1), R32(w1)
+       add     %rax, w0
+       mov     (up,i,8), %rax
+       adc     %rdx, w1
+       mov     w0, -8(rp,i,8)
+L(m1e1):xor    R32(w0), R32(w0)
+       mul     v0
+       add     %rax, w1
+       mov     8(up,i,8), %rax
+       adc     %rdx, w0
+       mov     w1, (rp,i,8)
+L(m1e0):xor    R32(w1), R32(w1)
+       mul     v0
+       add     %rax, w0
+       mov     16(up,i,8), %rax
+       adc     %rdx, w1
+       mov     w0, 8(rp,i,8)
+L(m1e3):xor    R32(w0), R32(w0)
+       mul     v0
+       add     %rax, w1
+       mov     24(up,i,8), %rax
+       adc     %rdx, w0
+       add     $4, i
+       js      L(m1top)
+
+       mul     v0
+       mov     w1, I(-16(rp),-16(rp,i,8))
+       add     %rax, w0
+       adc     $0, %rdx
+       mov     w0, I(-8(rp),-8(rp,i,8))
+       mov     %rdx, I((rp),(rp,i,8))
+
+       dec     vn_param
+       jz      L(ret2)
+       lea     -8(rp), rp
+       jmp     *%rbp
+
+L(m2):
+       mov     8(vp_param), v1
+       lea     16(vp_param), vp        C FIXME: delay until known needed
+
+       test    $1, R8(un)
+       jnz     L(bx1)
+
+L(bx0):        test    $2, R8(un)
+       jnz     L(b10)
+
+L(b00):        lea     (un), i
+       mov     %rax, (rp,un,8)
+       mov     %rdx, w1                C FIXME: Use lea?
+       mov     (up,un,8), %rax
+       mov     $0, R32(w2)
+       jmp     L(m2e0)
+
+L(b10):        lea     -2(un), i
+       mov     %rax, w2                C FIXME: Use lea?
+       mov     (up,un,8), %rax
+       mov     %rdx, w3                C FIXME: Use lea?
+       mov     $0, R32(w0)
+       jmp     L(m2e2)
+
+L(bx1):        test    $2, R8(un)
+       jz      L(b11)
+
+L(b01):        lea     1(un), i
+       mov     %rax, (rp,un,8)
+       mov     (up,un,8), %rax
+       mov     %rdx, w0                C FIXME: Use lea?
+       mov     $0, R32(w1)
+       jmp     L(m2e1)
+
+L(b11):        lea     -1(un), i
+       mov     %rax, w1                C FIXME: Use lea?
+       mov     (up,un,8), %rax
+       mov     %rdx, w2                C FIXME: Use lea?
+       mov     $0, R32(w3)
+       jmp     L(m2e3)
+
+       ALIGNx
+L(m2top0):
+       mul     v0
+       add     %rax, w3
+       mov     -8(up,i,8), %rax
+       mov     w3, -8(rp,i,8)
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     $0, R32(w2)
+       mov     (up,i,8), %rax
+       mul     v0
+       add     %rax, w0
+       mov     w0, (rp,i,8)
+       adc     %rdx, w1
+       mov     (up,i,8), %rax
+       adc     $0, R32(w2)
+L(m2e0):mul    v1
+       add     %rax, w1
+       adc     %rdx, w2
+       mov     8(up,i,8), %rax
+       mul     v0
+       mov     $0, R32(w3)
+       add     %rax, w1
+       adc     %rdx, w2
+       adc     $0, R32(w3)
+       mov     8(up,i,8), %rax
+       mul     v1
+       add     %rax, w2
+       mov     w1, 8(rp,i,8)
+       adc     %rdx, w3
+       mov     $0, R32(w0)
+       mov     16(up,i,8), %rax
+       mul     v0
+       add     %rax, w2
+       mov     16(up,i,8), %rax
+       adc     %rdx, w3
+       adc     $0, R32(w0)
+       mul     v1
+       mov     $0, R32(w1)
+       add     %rax, w3
+       mov     24(up,i,8), %rax
+       mov     w2, 16(rp,i,8)
+       adc     %rdx, w0
+       add     $4, i
+       js      L(m2top0)
+
+       mul     v0
+       add     %rax, w3
+       mov     I(-8(up),-8(up,i,8)), %rax
+       mov     w3, I(-8(rp),-8(rp,i,8))
+       adc     %rdx, w0
+       adc     R32(w1), R32(w1)
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     w0, I((rp),(rp,i,8))
+       mov     w1, I(8(rp),8(rp,i,8))
+
+       add     $-2, vn_param
+       jz      L(ret2)
+
+L(do_am0):
+       push    %r15
+       push    vn_param
+
+L(olo0):
+       mov     (vp), v0
+       mov     8(vp), v1
+       lea     16(vp), vp
+       lea     16(rp), rp
+       mov     (up,un,8), %rax
+C      lea     0(un), i
+       mov     un, i
+       mul     v0
+       mov     %rax, X0
+       mov     (up,un,8), %rax
+       MOV(    %rdx, X1, 2)
+       mul     v1
+       MOV(    %rdx, w0, 4)
+       mov     (rp,un,8), w2
+       mov     %rax, w3
+       jmp     L(lo0)
+
+       ALIGNx
+L(am2top0):
+       mul     v1
+       add     w0, w1
+       adc     %rax, w2
+       mov     (up,i,8), %rax
+       MOV(    %rdx, w3, 1)
+       adc     $0, w3
+       mul     v0
+       add     w1, X1
+       mov     X1, -8(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 2)
+       adc     $0, X1
+       mov     (up,i,8), %rax
+       mul     v1
+       MOV(    %rdx, w0, 4)
+       mov     (rp,i,8), w1
+       add     w1, w2
+       adc     %rax, w3
+       adc     $0, w0
+L(lo0):        mov     8(up,i,8), %rax
+       mul     v0
+       add     w2, X0
+       adc     %rax, X1
+       mov     X0, (rp,i,8)
+       MOV(    %rdx, X0, 8)
+       adc     $0, X0
+       mov     8(up,i,8), %rax
+       mov     8(rp,i,8), w2
+       mul     v1
+       add     w2, w3
+       adc     %rax, w0
+       MOV(    %rdx, w1, 16)
+       adc     $0, w1
+       mov     16(up,i,8), %rax
+       mul     v0
+       add     w3, X1
+       mov     X1, 8(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 32)
+       mov     16(rp,i,8), w3
+       adc     $0, X1
+       mov     16(up,i,8), %rax
+       mul     v1
+       add     w3, w0
+       MOV(    %rdx, w2, 64)
+       adc     %rax, w1
+       mov     24(up,i,8), %rax
+       adc     $0, w2
+       mul     v0
+       add     w0, X0
+       mov     X0, 16(rp,i,8)
+       MOV(    %rdx, X0, 128)
+       adc     %rax, X1
+       mov     24(up,i,8), %rax
+       mov     24(rp,i,8), w0
+       adc     $0, X0
+       add     $4, i
+       jnc     L(am2top0)
+
+       mul     v1
+       add     w0, w1
+       adc     %rax, w2
+       adc     Z(i,$0), %rdx
+       add     w1, X1
+       adc     Z(i,$0), X0
+       mov     X1, I(-8(rp),-8(rp,i,8))
+       add     w2, X0
+       mov     X0, I((rp),(rp,i,8))
+       adc     Z(i,$0), %rdx
+       mov     %rdx, I(8(rp),8(rp,i,8))
+
+       addl    $-2, vn
+       jnz     L(olo0)
+
+L(ret):        pop     %rax
+       pop     %r15
+L(ret2):pop    %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+
+       ALIGNx
+L(m2top1):
+       mul     v0
+       add     %rax, w3
+       mov     -8(up,i,8), %rax
+       mov     w3, -8(rp,i,8)
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+L(m2e1):mul    v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     $0, R32(w2)
+       mov     (up,i,8), %rax
+       mul     v0
+       add     %rax, w0
+       mov     w0, (rp,i,8)
+       adc     %rdx, w1
+       mov     (up,i,8), %rax
+       adc     $0, R32(w2)
+       mul     v1
+       add     %rax, w1
+       adc     %rdx, w2
+       mov     8(up,i,8), %rax
+       mul     v0
+       mov     $0, R32(w3)
+       add     %rax, w1
+       adc     %rdx, w2
+       adc     $0, R32(w3)
+       mov     8(up,i,8), %rax
+       mul     v1
+       add     %rax, w2
+       mov     w1, 8(rp,i,8)
+       adc     %rdx, w3
+       mov     $0, R32(w0)
+       mov     16(up,i,8), %rax
+       mul     v0
+       add     %rax, w2
+       mov     16(up,i,8), %rax
+       adc     %rdx, w3
+       adc     $0, R32(w0)
+       mul     v1
+       mov     $0, R32(w1)
+       add     %rax, w3
+       mov     24(up,i,8), %rax
+       mov     w2, 16(rp,i,8)
+       adc     %rdx, w0
+       add     $4, i
+       js      L(m2top1)
+
+       mul     v0
+       add     %rax, w3
+       mov     I(-8(up),-8(up,i,8)), %rax
+       mov     w3, I(-8(rp),-8(rp,i,8))
+       adc     %rdx, w0
+       adc     R32(w1), R32(w1)
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     w0, I((rp),(rp,i,8))
+       mov     w1, I(8(rp),8(rp,i,8))
+
+       add     $-2, vn_param
+       jz      L(ret2)
+
+L(do_am1):
+       push    %r15
+       push    vn_param
+
+L(olo1):
+       mov     (vp), v0
+       mov     8(vp), v1
+       lea     16(vp), vp
+       lea     16(rp), rp
+       mov     (up,un,8), %rax
+       lea     1(un), i
+       mul     v0
+       mov     %rax, X1
+       MOV(    %rdx, X0, 128)
+       mov     (up,un,8), %rax
+       mov     (rp,un,8), w1
+       mul     v1
+       mov     %rax, w2
+       mov     8(up,un,8), %rax
+       MOV(    %rdx, w3, 1)
+       jmp     L(lo1)
+
+       ALIGNx
+L(am2top1):
+       mul     v1
+       add     w0, w1
+       adc     %rax, w2
+       mov     (up,i,8), %rax
+       MOV(    %rdx, w3, 1)
+       adc     $0, w3
+L(lo1):        mul     v0
+       add     w1, X1
+       mov     X1, -8(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 2)
+       adc     $0, X1
+       mov     (up,i,8), %rax
+       mul     v1
+       MOV(    %rdx, w0, 4)
+       mov     (rp,i,8), w1
+       add     w1, w2
+       adc     %rax, w3
+       adc     $0, w0
+       mov     8(up,i,8), %rax
+       mul     v0
+       add     w2, X0
+       adc     %rax, X1
+       mov     X0, (rp,i,8)
+       MOV(    %rdx, X0, 8)
+       adc     $0, X0
+       mov     8(up,i,8), %rax
+       mov     8(rp,i,8), w2
+       mul     v1
+       add     w2, w3
+       adc     %rax, w0
+       MOV(    %rdx, w1, 16)
+       adc     $0, w1
+       mov     16(up,i,8), %rax
+       mul     v0
+       add     w3, X1
+       mov     X1, 8(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 32)
+       mov     16(rp,i,8), w3
+       adc     $0, X1
+       mov     16(up,i,8), %rax
+       mul     v1
+       add     w3, w0
+       MOV(    %rdx, w2, 64)
+       adc     %rax, w1
+       mov     24(up,i,8), %rax
+       adc     $0, w2
+       mul     v0
+       add     w0, X0
+       mov     X0, 16(rp,i,8)
+       MOV(    %rdx, X0, 128)
+       adc     %rax, X1
+       mov     24(up,i,8), %rax
+       mov     24(rp,i,8), w0
+       adc     $0, X0
+       add     $4, i
+       jnc     L(am2top1)
+
+       mul     v1
+       add     w0, w1
+       adc     %rax, w2
+       adc     Z(i,$0), %rdx
+       add     w1, X1
+       adc     Z(i,$0), X0
+       mov     X1, I(-8(rp),-8(rp,i,8))
+       add     w2, X0
+       mov     X0, I((rp),(rp,i,8))
+       adc     Z(i,$0), %rdx
+       mov     %rdx, I(8(rp),8(rp,i,8))
+
+       addl    $-2, vn
+       jnz     L(olo1)
+
+       pop     %rax
+       pop     %r15
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+
+       ALIGNx
+L(m2top2):
+       mul     v0
+       add     %rax, w3
+       mov     -8(up,i,8), %rax
+       mov     w3, -8(rp,i,8)
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     $0, R32(w2)
+       mov     (up,i,8), %rax
+       mul     v0
+       add     %rax, w0
+       mov     w0, (rp,i,8)
+       adc     %rdx, w1
+       mov     (up,i,8), %rax
+       adc     $0, R32(w2)
+       mul     v1
+       add     %rax, w1
+       adc     %rdx, w2
+       mov     8(up,i,8), %rax
+       mul     v0
+       mov     $0, R32(w3)
+       add     %rax, w1
+       adc     %rdx, w2
+       adc     $0, R32(w3)
+       mov     8(up,i,8), %rax
+       mul     v1
+       add     %rax, w2
+       mov     w1, 8(rp,i,8)
+       adc     %rdx, w3
+       mov     $0, R32(w0)
+       mov     16(up,i,8), %rax
+       mul     v0
+       add     %rax, w2
+       mov     16(up,i,8), %rax
+       adc     %rdx, w3
+       adc     $0, R32(w0)
+L(m2e2):mul    v1
+       mov     $0, R32(w1)
+       add     %rax, w3
+       mov     24(up,i,8), %rax
+       mov     w2, 16(rp,i,8)
+       adc     %rdx, w0
+       add     $4, i
+       js      L(m2top2)
+
+       mul     v0
+       add     %rax, w3
+       mov     I(-8(up),-8(up,i,8)), %rax
+       mov     w3, I(-8(rp),-8(rp,i,8))
+       adc     %rdx, w0
+       adc     R32(w1), R32(w1)
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     w0, I((rp),(rp,i,8))
+       mov     w1, I(8(rp),8(rp,i,8))
+
+       add     $-2, vn_param
+       jz      L(ret2)
+
+L(do_am2):
+       push    %r15
+       push    vn_param
+
+L(olo2):
+       mov     (vp), v0
+       mov     8(vp), v1
+       lea     16(vp), vp
+       lea     16(rp), rp
+       mov     (up,un,8), %rax
+       lea     -2(un), i
+       mul     v0
+       mov     %rax, X0
+       MOV(    %rdx, X1, 32)
+       mov     (up,un,8), %rax
+       mov     (rp,un,8), w0
+       mul     v1
+       mov     %rax, w1
+       lea     (%rdx), w2
+       mov     8(up,un,8), %rax
+       jmp     L(lo2)
+
+       ALIGNx
+L(am2top2):
+       mul     v1
+       add     w0, w1
+       adc     %rax, w2
+       mov     (up,i,8), %rax
+       MOV(    %rdx, w3, 1)
+       adc     $0, w3
+       mul     v0
+       add     w1, X1
+       mov     X1, -8(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 2)
+       adc     $0, X1
+       mov     (up,i,8), %rax
+       mul     v1
+       MOV(    %rdx, w0, 4)
+       mov     (rp,i,8), w1
+       add     w1, w2
+       adc     %rax, w3
+       adc     $0, w0
+       mov     8(up,i,8), %rax
+       mul     v0
+       add     w2, X0
+       adc     %rax, X1
+       mov     X0, (rp,i,8)
+       MOV(    %rdx, X0, 8)
+       adc     $0, X0
+       mov     8(up,i,8), %rax
+       mov     8(rp,i,8), w2
+       mul     v1
+       add     w2, w3
+       adc     %rax, w0
+       MOV(    %rdx, w1, 16)
+       adc     $0, w1
+       mov     16(up,i,8), %rax
+       mul     v0
+       add     w3, X1
+       mov     X1, 8(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 32)
+       mov     16(rp,i,8), w3
+       adc     $0, X1
+       mov     16(up,i,8), %rax
+       mul     v1
+       add     w3, w0
+       MOV(    %rdx, w2, 64)
+       adc     %rax, w1
+       mov     24(up,i,8), %rax
+       adc     $0, w2
+L(lo2):        mul     v0
+       add     w0, X0
+       mov     X0, 16(rp,i,8)
+       MOV(    %rdx, X0, 128)
+       adc     %rax, X1
+       mov     24(up,i,8), %rax
+       mov     24(rp,i,8), w0
+       adc     $0, X0
+       add     $4, i
+       jnc     L(am2top2)
+
+       mul     v1
+       add     w0, w1
+       adc     %rax, w2
+       adc     Z(i,$0), %rdx
+       add     w1, X1
+       adc     Z(i,$0), X0
+       mov     X1, I(-8(rp),-8(rp,i,8))
+       add     w2, X0
+       mov     X0, I((rp),(rp,i,8))
+       adc     Z(i,$0), %rdx
+       mov     %rdx, I(8(rp),8(rp,i,8))
+
+       addl    $-2, vn
+       jnz     L(olo2)
+
+       pop     %rax
+       pop     %r15
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+
+       ALIGNx
+L(m2top3):
+       mul     v0
+       add     %rax, w3
+       mov     -8(up,i,8), %rax
+       mov     w3, -8(rp,i,8)
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     $0, R32(w2)
+       mov     (up,i,8), %rax
+       mul     v0
+       add     %rax, w0
+       mov     w0, (rp,i,8)
+       adc     %rdx, w1
+       mov     (up,i,8), %rax
+       adc     $0, R32(w2)
+       mul     v1
+       add     %rax, w1
+       adc     %rdx, w2
+       mov     8(up,i,8), %rax
+       mul     v0
+       mov     $0, R32(w3)
+       add     %rax, w1
+       adc     %rdx, w2
+       adc     $0, R32(w3)
+       mov     8(up,i,8), %rax
+L(m2e3):mul    v1
+       add     %rax, w2
+       mov     w1, 8(rp,i,8)
+       adc     %rdx, w3
+       mov     $0, R32(w0)
+       mov     16(up,i,8), %rax
+       mul     v0
+       add     %rax, w2
+       mov     16(up,i,8), %rax
+       adc     %rdx, w3
+       adc     $0, R32(w0)
+       mul     v1
+       mov     $0, R32(w1)
+       add     %rax, w3
+       mov     24(up,i,8), %rax
+       mov     w2, 16(rp,i,8)
+       adc     %rdx, w0
+       add     $4, i
+       js      L(m2top3)
+
+       mul     v0
+       add     %rax, w3
+       mov     I(-8(up),-8(up,i,8)), %rax
+       mov     w3, I(-8(rp),-8(rp,i,8))
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     w0, I((rp),(rp,i,8))
+       mov     w1, I(8(rp),8(rp,i,8))
+
+       add     $-2, vn_param
+       jz      L(ret2)
+
+L(do_am3):
+       push    %r15
+       push    vn_param
+
+L(olo3):
+       mov     (vp), v0
+       mov     8(vp), v1
+       lea     16(vp), vp
+       lea     16(rp), rp
+       mov     (up,un,8), %rax
+       lea     -1(un), i
+       mul     v0
+       mov     %rax, X1
+       MOV(    %rdx, X0, 8)
+       mov     (up,un,8), %rax
+       mov     (rp,un,8), w3
+       mul     v1
+       mov     %rax, w0
+       MOV(    %rdx, w1, 16)
+       mov     8(up,un,8), %rax
+       jmp     L(lo3)
+
+       ALIGNx
+L(am2top3):
+       mul     v1
+       add     w0, w1
+       adc     %rax, w2
+       mov     (up,i,8), %rax
+       MOV(    %rdx, w3, 1)
+       adc     $0, w3
+       mul     v0
+       add     w1, X1
+       mov     X1, -8(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 2)
+       adc     $0, X1
+       mov     (up,i,8), %rax
+       mul     v1
+       MOV(    %rdx, w0, 4)
+       mov     (rp,i,8), w1
+       add     w1, w2
+       adc     %rax, w3
+       adc     $0, w0
+       mov     8(up,i,8), %rax
+       mul     v0
+       add     w2, X0
+       adc     %rax, X1
+       mov     X0, (rp,i,8)
+       MOV(    %rdx, X0, 8)
+       adc     $0, X0
+       mov     8(up,i,8), %rax
+       mov     8(rp,i,8), w2
+       mul     v1
+       add     w2, w3
+       adc     %rax, w0
+       MOV(    %rdx, w1, 16)
+       adc     $0, w1
+       mov     16(up,i,8), %rax
+L(lo3):        mul     v0
+       add     w3, X1
+       mov     X1, 8(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 32)
+       mov     16(rp,i,8), w3
+       adc     $0, X1
+       mov     16(up,i,8), %rax
+       mul     v1
+       add     w3, w0
+       MOV(    %rdx, w2, 64)
+       adc     %rax, w1
+       mov     24(up,i,8), %rax
+       adc     $0, w2
+       mul     v0
+       add     w0, X0
+       mov     X0, 16(rp,i,8)
+       MOV(    %rdx, X0, 128)
+       adc     %rax, X1
+       mov     24(up,i,8), %rax
+       mov     24(rp,i,8), w0
+       adc     $0, X0
+       add     $4, i
+       jnc     L(am2top3)
+
+       mul     v1
+       add     w0, w1
+       adc     %rax, w2
+       adc     Z(i,$0), %rdx
+       add     w1, X1
+       adc     Z(i,$0), X0
+       mov     X1, I(-8(rp),-8(rp,i,8))
+       add     w2, X0
+       mov     X0, I((rp),(rp,i,8))
+       adc     Z(i,$0), %rdx
+       mov     %rdx, I(8(rp),8(rp,i,8))
+
+       addl    $-2, vn
+       jnz     L(olo3)
+
+       pop     %rax
+       pop     %r15
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
diff --git a/mpn/x86_64/core2/mullo_basecase.asm b/mpn/x86_64/core2/mullo_basecase.asm
new file mode 100644 (file)
index 0000000..0f03d86
--- /dev/null
@@ -0,0 +1,427 @@
+dnl  AMD64 mpn_mullo_basecase optimised for Conroe/Wolfdale/Nehalem/Westmere.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2008, 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')
+
+C cycles/limb  mul_2           addmul_2
+C AMD K8,K9
+C AMD K10
+C AMD bull
+C AMD pile
+C AMD steam
+C AMD bobcat
+C AMD jaguar
+C Intel P4
+C Intel core    4.0            4.18-4.25
+C Intel NHM     3.75           4.06-4.2
+C Intel SBR
+C Intel IBR
+C Intel HWL
+C Intel BWL
+C Intel atom
+C VIA nano
+
+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 Torbjörn Granlund.
+
+C TODO
+C   * Implement proper cor2, replacing current cor0.
+C   * Offset n by 2 in order to avoid the outer loop cmp.  (And sqr_basecase?)
+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')
+define(`n_param',  `%rcx')
+
+define(`v0',       `%r10')
+define(`v1',       `%r11')
+define(`w0',       `%rbx')
+define(`w1',       `%rcx')
+define(`w2',       `%rbp')
+define(`w3',       `%r12')
+define(`n',        `%r9')
+define(`i',        `%r13')
+define(`vp',       `%r8')
+
+define(`X0',       `%r14')
+define(`X1',       `%r15')
+
+C rax rbx rcx rdx rdi rsi rbp r8 r9 r10 r11 r12 r13 r14 r15
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+define(`ALIGNx', `ALIGN(16)')
+
+define(`N', 85)
+ifdef(`N',,`define(`N',0)')
+define(`MOV', `ifelse(eval(N & $3),0,`mov      $1, $2',`lea    ($1), $2')')
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_mullo_basecase)
+       FUNC_ENTRY(4)
+
+       mov     (up), %rax
+       mov     vp_param, vp
+
+       cmp     $4, n_param
+       jb      L(small)
+
+       mov     (vp_param), v0
+       push    %rbx
+       lea     (rp,n_param,8), rp      C point rp at R[un]
+       push    %rbp
+       lea     (up,n_param,8), up      C point up right after U's end
+       push    %r12
+       mov     $0, R32(n)              C FIXME
+       sub     n_param, n
+       push    %r13
+       mul     v0
+       mov     8(vp), v1
+
+       test    $1, R8(n_param)
+       jnz     L(m2x1)
+
+L(m2x0):test   $2, R8(n_param)
+       jnz     L(m2b2)
+
+L(m2b0):lea    (n), i
+       mov     %rax, (rp,n,8)
+       mov     %rdx, w1
+       mov     (up,n,8), %rax
+       xor     R32(w2), R32(w2)
+       jmp     L(m2e0)
+
+L(m2b2):lea    -2(n), i
+       mov     %rax, w2
+       mov     (up,n,8), %rax
+       mov     %rdx, w3
+       xor     R32(w0), R32(w0)
+       jmp     L(m2e2)
+
+L(m2x1):test   $2, R8(n_param)
+       jnz     L(m2b3)
+
+L(m2b1):lea    1(n), i
+       mov     %rax, (rp,n,8)
+       mov     (up,n,8), %rax
+       mov     %rdx, w0
+       xor     R32(w1), R32(w1)
+       jmp     L(m2e1)
+
+L(m2b3):lea    -1(n), i
+       xor     R32(w3), R32(w3)
+       mov     %rax, w1
+       mov     %rdx, w2
+       mov     (up,n,8), %rax
+       jmp     L(m2e3)
+
+       ALIGNx
+L(m2tp):mul    v0
+       add     %rax, w3
+       mov     -8(up,i,8), %rax
+       mov     w3, -8(rp,i,8)
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+L(m2e1):mul    v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     $0, R32(w2)
+       mov     (up,i,8), %rax
+       mul     v0
+       add     %rax, w0
+       mov     w0, (rp,i,8)
+       adc     %rdx, w1
+       mov     (up,i,8), %rax
+       adc     $0, R32(w2)
+L(m2e0):mul    v1
+       add     %rax, w1
+       adc     %rdx, w2
+       mov     8(up,i,8), %rax
+       mul     v0
+       mov     $0, R32(w3)
+       add     %rax, w1
+       adc     %rdx, w2
+       adc     $0, R32(w3)
+       mov     8(up,i,8), %rax
+L(m2e3):mul    v1
+       add     %rax, w2
+       mov     w1, 8(rp,i,8)
+       adc     %rdx, w3
+       mov     $0, R32(w0)
+       mov     16(up,i,8), %rax
+       mul     v0
+       add     %rax, w2
+       mov     16(up,i,8), %rax
+       adc     %rdx, w3
+       adc     $0, R32(w0)
+L(m2e2):mul    v1
+       mov     $0, R32(w1)             C FIXME: dead in last iteration
+       add     %rax, w3
+       mov     24(up,i,8), %rax
+       mov     w2, 16(rp,i,8)
+       adc     %rdx, w0                C FIXME: dead in last iteration
+       add     $4, i
+       js      L(m2tp)
+
+L(m2ed):imul   v0, %rax
+       add     w3, %rax
+       mov     %rax, I(-8(rp),-8(rp,i,8))
+
+       add     $2, n
+       lea     16(vp), vp
+       lea     -16(up), up
+       cmp     $-2, n
+       jge     L(cor1)
+
+       push    %r14
+       push    %r15
+
+L(outer):
+       mov     (vp), v0
+       mov     8(vp), v1
+       mov     (up,n,8), %rax
+       mul     v0
+       test    $1, R8(n)
+       jnz     L(a1x1)
+
+L(a1x0):mov    %rax, X1
+       MOV(    %rdx, X0, 8)
+       mov     (up,n,8), %rax
+       mul     v1
+       test    $2, R8(n)
+       jnz     L(a110)
+
+L(a100):lea    (n), i
+       mov     (rp,n,8), w3
+       mov     %rax, w0
+       MOV(    %rdx, w1, 16)
+       jmp     L(lo0)
+
+L(a110):lea    2(n), i
+       mov     (rp,n,8), w1
+       mov     %rax, w2
+       mov     8(up,n,8), %rax
+       MOV(    %rdx, w3, 1)
+       jmp     L(lo2)
+
+L(a1x1):mov    %rax, X0
+       MOV(    %rdx, X1, 2)
+       mov     (up,n,8), %rax
+       mul     v1
+       test    $2, R8(n)
+       jz      L(a111)
+
+L(a101):lea    1(n), i
+       MOV(    %rdx, w0, 4)
+       mov     (rp,n,8), w2
+       mov     %rax, w3
+       jmp     L(lo1)
+
+L(a111):lea    -1(n), i
+       MOV(    %rdx, w2, 64)
+       mov     %rax, w1
+       mov     (rp,n,8), w0
+       mov     8(up,n,8), %rax
+       jmp     L(lo3)
+
+       ALIGNx
+L(top):        mul     v1
+       add     w0, w1
+       adc     %rax, w2
+       mov     -8(up,i,8), %rax
+       MOV(    %rdx, w3, 1)
+       adc     $0, w3
+L(lo2):        mul     v0
+       add     w1, X1
+       mov     X1, -16(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 2)
+       adc     $0, X1
+       mov     -8(up,i,8), %rax
+       mul     v1
+       MOV(    %rdx, w0, 4)
+       mov     -8(rp,i,8), w1
+       add     w1, w2
+       adc     %rax, w3
+       adc     $0, w0
+L(lo1):        mov     (up,i,8), %rax
+       mul     v0
+       add     w2, X0
+       adc     %rax, X1
+       mov     X0, -8(rp,i,8)
+       MOV(    %rdx, X0, 8)
+       adc     $0, X0
+       mov     (up,i,8), %rax
+       mov     (rp,i,8), w2
+       mul     v1
+       add     w2, w3
+       adc     %rax, w0
+       MOV(    %rdx, w1, 16)
+       adc     $0, w1
+L(lo0):        mov     8(up,i,8), %rax
+       mul     v0
+       add     w3, X1
+       mov     X1, (rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 32)
+       mov     8(rp,i,8), w3
+       adc     $0, X1
+       mov     8(up,i,8), %rax
+       mul     v1
+       add     w3, w0
+       MOV(    %rdx, w2, 64)
+       adc     %rax, w1
+       mov     16(up,i,8), %rax
+       adc     $0, w2
+L(lo3):        mul     v0
+       add     w0, X0
+       mov     X0, 8(rp,i,8)
+       MOV(    %rdx, X0, 128)
+       adc     %rax, X1
+       mov     16(up,i,8), %rax
+       mov     16(rp,i,8), w0
+       adc     $0, X0
+       add     $4, i
+       jnc     L(top)
+
+L(end):        imul    v1, %rax
+       add     w0, w1
+       adc     %rax, w2
+       mov     I(-8(up),-8(up,i,8)), %rax
+       imul    v0, %rax
+       add     w1, X1
+       mov     X1, I(-16(rp),-16(rp,i,8))
+       adc     X0, %rax
+       mov     I(-8(rp),-8(rp,i,8)), w1
+       add     w1, w2
+       add     w2, %rax
+       mov     %rax, I(-8(rp),-8(rp,i,8))
+
+       add     $2, n
+       lea     16(vp), vp
+       lea     -16(up), up
+       cmp     $-2, n
+       jl      L(outer)
+
+       pop     %r15
+       pop     %r14
+
+       jnz     L(cor0)
+
+L(cor1):mov    (vp), v0
+       mov     8(vp), v1
+       mov     -16(up), %rax
+       mul     v0                      C u0 x v2
+       add     -16(rp), %rax           C FIXME: rp[0] still available in reg?
+       adc     -8(rp), %rdx            C FIXME: rp[1] still available in reg?
+       mov     -8(up), %rbx
+       imul    v0, %rbx
+       mov     -16(up), %rcx
+       imul    v1, %rcx
+       mov     %rax, -16(rp)
+       add     %rbx, %rcx
+       add     %rdx, %rcx
+       mov     %rcx, -8(rp)
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+L(cor0):mov    (vp), %r11
+       imul    -8(up), %r11
+       add     %rax, %r11
+       mov     %r11, -8(rp)
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+       ALIGN(16)
+L(small):
+       cmp     $2, n_param
+       jae     L(gt1)
+L(n1): imul    (vp_param), %rax
+       mov     %rax, (rp)
+       FUNC_EXIT()
+       ret
+L(gt1):        ja      L(gt2)
+L(n2): mov     (vp_param), %r9
+       mul     %r9
+       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_param), %r9
+       mul     %r9             C u0 x v0
+       mov     %rax, (rp)
+       mov     %rdx, %r10
+       mov     8(up), %rax
+       mul     %r9             C u1 x v0
+       imul    16(up), %r9     C u2 x v0
+       add     %rax, %r10
+       adc     %rdx, %r9
+       mov     8(vp), %r11
+       mov     (up), %rax
+       mul     %r11            C u0 x v1
+       add     %rax, %r10
+       adc     %rdx, %r9
+       imul    8(up), %r11     C u1 x v1
+       add     %r11, %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
+EPILOGUE()
index 97c451f58619fd1844e3b89f1086e04cce6008ac..e935cf189202d16ce7058b2002b6dd4e0003f980 100644 (file)
@@ -3,19 +3,30 @@ dnl  x86-64 mpn_popcount optimized for "Core 2".
 dnl  Copyright 2007 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
diff --git a/mpn/x86_64/core2/redc_1.asm b/mpn/x86_64/core2/redc_1.asm
new file mode 100644 (file)
index 0000000..d0e96ef
--- /dev/null
@@ -0,0 +1,425 @@
+dnl  X86-64 mpn_redc_1 optimised for Intel Conroe and Wolfdale.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2003-2005, 2007, 2008, 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')
+
+C           cycles/limb
+C AMD K8,K9     ?
+C AMD K10       ?
+C AMD bull      ?
+C AMD pile      ?
+C AMD steam     ?
+C AMD bobcat    ?
+C AMD jaguar    ?
+C Intel P4      ?
+C Intel core    4.5  (fluctuating)
+C Intel NHM     ?
+C Intel SBR     ?
+C Intel IBR     ?
+C Intel HWL     ?
+C Intel BWL     ?
+C Intel atom    ?
+C VIA nano      ?
+
+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 Torbjörn Granlund.
+
+C TODO
+C  * Micro-optimise, none performed thus far.
+C  * Consider inlining mpn_add_n.
+C  * Single basecases out before the pushes.
+C  * Keep up[i] in registers for basecases (might require pushes).
+
+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')   C rcx
+define(`up',          `%rsi')   C rdx
+define(`mp_param',    `%rdx')   C r8
+define(`n',           `%rcx')   C r9
+define(`u0inv',       `%r8')    C stack
+
+define(`i',           `%r14')
+define(`j',           `%r15')
+define(`mp',          `%r12')
+define(`q0',          `%r13')
+
+C rax rbx rcx rdx rdi rsi rbp r8 r9 r10 r11 r12 r13 r14 r15
+C  X  q0'  n   X  rp  up      u0i           mp   q0 i   j
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+define(`ALIGNx', `ALIGN(16)')
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_redc_1)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8   ')
+       push    %rbx
+       push    %rbp
+       push    %r12
+       push    %r13
+       push    %r14
+       push    %r15
+
+       mov     (up), q0
+       mov     n, j                    C outer loop induction var
+       lea     (mp_param,n,8), mp
+       lea     -16(up,n,8), up
+       neg     n
+       imul    u0inv, q0               C first iteration q0
+
+       test    $1, R8(n)
+       jz      L(b0)
+
+L(b1): cmp     $-1, R32(n)
+       jz      L(n1)
+       cmp     $-3, R32(n)
+       jz      L(n3)
+
+       push    rp
+
+L(otp1):lea    3(n), i
+       mov     (mp,n,8), %rax
+       mul     q0
+       lea     (%rax), %rbp
+       mov     8(mp,n,8), %rax
+       lea     (%rdx), %r9
+       mul     q0
+       lea     (%rax), %r11
+       mov     16(mp,n,8), %rax
+       mov     16(up,n,8), %r10
+       lea     (%rdx), %rdi
+       mul     q0
+       add     %rbp, %r10
+       lea     (%rax), %rbp
+       mov     24(mp,n,8), %rax
+       adc     %r9, %r11
+       mov     24(up,n,8), %rbx
+       lea     (%rdx), %r9
+       adc     $0, %rdi
+       mul     q0
+       add     %r11, %rbx
+       lea     (%rax), %r11
+       mov     32(mp,n,8), %rax
+       adc     %rdi, %rbp
+       mov     %rbx, 24(up,n,8)
+       mov     32(up,n,8), %r10
+       lea     (%rdx), %rdi
+       adc     $0, %r9
+       imul    u0inv, %rbx             C next q limb
+       add     $2, i
+       jns     L(ed1)
+
+       ALIGNx
+L(tp1):        mul     q0
+       add     %rbp, %r10
+       lea     (%rax), %rbp
+       mov     (mp,i,8), %rax
+       adc     %r9, %r11
+       mov     %r10, -8(up,i,8)
+       mov     (up,i,8), %r10
+       lea     (%rdx), %r9
+       adc     $0, %rdi
+       mul     q0
+       add     %r11, %r10
+       lea     (%rax), %r11
+       mov     8(mp,i,8), %rax
+       adc     %rdi, %rbp
+       mov     %r10, (up,i,8)
+       mov     8(up,i,8), %r10
+       lea     (%rdx), %rdi
+       adc     $0, %r9
+       add     $2, i
+       js      L(tp1)
+
+L(ed1):        mul     q0
+       add     %rbp, %r10
+       adc     %r9, %r11
+       mov     %r10, I(-8(up),-8(up,i,8))
+       mov     I((up),(up,i,8)), %r10
+       adc     $0, %rdi
+       add     %r11, %r10
+       adc     %rdi, %rax
+       mov     %r10, I((up),(up,i,8))
+       mov     I(8(up),8(up,i,8)), %r10
+       adc     $0, %rdx
+       add     %rax, %r10
+       mov     %r10, I(8(up),8(up,i,8))
+       adc     $0, %rdx
+       mov     %rdx, 16(up,n,8)        C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp1)
+       jmp     L(cj)
+
+L(b0): cmp     $-2, R32(n)
+       jz      L(n2)
+       cmp     $-4, R32(n)
+       jz      L(n4)
+
+       push    rp
+
+L(otp0):lea    4(n), i
+       mov     (mp,n,8), %rax
+       mul     q0
+       lea     (%rax), %r11
+       mov     8(mp,n,8), %rax
+       lea     (%rdx), %rdi
+       mul     q0
+       lea     (%rax), %rbp
+       mov     16(mp,n,8), %rax
+       mov     16(up,n,8), %r10
+       lea     (%rdx), %r9
+       mul     q0
+       add     %r11, %r10
+       lea     (%rax), %r11
+       mov     24(mp,n,8), %rax
+       adc     %rdi, %rbp
+       mov     24(up,n,8), %rbx
+       lea     (%rdx), %rdi
+       adc     $0, %r9
+       mul     q0
+       add     %rbp, %rbx
+       lea     (%rax), %rbp
+       mov     32(mp,n,8), %rax
+       adc     %r9, %r11
+       mov     %rbx, 24(up,n,8)
+       mov     32(up,n,8), %r10
+       lea     (%rdx), %r9
+       adc     $0, %rdi
+       imul    u0inv, %rbx             C next q limb
+       jmp     L(e0)
+
+       ALIGNx
+L(tp0):        mul     q0
+       add     %rbp, %r10
+       lea     (%rax), %rbp
+       mov     (mp,i,8), %rax
+       adc     %r9, %r11
+       mov     %r10, -8(up,i,8)
+       mov     (up,i,8), %r10
+       lea     (%rdx), %r9
+       adc     $0, %rdi
+L(e0): mul     q0
+       add     %r11, %r10
+       lea     (%rax), %r11
+       mov     8(mp,i,8), %rax
+       adc     %rdi, %rbp
+       mov     %r10, (up,i,8)
+       mov     8(up,i,8), %r10
+       lea     (%rdx), %rdi
+       adc     $0, %r9
+       add     $2, i
+       js      L(tp0)
+
+L(ed0):        mul     q0
+       add     %rbp, %r10
+       adc     %r9, %r11
+       mov     %r10, I(-8(up),-8(up,i,8))
+       mov     I((up),(up,i,8)), %r10
+       adc     $0, %rdi
+       add     %r11, %r10
+       adc     %rdi, %rax
+       mov     %r10, I((up),(up,i,8))
+       mov     I(8(up),8(up,i,8)), %r10
+       adc     $0, %rdx
+       add     %rax, %r10
+       mov     %r10, I(8(up),8(up,i,8))
+       adc     $0, %rdx
+       mov     %rdx, 16(up,n,8)        C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp0)
+
+L(cj): lea     16(up), up              C FIXME
+       pop     rp
+L(add_n):
+IFSTD(`        lea     (up,n,8), up            C param 2: up
+       lea     (up,n,8), %rdx          C param 3: up - n
+       neg     R32(n)          ')      C param 4: n
+
+IFDOS(`        lea     (up,n,8), %rdx          C param 2: up
+       lea     (%rdx,n,8), %r8         C param 3: up - n
+       neg     R32(n)
+       mov     n, %r9                  C param 4: n
+       mov     rp, %rcx        ')      C param 1: rp
+
+       CALL(   mpn_add_n)
+
+L(ret):        pop     %r15
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+L(n1): mov     (mp_param), %rax
+       mul     q0
+       add     8(up), %rax
+       adc     16(up), %rdx
+       mov     %rdx, (rp)
+       mov     $0, R32(%rax)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+
+L(n2): mov     (mp_param), %rax
+       mov     (up), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     %rdx, %r9
+       adc     $0, %r9
+       mov     -8(mp), %rax
+       mov     8(up), %r10
+       mul     q0
+       add     %rax, %r10
+       mov     %rdx, %r11
+       adc     $0, %r11
+       add     %r9, %r10
+       adc     $0, %r11
+       mov     %r10, q0
+       imul    u0inv, q0               C next q0
+       mov     -16(mp), %rax
+       mul     q0
+       add     %rax, %r10
+       mov     %rdx, %r9
+       adc     $0, %r9
+       mov     -8(mp), %rax
+       mov     16(up), %r14
+       mul     q0
+       add     %rax, %r14
+       adc     $0, %rdx
+       add     %r9, %r14
+       adc     $0, %rdx
+       xor     R32(%rax), R32(%rax)
+       add     %r11, %r14
+       adc     24(up), %rdx
+       mov     %r14, (rp)
+       mov     %rdx, 8(rp)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+
+       ALIGNx
+L(n3): mov     -24(mp), %rax
+       mov     -8(up), %r10
+       mul     q0
+       add     %rax, %r10
+       mov     -16(mp), %rax
+       mov     %rdx, %r11
+       adc     $0, %r11
+       mov     (up), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     %rdx, %r9
+       adc     $0, %r9
+       mov     -8(mp), %rax
+       add     %r11, %rbp
+       mov     8(up), %r10
+       adc     $0, %r9
+       mul     q0
+       mov     %rbp, q0
+       imul    u0inv, q0               C next q0
+       add     %rax, %r10
+       mov     %rdx, %r11
+       adc     $0, %r11
+       mov     %rbp, (up)
+       add     %r9, %r10
+       adc     $0, %r11
+       mov     %r10, 8(up)
+       mov     %r11, -8(up)            C up[0]
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(n3)
+
+       mov     -32(up), %rdx
+       mov     -24(up), %rbx
+       xor     R32(%rax), R32(%rax)
+       add     %rbp, %rdx
+       adc     %r10, %rbx
+       adc     8(up), %r11
+       mov     %rdx, (rp)
+       mov     %rbx, 8(rp)
+       mov     %r11, 16(rp)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+
+       ALIGNx
+L(n4): mov     -32(mp), %rax
+       mul     q0
+       lea     (%rax), %r11
+       mov     -24(mp), %rax
+       lea     (%rdx), %r14
+       mul     q0
+       lea     (%rax), %rbp
+       mov     -16(mp), %rax
+       mov     -16(up), %r10
+       lea     (%rdx), %r9
+       mul     q0
+       add     %r11, %r10
+       lea     (%rax), %r11
+       mov     -8(mp), %rax
+       adc     %r14, %rbp
+       mov     -8(up), %rbx
+       lea     (%rdx), %r14
+       adc     $0, %r9
+       mul     q0
+       add     %rbp, %rbx
+       adc     %r9, %r11
+       mov     %rbx, -8(up)
+       mov     (up), %r10
+       adc     $0, %r14
+       imul    u0inv, %rbx             C next q limb
+       add     %r11, %r10
+       adc     %r14, %rax
+       mov     %r10, (up)
+       mov     8(up), %r10
+       adc     $0, %rdx
+       add     %rax, %r10
+       mov     %r10, 8(up)
+       adc     $0, %rdx
+       mov     %rdx, -16(up)           C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(n4)
+       lea     16(up), up
+       jmp     L(add_n)
+EPILOGUE()
+ASM_END()
index bbac0f0bc5727998e67ded63c4917367af033615..27eed3712d225ff55b6423bfecc2c7c8ca8eb1f8 100644 (file)
@@ -3,19 +3,30 @@ dnl  X86-64 mpn_rsh1add_n, mpn_rsh1sub_n optimised for Intel Conroe/Penryn.
 dnl  Copyright 2003, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index e93e8a4b2b4b5d9f0fa5a4e1eb7b63b8e423deb0..ab32ec85dffc122ac306a0275831a8c90cbeb621 100644 (file)
@@ -3,19 +3,30 @@ dnl  x86-64 mpn_rshift optimized for "Core 2".
 dnl  Copyright 2007, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/core2/sec_tabselect.asm b/mpn/x86_64/core2/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..e436034
--- /dev/null
@@ -0,0 +1,37 @@
+dnl  X86-64 mpn_sec_tabselect.
+
+dnl  Copyright 2012, 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')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_sec_tabselect)
+include_mpn(`x86_64/fastsse/sec_tabselect.asm')
diff --git a/mpn/x86_64/core2/sqr_basecase.asm b/mpn/x86_64/core2/sqr_basecase.asm
new file mode 100644 (file)
index 0000000..a112c1b
--- /dev/null
@@ -0,0 +1,984 @@
+dnl  X86-64 mpn_sqr_basecase optimised for Intel Nehalem/Westmere.
+dnl  It also seems good for Conroe/Wolfdale.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2008, 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')
+
+C cycles/limb  mul_2           addmul_2        sqr_diag_addlsh1
+C AMD K8,K9
+C AMD K10
+C AMD bull
+C AMD pile
+C AMD steam
+C AMD bobcat
+C AMD jaguar
+C Intel P4
+C Intel core    4.9            4.18-4.25                3.87
+C Intel NHM     3.8            4.06-4.2                 3.5
+C Intel SBR
+C Intel IBR
+C Intel HWL
+C Intel BWL
+C Intel atom
+C VIA nano
+
+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 Torbjörn Granlund.
+
+C Code structure:
+C
+C
+C        m_2(0m4)        m_2(2m4)        m_2(1m4)        m_2(3m4)
+C           |               |               |               |
+C           |               |               |               |
+C           |               |               |               |
+C          \|/             \|/             \|/             \|/
+C              ____________                   ____________
+C             /            \                 /            \
+C            \|/            \               \|/            \
+C         am_2(3m4)       am_2(1m4)       am_2(0m4)       am_2(2m4)
+C            \            /|\                \            /|\
+C             \____________/                  \____________/
+C                       \                        /
+C                        \                      /
+C                         \                    /
+C                       tail(0m2)          tail(1m2)
+C                            \              /
+C                             \            /
+C                            sqr_diag_addlsh1
+
+C TODO
+C  * Tune.  None done so far.
+C  * Currently 2761 bytes, making it smaller would be nice.
+C  * Consider using a jumptab-based entry sequence.  One might even use a mask-
+C    less sequence, if the table is large enough to support tuneup's needs.
+C    The code would be, using non-PIC code,
+C        lea tab(%rip),%rax; jmp *(n,%rax)
+C    or,
+C        lea tab(%rip),%rax; lea (%rip),%rbx; add (n,%rax),%rbx; jmp *%rbx
+C    using PIC code.  The table entries would be Ln1,Ln2,Ln3,Lm0,Lm1,Lm2,Lm3,..
+C    with the last four entries repeated a safe number of times.
+C  * Consider expanding feed-in code in order to avoid zeroing registers.
+C  * Zero consistently with xor.
+C  * Check if using "lea (reg),reg" should be done in more places; we have some
+C    explicit "mov %rax,reg" now.
+C  * Try zeroing with xor in m2 loops.
+C  * Try re-rolling the m2 loops to avoid the current 9 insn code duplication
+C    between loop header and wind-down code.
+C  * Consider adc reg,reg instead of adc $0,reg in m2 loops.  This save a byte.
+
+C When playing with pointers, set this to $2 to fall back to conservative
+C indexing in wind-down code.
+define(`I',`$1')
+
+C Define this to $1 to use late loop index variable as zero, $2 to use an
+C explicit $0.
+define(`Z',`$1')
+
+define(`rp',       `%rdi')
+define(`up',       `%rsi')
+define(`n_param',  `%rdx')
+
+define(`n',        `%r8')
+
+define(`v0',       `%r10')
+define(`v1',       `%r11')
+define(`w0',       `%rbx')
+define(`w1',       `%rcx')
+define(`w2',       `%rbp')
+define(`w3',       `%r9')
+define(`i',        `%r13')
+
+define(`X0',       `%r12')
+define(`X1',       `%r14')
+
+C rax rbx rcx rdx rdi rsi rbp r8 r9 r10 r11 r12 r13 r14 r15
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+define(`ALIGNx', `ALIGN(16)')
+
+define(`N', 85)
+ifdef(`N',,`define(`N',0)')
+define(`MOV', `ifelse(eval(N & $3),0,`mov      $1, $2',`lea    ($1), $2')')
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_sqr_basecase)
+       FUNC_ENTRY(3)
+
+       cmp     $4, n_param
+       jl      L(small)
+
+       push    %rbx
+       push    %rbp
+       push    %r12
+       push    %r13
+       push    %r14
+
+       mov     (up), v0
+       mov     8(up), %rax
+       mov     %rax, v1
+
+       mov     $1, R32(n)
+       sub     n_param, n              C n = -n_param+1
+       push    n
+
+       lea     (up,n_param,8), up
+       lea     (rp,n_param,8), rp
+
+       mul     v0
+
+       test    $1, R8(n)
+       jnz     L(bx1)
+
+L(bx0):        test    $2, R8(n)
+       mov     %rax, (rp,n,8)
+       jnz     L(b10)
+
+L(b00):        lea     (n), i                  C n = 5, 9, ...
+       mov     %rdx, w1                C FIXME: Use lea?
+       xor     R32(w2), R32(w2)
+       jmp     L(m2e0)
+
+L(b10):        lea     2(n), i                 C n = 7, 11, ...
+       mov     8(up,n,8), %rax
+       mov     %rdx, w3                C FIXME: Use lea?
+       xor     R32(w0), R32(w0)
+       xor     R32(w1), R32(w1)
+       jmp     L(m2e2)
+
+L(bx1):        test    $2, R8(n)
+       mov     %rax, (rp,n,8)
+       jz      L(b11)
+
+L(b01):        lea     1(n), i                 C n = 6, 10, ...
+       mov     %rdx, w0                C FIXME: Use lea?
+       xor     R32(w1), R32(w1)
+       jmp     L(m2e1)
+
+L(b11):        lea     -1(n), i                C n = 4, 8, 12, ...
+       mov     %rdx, w2                C FIXME: Use lea?
+       xor     R32(w3), R32(w3)
+       jmp     L(m2e3)
+
+
+       ALIGNx
+L(m2top1):
+       mul     v0
+       add     %rax, w3
+       mov     -8(up,i,8), %rax
+       mov     w3, -8(rp,i,8)
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+L(m2e1):mov    $0, R32(w2)
+       mov     (up,i,8), %rax
+       mul     v0
+       add     %rax, w0
+       mov     w0, (rp,i,8)
+       adc     %rdx, w1
+       mov     (up,i,8), %rax
+       adc     $0, R32(w2)
+       mul     v1
+       add     %rax, w1
+       adc     %rdx, w2
+       mov     8(up,i,8), %rax
+       mul     v0
+       mov     $0, R32(w3)
+       add     %rax, w1
+       adc     %rdx, w2
+       adc     $0, R32(w3)
+       mov     8(up,i,8), %rax
+       mul     v1
+       add     %rax, w2
+       mov     w1, 8(rp,i,8)
+       adc     %rdx, w3
+       mov     $0, R32(w0)
+       mov     16(up,i,8), %rax
+       mul     v0
+       add     %rax, w2
+       mov     16(up,i,8), %rax
+       adc     %rdx, w3
+       adc     $0, R32(w0)
+       mul     v1
+       mov     $0, R32(w1)
+       add     %rax, w3
+       mov     24(up,i,8), %rax
+       mov     w2, 16(rp,i,8)
+       adc     %rdx, w0
+       add     $4, i
+       js      L(m2top1)
+
+       mul     v0
+       add     %rax, w3
+       mov     I(-8(up),-8(up,i,8)), %rax
+       mov     w3, I(-8(rp),-8(rp,i,8))
+       adc     %rdx, w0
+       adc     R32(w1), R32(w1)
+       mul     v1
+       add     w0, %rax
+       adc     w1, %rdx
+       mov     %rax, I((rp),(rp,i,8))
+       mov     %rdx, I(8(rp),8(rp,i,8))
+
+       lea     16(rp), rp
+       add     $2, n                   C decrease |n|
+       jmp     L(am2o3)
+
+       ALIGNx
+L(m2top3):
+       mul     v0
+       add     %rax, w3
+       mov     -8(up,i,8), %rax
+       mov     w3, -8(rp,i,8)
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     $0, R32(w2)
+       mov     (up,i,8), %rax
+       mul     v0
+       add     %rax, w0
+       mov     w0, (rp,i,8)
+       adc     %rdx, w1
+       mov     (up,i,8), %rax
+       adc     $0, R32(w2)
+       mul     v1
+       add     %rax, w1
+       adc     %rdx, w2
+       mov     8(up,i,8), %rax
+       mul     v0
+       mov     $0, R32(w3)
+       add     %rax, w1
+       adc     %rdx, w2
+       adc     $0, R32(w3)
+       mov     8(up,i,8), %rax
+       mul     v1
+       add     %rax, w2
+       mov     w1, 8(rp,i,8)
+       adc     %rdx, w3
+L(m2e3):mov    $0, R32(w0)
+       mov     16(up,i,8), %rax
+       mul     v0
+       add     %rax, w2
+       mov     16(up,i,8), %rax
+       adc     %rdx, w3
+       adc     $0, R32(w0)
+       mul     v1
+       mov     $0, R32(w1)
+       add     %rax, w3
+       mov     24(up,i,8), %rax
+       mov     w2, 16(rp,i,8)
+       adc     %rdx, w0
+       add     $4, i
+       js      L(m2top3)
+
+       mul     v0
+       add     %rax, w3
+       mov     I(-8(up),-8(up,i,8)), %rax
+       mov     w3, I(-8(rp),-8(rp,i,8))
+       adc     %rdx, w0
+       adc     R32(w1), R32(w1)
+       mul     v1
+       add     w0, %rax
+       adc     w1, %rdx
+       mov     %rax, I((rp),(rp,i,8))
+       mov     %rdx, I(8(rp),8(rp,i,8))
+
+       lea     16(rp), rp
+       add     $2, n                   C decrease |n|
+       cmp     $-1, n
+       jz      L(cor1)                 C jumps iff entry n = 4
+
+L(am2o1):
+       mov     -8(up,n,8), v0
+       mov     (up,n,8), %rax
+       mov     %rax, v1
+       lea     1(n), i
+       mul     v0
+       mov     %rax, X1
+       MOV(    %rdx, X0, 128)
+       mov     (rp,n,8), w1
+       xor     R32(w2), R32(w2)
+       mov     8(up,n,8), %rax
+       xor     R32(w3), R32(w3)
+       jmp     L(lo1)
+
+       ALIGNx
+L(am2top1):
+       mul     v1
+       add     w0, w1
+       adc     %rax, w2
+       mov     (up,i,8), %rax
+       MOV(    %rdx, w3, 1)
+       adc     $0, w3
+L(lo1):        mul     v0
+       add     w1, X1
+       mov     X1, -8(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 2)
+       adc     $0, X1
+       mov     (up,i,8), %rax
+       mul     v1
+       MOV(    %rdx, w0, 4)
+       mov     (rp,i,8), w1
+       add     w1, w2
+       adc     %rax, w3
+       adc     $0, w0
+       mov     8(up,i,8), %rax
+       mul     v0
+       add     w2, X0
+       adc     %rax, X1
+       mov     X0, (rp,i,8)
+       MOV(    %rdx, X0, 8)
+       adc     $0, X0
+       mov     8(up,i,8), %rax
+       mov     8(rp,i,8), w2
+       mul     v1
+       add     w2, w3
+       adc     %rax, w0
+       MOV(    %rdx, w1, 16)
+       adc     $0, w1
+       mov     16(up,i,8), %rax
+       mul     v0
+       add     w3, X1
+       mov     X1, 8(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 32)
+       mov     16(rp,i,8), w3
+       adc     $0, X1
+       mov     16(up,i,8), %rax
+       mul     v1
+       add     w3, w0
+       MOV(    %rdx, w2, 64)
+       adc     %rax, w1
+       mov     24(up,i,8), %rax
+       adc     $0, w2
+       mul     v0
+       add     w0, X0
+       mov     X0, 16(rp,i,8)
+       MOV(    %rdx, X0, 128)
+       adc     %rax, X1
+       mov     24(up,i,8), %rax
+       mov     24(rp,i,8), w0
+       adc     $0, X0
+       add     $4, i
+       jnc     L(am2top1)
+
+       mul     v1
+       add     w0, w1
+       adc     w2, %rax
+       adc     Z(i,$0), %rdx
+       add     w1, X1
+       adc     Z(i,$0), X0
+       mov     X1, I(-8(rp),-8(rp,i,8))
+       add     X0, %rax
+       mov     %rax, I((rp),(rp,i,8))
+       adc     Z(i,$0), %rdx
+       mov     %rdx, I(8(rp),8(rp,i,8))
+
+       lea     16(rp), rp
+       add     $2, n
+
+L(am2o3):
+       mov     -8(up,n,8), v0
+       mov     (up,n,8), %rax
+       mov     %rax, v1
+       lea     -1(n), i
+       mul     v0
+       mov     %rax, X1
+       MOV(    %rdx, X0, 8)
+       mov     (rp,n,8), w3
+       xor     R32(w0), R32(w0)
+       xor     R32(w1), R32(w1)
+       mov     8(up,n,8), %rax
+       jmp     L(lo3)
+
+       ALIGNx
+L(am2top3):
+       mul     v1
+       add     w0, w1
+       adc     %rax, w2
+       mov     (up,i,8), %rax
+       MOV(    %rdx, w3, 1)
+       adc     $0, w3
+       mul     v0
+       add     w1, X1
+       mov     X1, -8(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 2)
+       adc     $0, X1
+       mov     (up,i,8), %rax
+       mul     v1
+       MOV(    %rdx, w0, 4)
+       mov     (rp,i,8), w1
+       add     w1, w2
+       adc     %rax, w3
+       adc     $0, w0
+       mov     8(up,i,8), %rax
+       mul     v0
+       add     w2, X0
+       adc     %rax, X1
+       mov     X0, (rp,i,8)
+       MOV(    %rdx, X0, 8)
+       adc     $0, X0
+       mov     8(up,i,8), %rax
+       mov     8(rp,i,8), w2
+       mul     v1
+       add     w2, w3
+       adc     %rax, w0
+       MOV(    %rdx, w1, 16)
+       adc     $0, w1
+       mov     16(up,i,8), %rax
+L(lo3):        mul     v0
+       add     w3, X1
+       mov     X1, 8(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 32)
+       mov     16(rp,i,8), w3
+       adc     $0, X1
+       mov     16(up,i,8), %rax
+       mul     v1
+       add     w3, w0
+       MOV(    %rdx, w2, 64)
+       adc     %rax, w1
+       mov     24(up,i,8), %rax
+       adc     $0, w2
+       mul     v0
+       add     w0, X0
+       mov     X0, 16(rp,i,8)
+       MOV(    %rdx, X0, 128)
+       adc     %rax, X1
+       mov     24(up,i,8), %rax
+       mov     24(rp,i,8), w0
+       adc     $0, X0
+       add     $4, i
+       jnc     L(am2top3)
+
+       mul     v1
+       add     w0, w1
+       adc     w2, %rax
+       adc     Z(i,$0), %rdx
+       add     w1, X1
+       adc     Z(i,$0), X0
+       mov     X1, I(-8(rp),-8(rp,i,8))
+       add     X0, %rax
+       mov     %rax, I((rp),(rp,i,8))
+       adc     Z(i,$0), %rdx
+       mov     %rdx, I(8(rp),8(rp,i,8))
+
+       lea     16(rp), rp
+       add     $2, n
+       cmp     $-1, n
+       jnz     L(am2o1)
+
+L(cor1):pop    n
+       mov     %rdx, w3
+       mov     -16(up), v0
+       mov     -8(up), %rax
+       mul     v0
+       add     w3, %rax
+       adc     $0, %rdx
+       mov     %rax, -8(rp)
+       mov     %rdx, (rp)
+       jmp     L(sqr_diag_addlsh1)
+
+       ALIGNx
+L(m2top2):
+L(m2e2):mul    v0
+       add     %rax, w3
+       mov     -8(up,i,8), %rax
+       mov     w3, -8(rp,i,8)
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     $0, R32(w2)
+       mov     (up,i,8), %rax
+       mul     v0
+       add     %rax, w0
+       mov     w0, (rp,i,8)
+       adc     %rdx, w1
+       mov     (up,i,8), %rax
+       adc     $0, R32(w2)
+       mul     v1
+       add     %rax, w1
+       adc     %rdx, w2
+       mov     8(up,i,8), %rax
+       mul     v0
+       mov     $0, R32(w3)
+       add     %rax, w1
+       adc     %rdx, w2
+       adc     $0, R32(w3)
+       mov     8(up,i,8), %rax
+       mul     v1
+       add     %rax, w2
+       mov     w1, 8(rp,i,8)
+       adc     %rdx, w3
+       mov     $0, R32(w0)
+       mov     16(up,i,8), %rax
+       mul     v0
+       add     %rax, w2
+       mov     16(up,i,8), %rax
+       adc     %rdx, w3
+       adc     $0, R32(w0)
+       mul     v1
+       mov     $0, R32(w1)
+       add     %rax, w3
+       mov     24(up,i,8), %rax
+       mov     w2, 16(rp,i,8)
+       adc     %rdx, w0
+       add     $4, i
+       js      L(m2top2)
+
+       mul     v0
+       add     %rax, w3
+       mov     I(-8(up),-8(up,i,8)), %rax
+       mov     w3, I(-8(rp),-8(rp,i,8))
+       adc     %rdx, w0
+       adc     R32(w1), R32(w1)
+       mul     v1
+       add     w0, %rax
+       adc     w1, %rdx
+       mov     %rax, I((rp),(rp,i,8))
+       mov     %rdx, I(8(rp),8(rp,i,8))
+
+       lea     16(rp), rp
+       add     $2, n                   C decrease |n|
+       jmp     L(am2o0)
+
+       ALIGNx
+L(m2top0):
+       mul     v0
+       add     %rax, w3
+       mov     -8(up,i,8), %rax
+       mov     w3, -8(rp,i,8)
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     $0, R32(w2)
+       mov     (up,i,8), %rax
+       mul     v0
+       add     %rax, w0
+       mov     w0, (rp,i,8)
+       adc     %rdx, w1
+       mov     (up,i,8), %rax
+       adc     $0, R32(w2)
+       mul     v1
+       add     %rax, w1
+       adc     %rdx, w2
+L(m2e0):mov    8(up,i,8), %rax
+       mul     v0
+       mov     $0, R32(w3)
+       add     %rax, w1
+       adc     %rdx, w2
+       adc     $0, R32(w3)
+       mov     8(up,i,8), %rax
+       mul     v1
+       add     %rax, w2
+       mov     w1, 8(rp,i,8)
+       adc     %rdx, w3
+       mov     $0, R32(w0)
+       mov     16(up,i,8), %rax
+       mul     v0
+       add     %rax, w2
+       mov     16(up,i,8), %rax
+       adc     %rdx, w3
+       adc     $0, R32(w0)
+       mul     v1
+       mov     $0, R32(w1)
+       add     %rax, w3
+       mov     24(up,i,8), %rax
+       mov     w2, 16(rp,i,8)
+       adc     %rdx, w0
+       add     $4, i
+       js      L(m2top0)
+
+       mul     v0
+       add     %rax, w3
+       mov     I(-8(up),-8(up,i,8)), %rax
+       mov     w3, I(-8(rp),-8(rp,i,8))
+       adc     %rdx, w0
+       adc     R32(w1), R32(w1)
+       mul     v1
+       add     w0, %rax
+       adc     w1, %rdx
+       mov     %rax, I((rp),(rp,i,8))
+       mov     %rdx, I(8(rp),8(rp,i,8))
+
+       lea     16(rp), rp
+       add     $2, n                   C decrease |n|
+       cmp     $-2, n
+       jz      L(cor2)                 C jumps iff entry n = 5
+
+L(am2o2):
+       mov     -8(up,n,8), v0
+       mov     (up,n,8), %rax
+       mov     %rax, v1
+       lea     -2(n), i
+       mul     v0
+       mov     %rax, X0
+       MOV(    %rdx, X1, 32)
+       mov     (rp,n,8), w0
+       xor     R32(w1), R32(w1)
+       xor     R32(w2), R32(w2)
+       mov     8(up,n,8), %rax
+       jmp     L(lo2)
+
+       ALIGNx
+L(am2top2):
+       mul     v1
+       add     w0, w1
+       adc     %rax, w2
+       mov     (up,i,8), %rax
+       MOV(    %rdx, w3, 1)
+       adc     $0, w3
+       mul     v0
+       add     w1, X1
+       mov     X1, -8(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 2)
+       adc     $0, X1
+       mov     (up,i,8), %rax
+       mul     v1
+       MOV(    %rdx, w0, 4)
+       mov     (rp,i,8), w1
+       add     w1, w2
+       adc     %rax, w3
+       adc     $0, w0
+       mov     8(up,i,8), %rax
+       mul     v0
+       add     w2, X0
+       adc     %rax, X1
+       mov     X0, (rp,i,8)
+       MOV(    %rdx, X0, 8)
+       adc     $0, X0
+       mov     8(up,i,8), %rax
+       mov     8(rp,i,8), w2
+       mul     v1
+       add     w2, w3
+       adc     %rax, w0
+       MOV(    %rdx, w1, 16)
+       adc     $0, w1
+       mov     16(up,i,8), %rax
+       mul     v0
+       add     w3, X1
+       mov     X1, 8(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 32)
+       mov     16(rp,i,8), w3
+       adc     $0, X1
+       mov     16(up,i,8), %rax
+       mul     v1
+       add     w3, w0
+       MOV(    %rdx, w2, 64)
+       adc     %rax, w1
+       mov     24(up,i,8), %rax
+       adc     $0, w2
+L(lo2):        mul     v0
+       add     w0, X0
+       mov     X0, 16(rp,i,8)
+       MOV(    %rdx, X0, 128)
+       adc     %rax, X1
+       mov     24(up,i,8), %rax
+       mov     24(rp,i,8), w0
+       adc     $0, X0
+       add     $4, i
+       jnc     L(am2top2)
+
+       mul     v1
+       add     w0, w1
+       adc     w2, %rax
+       adc     Z(i,$0), %rdx
+       add     w1, X1
+       adc     Z(i,$0), X0
+       mov     X1, I(-8(rp),-8(rp,i,8))
+       add     X0, %rax
+       mov     %rax, I((rp),(rp,i,8))
+       adc     Z(i,$0), %rdx
+       mov     %rdx, I(8(rp),8(rp,i,8))
+
+       lea     16(rp), rp
+       add     $2, n
+
+L(am2o0):
+       mov     -8(up,n,8), v0
+       mov     (up,n,8), %rax
+       mov     %rax, v1
+       lea     0(n), i
+       mul     v0
+       mov     %rax, X0
+       MOV(    %rdx, X1, 2)
+       xor     R32(w0), R32(w0)
+       mov     (rp,n,8), w2
+       xor     R32(w3), R32(w3)
+       jmp     L(lo0)
+
+       ALIGNx
+L(am2top0):
+       mul     v1
+       add     w0, w1
+       adc     %rax, w2
+       mov     (up,i,8), %rax
+       MOV(    %rdx, w3, 1)
+       adc     $0, w3
+       mul     v0
+       add     w1, X1
+       mov     X1, -8(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 2)
+       adc     $0, X1
+       mov     (up,i,8), %rax
+       mul     v1
+       MOV(    %rdx, w0, 4)
+       mov     (rp,i,8), w1
+       add     w1, w2
+       adc     %rax, w3
+       adc     $0, w0
+L(lo0):        mov     8(up,i,8), %rax
+       mul     v0
+       add     w2, X0
+       adc     %rax, X1
+       mov     X0, (rp,i,8)
+       MOV(    %rdx, X0, 8)
+       adc     $0, X0
+       mov     8(up,i,8), %rax
+       mov     8(rp,i,8), w2
+       mul     v1
+       add     w2, w3
+       adc     %rax, w0
+       MOV(    %rdx, w1, 16)
+       adc     $0, w1
+       mov     16(up,i,8), %rax
+       mul     v0
+       add     w3, X1
+       mov     X1, 8(rp,i,8)
+       adc     %rax, X0
+       MOV(    %rdx, X1, 32)
+       mov     16(rp,i,8), w3
+       adc     $0, X1
+       mov     16(up,i,8), %rax
+       mul     v1
+       add     w3, w0
+       MOV(    %rdx, w2, 64)
+       adc     %rax, w1
+       mov     24(up,i,8), %rax
+       adc     $0, w2
+       mul     v0
+       add     w0, X0
+       mov     X0, 16(rp,i,8)
+       MOV(    %rdx, X0, 128)
+       adc     %rax, X1
+       mov     24(up,i,8), %rax
+       mov     24(rp,i,8), w0
+       adc     $0, X0
+       add     $4, i
+       jnc     L(am2top0)
+
+       mul     v1
+       add     w0, w1
+       adc     w2, %rax
+       adc     Z(i,$0), %rdx
+       add     w1, X1
+       adc     Z(i,$0), X0
+       mov     X1, I(-8(rp),-8(rp,i,8))
+       add     X0, %rax
+       mov     %rax, I((rp),(rp,i,8))
+       adc     Z(i,$0), %rdx
+       mov     %rdx, I(8(rp),8(rp,i,8))
+
+       lea     16(rp), rp
+       add     $2, n
+       cmp     $-2, n
+       jnz     L(am2o2)
+
+L(cor2):pop    n
+       mov     -24(up), v0
+       mov     %rax, w2
+       mov     %rdx, w0
+       mov     -16(up), %rax
+       mov     %rax, v1
+       mul     v0
+       mov     %rax, X0
+       MOV(    %rdx, X1, 32)
+       mov     -8(up), %rax
+       mul     v0
+       add     w2, X0
+       mov     X0, -16(rp)
+       MOV(    %rdx, X0, 128)
+       adc     %rax, X1
+       mov     -8(up), %rax
+       adc     $0, X0
+       mul     v1
+       add     w0, X1
+       adc     $0, X0
+       mov     X1, -8(rp)
+       add     X0, %rax
+       mov     %rax, (rp)
+       adc     $0, %rdx
+       mov     %rdx, 8(rp)
+       lea     8(rp), rp
+
+L(sqr_diag_addlsh1):
+       mov     -8(up,n,8), %rax
+       shl     n
+       xor     R32(%rbx), R32(%rbx)
+       mul     %rax
+       mov     8(rp,n,8), %r11
+       lea     (%rdx), %r10
+       mov     16(rp,n,8), %r9
+       add     %r11, %r11
+       jmp     L(dm)
+
+       ALIGNx
+L(dtop):mul    %rax
+       add     %r11, %r10
+       mov     8(rp,n,8), %r11
+       mov     %r10, -8(rp,n,8)
+       adc     %r9, %rax
+       lea     (%rdx,%rbx), %r10
+       mov     16(rp,n,8), %r9
+       adc     %r11, %r11
+L(dm): mov     %rax, (rp,n,8)
+       mov     (up,n,4), %rax
+       adc     %r9, %r9
+       setc    R8(%rbx)
+       add     $2, n
+       js      L(dtop)
+
+       mul     %rax
+       add     %r11, %r10
+       mov     %r10, -8(rp)
+       adc     %r9, %rax
+       lea     (%rdx,%rbx), %r10
+       mov     %rax, (rp)
+       adc     $0, %r10
+       mov     %r10, 8(rp)
+
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+       ALIGN(16)
+L(small):
+       mov     (up), %rax
+       cmp     $2, n_param
+       jae     L(gt1)
+L(n1):
+       mul     %rax
+       mov     %rax, (rp)
+       mov     %rdx, 8(rp)
+       FUNC_EXIT()
+       ret
+
+L(gt1):        jne     L(gt2)
+L(n2): mov     %rax, %r8
+       mul     %rax
+       mov     8(up), %r11
+       mov     %rax, (rp)
+       mov     %r11, %rax
+       mov     %rdx, %r9
+       mul     %rax
+       mov     %rax, %r10
+       mov     %r11, %rax
+       mov     %rdx, %r11
+       mul     %r8
+       xor     %r8, %r8
+       add     %rax, %r9
+       adc     %rdx, %r10
+       adc     %r8, %r11
+       add     %rax, %r9
+       mov     %r9, 8(rp)
+       adc     %rdx, %r10
+       mov     %r10, 16(rp)
+       adc     %r8, %r11
+       mov     %r11, 24(rp)
+       FUNC_EXIT()
+       ret
+
+L(gt2):
+L(n3): mov     %rax, %r10
+       mul     %rax
+       mov     8(up), %r11
+       mov     %rax, (rp)
+       mov     %r11, %rax
+       mov     %rdx, 8(rp)
+       mul     %rax
+       mov     16(up), %rcx
+       mov     %rax, 16(rp)
+       mov     %rcx, %rax
+       mov     %rdx, 24(rp)
+       mul     %rax
+       mov     %rax, 32(rp)
+       mov     %rdx, 40(rp)
+
+       mov     %r11, %rax
+       mul     %r10
+       mov     %rax, %r8
+       mov     %rcx, %rax
+       mov     %rdx, %r9
+       mul     %r10
+       xor     %r10, %r10
+       add     %rax, %r9
+       mov     %r11, %rax
+       mov     %r10, %r11
+       adc     %rdx, %r10
+
+       mul     %rcx
+       add     %rax, %r10
+       adc     %r11, %rdx
+       add     %r8, %r8
+       adc     %r9, %r9
+       adc     %r10, %r10
+       adc     %rdx, %rdx
+       adc     %r11, %r11
+       add     %r8, 8(rp)
+       adc     %r9, 16(rp)
+       adc     %r10, 24(rp)
+       adc     %rdx, 32(rp)
+       adc     %r11, 40(rp)
+       FUNC_EXIT()
+       ret
+EPILOGUE()
index c37ac2f0353312647f00be5aec3aa94fe641b4bb..46488fcafeb671e00dc72f3dfbf46859f5e0d758 100644 (file)
@@ -2,22 +2,33 @@ dnl  AMD64 mpn_sublsh1_n optimised for Core 2 and Core iN.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 9ad9ad48111ef30af369a420728a206c8493515b..f3b1e2846467e00016a9ed9e8505a0eb2cd8be6a 100644 (file)
@@ -2,22 +2,33 @@ dnl  AMD64 mpn_sublsh2_n optimised for Core 2 and Core iN.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 3430a06442bc6a4e7d7d32fc33c610b6cd14b268..5acc46b032a49f6b7e8f6196fa4ed56fd6268f69 100644 (file)
@@ -3,22 +3,33 @@ dnl  Core iN.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 C           cycles/limb
 C AMD K8,K9     4.25
diff --git a/mpn/x86_64/coreihwl/addmul_2.asm b/mpn/x86_64/coreihwl/addmul_2.asm
new file mode 100644 (file)
index 0000000..54aebc8
--- /dev/null
@@ -0,0 +1,238 @@
+dnl  AMD64 mpn_addmul_2 optimised for Intel Haswell.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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      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     2.15
+C Intel BWL     ?
+C Intel atom   n/a
+C VIA nano     n/a
+
+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.
+
+define(`rp',     `%rdi')
+define(`up',     `%rsi')
+define(`n_param',`%rdx')
+define(`vp',     `%rcx')
+
+define(`v0', `%r8')
+define(`v1', `%r9')
+define(`w0', `%rbx')
+define(`w1', `%rcx')
+define(`w2', `%rbp')
+define(`w3', `%r10')
+define(`n',  `%r11')
+define(`X0', `%r12')
+define(`X1', `%r13')
+
+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     n_param, n
+       shr     $2, n
+
+       test    $1, R8(n_param)
+       jnz     L(bx1)
+
+L(bx0):        mov     (rp), X0
+       mov     8(rp), X1
+       test    $2, R8(n_param)
+       jnz     L(b10)
+
+L(b00):        mov     (up), %rdx
+       lea     16(up), up
+       mulx(   v0, %rax, w1)
+       add     %rax, X0
+       mulx(   v1, %rax, w2)
+       adc     $0, w1
+       mov     X0, (rp)
+       add     %rax, X1
+       adc     $0, w2
+       mov     -8(up), %rdx
+       lea     16(rp), rp
+       jmp     L(lo0)
+
+L(b10):        mov     (up), %rdx
+       inc     n
+       mulx(   v0, %rax, w1)
+       add     %rax, X0
+       adc     $0, w1
+       mulx(   v1, %rax, w2)
+       mov     X0, (rp)
+       mov     16(rp), X0
+       add     %rax, X1
+       adc     $0, w2
+       xor     w0, w0
+       jmp     L(lo2)
+
+L(bx1):        mov     (rp), X1
+       mov     8(rp), X0
+       test    $2, R8(n_param)
+       jnz     L(b11)
+
+L(b01):        mov     (up), %rdx
+       mulx(   v0, %rax, w3)
+       add     %rax, X1
+       adc     $0, w3
+       mulx(   v1, %rax, w0)
+       add     %rax, X0
+       adc     $0, w0
+       mov     8(up), %rdx
+       mov     X1, (rp)
+       mov     16(rp), X1
+       mulx(   v0, %rax, w1)
+       lea     24(rp), rp
+       lea     24(up), up
+       jmp     L(lo1)
+
+L(b11):        mov     (up), %rdx
+       inc     n
+       mulx(   v0, %rax, w3)
+       add     %rax, X1
+       adc     $0, w3
+       mulx(   v1, %rax, w0)
+       add     %rax, X0
+       adc     $0, w0
+       mov     X1, (rp)
+       mov     8(up), %rdx
+       mulx(   v0, %rax, w1)
+       lea     8(rp), rp
+       lea     8(up), up
+       jmp     L(lo3)
+
+       ALIGN(16)
+L(top):        mulx(   v0, %rax, w3)
+       add     w0, X1
+       adc     $0, w2
+       add     %rax, X1
+       adc     $0, w3
+       mulx(   v1, %rax, w0)
+       add     %rax, X0
+       adc     $0, w0
+       lea     32(rp), rp
+       add     w1, X1
+       mov     -16(up), %rdx
+       mov     X1, -24(rp)
+       adc     $0, w3
+       add     w2, X0
+       mov     -8(rp), X1
+       mulx(   v0, %rax, w1)
+       adc     $0, w0
+L(lo1):        add     %rax, X0
+       mulx(   v1, %rax, w2)
+       adc     $0, w1
+       add     w3, X0
+       mov     X0, -16(rp)
+       adc     $0, w1
+       add     %rax, X1
+       adc     $0, w2
+       add     w0, X1
+       mov     -8(up), %rdx
+       adc     $0, w2
+L(lo0):        mulx(   v0, %rax, w3)
+       add     %rax, X1
+       adc     $0, w3
+       mov     (rp), X0
+       mulx(   v1, %rax, w0)
+       add     %rax, X0
+       adc     $0, w0
+       add     w1, X1
+       mov     X1, -8(rp)
+       adc     $0, w3
+       mov     (up), %rdx
+       add     w2, X0
+       mulx(   v0, %rax, w1)
+       adc     $0, w0
+L(lo3):        add     %rax, X0
+       adc     $0, w1
+       mulx(   v1, %rax, w2)
+       add     w3, X0
+       mov     8(rp), X1
+       mov     X0, (rp)
+       mov     16(rp), X0
+       adc     $0, w1
+       add     %rax, X1
+       adc     $0, w2
+L(lo2):        mov     8(up), %rdx
+       lea     32(up), up
+       dec     n
+       jnz     L(top)
+
+L(end):        mulx(   v0, %rax, w3)
+       add     w0, X1
+       adc     $0, w2
+       add     %rax, X1
+       adc     $0, w3
+       mulx(   v1, %rdx, %rax)
+       add     w1, X1
+       mov     X1, 8(rp)
+       adc     $0, w3
+       add     w2, %rdx
+       adc     $0, %rax
+       add     w3, %rdx
+       mov     %rdx, 16(rp)
+       adc     $0, %rax
+
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
diff --git a/mpn/x86_64/coreihwl/aorsmul_1.asm b/mpn/x86_64/coreihwl/aorsmul_1.asm
new file mode 100644 (file)
index 0000000..fd5a26d
--- /dev/null
@@ -0,0 +1,198 @@
+dnl  AMD64 mpn_addmul_1 and mpn_submul_1 optimised for Intel Haswell.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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      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     2.32
+C Intel BWL     ?
+C Intel atom   n/a
+C VIA nano     n/a
+
+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.
+
+C TODO
+C  * Handle small n separately, for lower overhead.
+
+define(`rp',      `%rdi')   C rcx
+define(`up',      `%rsi')   C rdx
+define(`n_param', `%rdx')   C r8
+define(`v0_param',`%rcx')   C r9
+
+define(`n',       `%rbp')
+define(`v0',      `%rdx')
+
+ifdef(`OPERATION_addmul_1',`
+  define(`ADDSUB',        `add')
+  define(`ADCSBB',        `adc')
+  define(`func',  `mpn_addmul_1')
+')
+ifdef(`OPERATION_submul_1',`
+  define(`ADDSUB',        `sub')
+  define(`ADCSBB',        `sbb')
+  define(`func',  `mpn_submul_1')
+')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(func)
+       FUNC_ENTRY(4)
+       push    %rbx
+       push    %rbp
+       push    %r12
+       push    %r13
+
+       mov     n_param, n
+       mov     v0_param, v0
+
+       test    $1, R8(n)
+       jnz     L(bx1)
+
+L(bx0):        shr     $2, n
+       jc      L(b10)
+
+L(b00):        mulx(   (up), %r13, %r12)
+       mulx(   8,(up), %rbx, %rax)
+       add     %r12, %rbx
+       adc     $0, %rax
+       mov     (rp), %r12
+       mov     8(rp), %rcx
+       mulx(   16,(up), %r9, %r8)
+       lea     -16(rp), rp
+       lea     16(up), up
+       ADDSUB  %r13, %r12
+       jmp     L(lo0)
+
+L(bx1):        shr     $2, n
+       jc      L(b11)
+
+L(b01):        mulx(   (up), %r11, %r10)
+       jnz     L(gt1)
+L(n1): ADDSUB  %r11, (rp)
+       mov     $0, R32(%rax)
+       adc     %r10, %rax
+       jmp     L(ret)
+
+L(gt1):        mulx(   8,(up), %r13, %r12)
+       mulx(   16,(up), %rbx, %rax)
+       lea     24(up), up
+       add     %r10, %r13
+       adc     %r12, %rbx
+       adc     $0, %rax
+       mov     (rp), %r10
+       mov     8(rp), %r12
+       mov     16(rp), %rcx
+       lea     -8(rp), rp
+       ADDSUB  %r11, %r10
+       jmp     L(lo1)
+
+L(b11):        mulx(   (up), %rbx, %rax)
+       mov     (rp), %rcx
+       mulx(   8,(up), %r9, %r8)
+       lea     8(up), up
+       lea     -24(rp), rp
+       inc     n                       C adjust n
+       ADDSUB  %rbx, %rcx
+       jmp     L(lo3)
+
+L(b10):        mulx(   (up), %r9, %r8)
+       mulx(   8,(up), %r11, %r10)
+       lea     -32(rp), rp
+       mov     $0, R32(%rax)
+       clc                             C clear cf
+       jz      L(end)                  C depends on old shift
+
+       ALIGN(16)
+L(top):        adc     %rax, %r9
+       lea     32(rp), rp
+       adc     %r8, %r11
+       mulx(   16,(up), %r13, %r12)
+       mov     (rp), %r8
+       mulx(   24,(up), %rbx, %rax)
+       lea     32(up), up
+       adc     %r10, %r13
+       adc     %r12, %rbx
+       adc     $0, %rax
+       mov     8(rp), %r10
+       mov     16(rp), %r12
+       ADDSUB  %r9, %r8
+       mov     24(rp), %rcx
+       mov     %r8, (rp)
+       ADCSBB  %r11, %r10
+L(lo1):        mulx(   (up), %r9, %r8)
+       mov     %r10, 8(rp)
+       ADCSBB  %r13, %r12
+L(lo0):        mov     %r12, 16(rp)
+       ADCSBB  %rbx, %rcx
+L(lo3):        mulx(   8,(up), %r11, %r10)
+       mov     %rcx, 24(rp)
+       dec     n
+       jnz     L(top)
+
+L(end):        adc     %rax, %r9
+       adc     %r8, %r11
+       mov     32(rp), %r8
+       mov     %r10, %rax
+       adc     $0, %rax
+       mov     40(rp), %r10
+       ADDSUB  %r9, %r8
+       mov     %r8, 32(rp)
+       ADCSBB  %r11, %r10
+       mov     %r10, 40(rp)
+       adc     $0, %rax
+
+L(ret):        pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
diff --git a/mpn/x86_64/coreihwl/gmp-mparam.h b/mpn/x86_64/coreihwl/gmp-mparam.h
new file mode 100644 (file)
index 0000000..eef44b3
--- /dev/null
@@ -0,0 +1,237 @@
+/* Haswell gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 1991, 1993, 1994, 2000-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 64
+#define GMP_LIMB_BYTES 8
+
+/* 2900 MHz Core i5 Haswell */
+/* FFT tuning limit = 75000000 */
+/* 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          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        26
+#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           25
+
+#define MUL_TOOM22_THRESHOLD                22
+#define MUL_TOOM33_THRESHOLD                74
+#define MUL_TOOM44_THRESHOLD               195
+#define MUL_TOOM6H_THRESHOLD               298
+#define MUL_TOOM8H_THRESHOLD               406
+
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD     121
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD     138
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD     128
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD     132
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     170
+
+#define SQR_BASECASE_THRESHOLD               0  /* always (native) */
+#define SQR_TOOM2_THRESHOLD                 34
+#define SQR_TOOM3_THRESHOLD                117
+#define SQR_TOOM4_THRESHOLD                336
+#define SQR_TOOM6_THRESHOLD                426
+#define SQR_TOOM8_THRESHOLD                562
+
+#define MULMID_TOOM42_THRESHOLD             42
+
+#define MULMOD_BNM1_THRESHOLD               13
+#define SQRMOD_BNM1_THRESHOLD               17
+
+#define MUL_FFT_MODF_THRESHOLD             376  /* k = 5 */
+#define MUL_FFT_TABLE3                                      \
+  { {    376, 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}, {     24, 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}, {     55,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, 9}, {    319,10}, \
+    {    167,11}, {     95,10}, {    191, 9}, {    383,11}, \
+    {    111,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,10}, {    415,13}, \
+    {     63,12}, {    127,11}, {    255,10}, {    511,11}, \
+    {    271,10}, {    543, 9}, {   1087,11}, {    287,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,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,11}, {    735,13}, \
+    {    191,12}, {    383,11}, {    767,12}, {    415,11}, \
+    {    831,10}, {   1663,12}, {    447,11}, {    895,12}, \
+    {    479,14}, {    127,12}, {    511,11}, {   1023,12}, \
+    {    543,11}, {   1087,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,13}, \
+    {    447,12}, {    959,11}, {   1919,13}, {    511,12}, \
+    {   1087,13}, {    575,12}, {   1215,13}, {    639,12}, \
+    {   1343,13}, {    703,12}, {   1407,11}, {   2815,14}, \
+    {    383,13}, {    767,12}, {   1535,13}, {    831,12}, \
+    {   1727,13}, {    959,12}, {   1919,14}, {    511,13}, \
+    {   1023,12}, {   2047,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}, \
+    {   1535,12}, {   3071,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}, {   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}, \
+    {   1279,14}, {   2943,13}, {   5887,15}, {   1535,14}, \
+    {   3455,13}, {   6911,15}, {   1791,14}, {   3839,13}, \
+    {   7679,16}, {   1023,15}, {   2047,14}, {   4351,15}, \
+    {  32768,16}, {  65536,17}, { 131072,18}, { 262144,19}, \
+    { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
+    {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 237
+#define MUL_FFT_THRESHOLD                 4224
+
+#define SQR_FFT_MODF_THRESHOLD             344  /* k = 5 */
+#define SQR_FFT_TABLE3                                      \
+  { {    344, 5}, {     17, 6}, {      9, 5}, {     19, 6}, \
+    {     10, 5}, {     21, 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}, {     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}, {     55,11}, {     31,10}, {     79,11}, \
+    {     47,10}, {     95,12}, {     31,11}, {     63,10}, \
+    {    127, 9}, {    255, 8}, {    511,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, 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,10}, {    415,13}, {     63,12}, \
+    {    127,11}, {    255,10}, {    511,11}, {    271,10}, \
+    {    543, 9}, {   1087,10}, {    575,11}, {    303,10}, \
+    {    607,11}, {    319,10}, {    671,11}, {    351,10}, \
+    {    735,11}, {    383,10}, {    767,11}, {    415,10}, \
+    {    831,11}, {    447,10}, {    895,11}, {    479,13}, \
+    {    127,12}, {    255,11}, {    543,10}, {   1087,11}, \
+    {    607,10}, {   1215,11}, {    671,12}, {    351,11}, \
+    {    735,12}, {    383,11}, {    767,12}, {    415,11}, \
+    {    831,10}, {   1663,12}, {    447,11}, {    895,12}, \
+    {    479,14}, {    127,12}, {    511,11}, {   1023,12}, \
+    {    543,11}, {   1087,12}, {    607,11}, {   1215,13}, \
+    {    319,12}, {    639,11}, {   1279,12}, {    671,11}, \
+    {   1343,12}, {    735,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,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}, \
+    {   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,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}, {  32768,16}, {  65536,17}, { 131072,18}, \
+    { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
+    {4194304,23}, {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 206
+#define SQR_FFT_THRESHOLD                 3712
+
+#define MULLO_BASECASE_THRESHOLD             0  /* always */
+#define MULLO_DC_THRESHOLD                  78
+#define MULLO_MUL_N_THRESHOLD             8207
+
+#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 INV_MULMOD_BNM1_THRESHOLD           42
+#define INV_NEWTON_THRESHOLD               199
+#define INV_APPR_THRESHOLD                 181
+
+#define BINV_NEWTON_THRESHOLD              236
+#define REDC_1_TO_REDC_2_THRESHOLD          47
+#define REDC_2_TO_REDC_N_THRESHOLD          62
+
+#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 POWM_SEC_TABLE  3,22,194,257,1099
+
+#define MATRIX22_STRASSEN_THRESHOLD         17
+#define HGCD_THRESHOLD                     112
+#define HGCD_APPR_THRESHOLD                 52
+#define HGCD_REDUCE_THRESHOLD             2681
+#define GCD_DC_THRESHOLD                   807
+#define GCDEXT_DC_THRESHOLD                416
+#define JACOBI_BASE_METHOD                   4
+
+#define GET_STR_DC_THRESHOLD                12
+#define GET_STR_PRECOMPUTE_THRESHOLD        21
+#define SET_STR_DC_THRESHOLD              1326
+#define SET_STR_PRECOMPUTE_THRESHOLD      2627
+
+#define FAC_DSC_THRESHOLD                  767
+#define FAC_ODD_THRESHOLD                    0  /* always */
diff --git a/mpn/x86_64/coreihwl/mul_1.asm b/mpn/x86_64/coreihwl/mul_1.asm
new file mode 100644 (file)
index 0000000..1e3c338
--- /dev/null
@@ -0,0 +1,155 @@
+dnl  AMD64 mpn_mul_1 using mulx optimised for Intel Haswell.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2012, 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        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 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(`v0_param',`%rcx')   C r9
+
+define(`n',       `%rbp')
+define(`v0',      `%rdx')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_mul_1)
+       FUNC_ENTRY(4)
+       push    %rbx
+       push    %rbp
+       push    %r12
+
+       mov     n_param, n
+       shr     $2, n
+
+       test    $1, R8(n_param)
+       jnz     L(bx1)
+
+L(bx0):        test    $2, R8(n_param)
+       mov     v0_param, v0
+       jnz     L(b10)
+
+L(b00):        mulx(   (up), %r9, %r8)
+       mulx(   8,(up), %r11, %r10)
+       mulx(   16,(up), %rcx, %r12)
+       lea     -32(rp), rp
+       jmp     L(lo0)
+
+L(b10):        mulx(   (up), %rcx, %r12)
+       mulx(   8,(up), %rbx, %rax)
+       lea     -16(rp), rp
+       test    n, n
+       jz      L(cj2)
+       mulx(   16,(up), %r9, %r8)
+       lea     16(up), up
+       jmp     L(lo2)
+
+L(bx1):        test    $2, R8(n_param)
+       mov     v0_param, v0
+       jnz     L(b11)
+
+L(b01):        mulx(   (up), %rbx, %rax)
+       lea     -24(rp), rp
+       test    n, n
+       jz      L(cj1)
+       mulx(   8,(up), %r9, %r8)
+       lea     8(up), up
+       jmp     L(lo1)
+
+L(b11):        mulx(   (up), %r11, %r10)
+       mulx(   8,(up), %rcx, %r12)
+       mulx(   16,(up), %rbx, %rax)
+       lea     -8(rp), rp
+       test    n, n
+       jz      L(cj3)
+       lea     24(up), up
+       jmp     L(lo3)
+
+       ALIGN(32)
+L(top):        lea     32(rp), rp
+       mov     %r9, (rp)
+       adc     %r8, %r11
+L(lo3):        mulx(   (up), %r9, %r8)
+       mov     %r11, 8(rp)
+       adc     %r10, %rcx
+L(lo2):        mov     %rcx, 16(rp)
+       adc     %r12, %rbx
+L(lo1):        mulx(   8,(up), %r11, %r10)
+       adc     %rax, %r9
+       mulx(   16,(up), %rcx, %r12)
+       mov     %rbx, 24(rp)
+L(lo0):        mulx(   24,(up), %rbx, %rax)
+       lea     32(up), up
+       dec     n
+       jnz     L(top)
+
+L(end):        lea     32(rp), rp
+       mov     %r9, (rp)
+       adc     %r8, %r11
+L(cj3):        mov     %r11, 8(rp)
+       adc     %r10, %rcx
+L(cj2):        mov     %rcx, 16(rp)
+       adc     %r12, %rbx
+L(cj1):        mov     %rbx, 24(rp)
+       adc     $0, %rax
+
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
+ASM_END()
diff --git a/mpn/x86_64/coreihwl/mul_2.asm b/mpn/x86_64/coreihwl/mul_2.asm
new file mode 100644 (file)
index 0000000..5bdb1aa
--- /dev/null
@@ -0,0 +1,173 @@
+dnl  AMD64 mpn_mul_2 optimised for Intel Haswell.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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      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 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.
+
+C TODO
+C  * Move test and jcc together, for insn fusion.
+
+define(`rp',     `%rdi')
+define(`up',     `%rsi')
+define(`n_param',`%rdx')
+define(`vp',     `%rcx')
+
+define(`v0', `%r8')
+define(`v1', `%r9')
+define(`w0', `%rbx')
+define(`w1', `%rcx')
+define(`w2', `%rbp')
+define(`w3', `%r10')
+define(`n',  `%r11')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_mul_2)
+       FUNC_ENTRY(4)
+       push    %rbx
+       push    %rbp
+
+       mov     (vp), v0
+       mov     8(vp), v1
+
+       lea     3(n_param), n
+       shr     $2, n
+
+       test    $1, R8(n_param)
+       jnz     L(bx1)
+
+L(bx0):        xor     w0, w0
+       test    $2, R8(n_param)
+       mov     (up), %rdx
+       mulx(   v0, w2, w1)
+       jz      L(lo0)
+
+L(b10):        lea     -16(rp), rp
+       lea     -16(up), up
+       jmp     L(lo2)
+
+L(bx1):        xor     w2, w2
+       test    $2, R8(n_param)
+       mov     (up), %rdx
+       mulx(   v0, w0, w3)
+       jnz     L(b11)
+
+L(b01):        lea     -24(rp), rp
+       lea     8(up), up
+       jmp     L(lo1)
+
+L(b11):        lea     -8(rp), rp
+       lea     -8(up), up
+       jmp     L(lo3)
+
+       ALIGN(16)
+L(top):        mulx(   v1, %rax, w0)
+       add     %rax, w2                C 0
+       mov     (up), %rdx
+       mulx(   v0, %rax, w1)
+       adc     $0, w0                  C 1
+       add     %rax, w2                C 0
+       adc     $0, w1                  C 1
+       add     w3, w2                  C 0
+L(lo0):        mov     w2, (rp)                C 0
+       adc     $0, w1                  C 1
+       mulx(   v1, %rax, w2)
+       add     %rax, w0                C 1
+       mov     8(up), %rdx
+       adc     $0, w2                  C 2
+       mulx(   v0, %rax, w3)
+       add     %rax, w0                C 1
+       adc     $0, w3                  C 2
+       add     w1, w0                  C 1
+L(lo3):        mov     w0, 8(rp)               C 1
+       adc     $0, w3                  C 2
+       mulx(   v1, %rax, w0)
+       add     %rax, w2                C 2
+       mov     16(up), %rdx
+       mulx(   v0, %rax, w1)
+       adc     $0, w0                  C 3
+       add     %rax, w2                C 2
+       adc     $0, w1                  C 3
+       add     w3, w2                  C 2
+L(lo2):        mov     w2, 16(rp)              C 2
+       adc     $0, w1                  C 3
+       mulx(   v1, %rax, w2)
+       add     %rax, w0                C 3
+       mov     24(up), %rdx
+       adc     $0, w2                  C 4
+       mulx(   v0, %rax, w3)
+       add     %rax, w0                C 3
+       adc     $0, w3                  C 4
+       add     w1, w0                  C 3
+       lea     32(up), up
+L(lo1):        mov     w0, 24(rp)              C 3
+       adc     $0, w3                  C 4
+       dec     n
+       lea     32(rp), rp
+       jnz     L(top)
+
+L(end):        mulx(   v1, %rdx, %rax)
+       add     %rdx, w2
+       adc     $0, %rax
+       add     w3, w2
+       mov     w2, (rp)
+       adc     $0, %rax
+
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
diff --git a/mpn/x86_64/coreihwl/mul_basecase.asm b/mpn/x86_64/coreihwl/mul_basecase.asm
new file mode 100644 (file)
index 0000000..b2656c8
--- /dev/null
@@ -0,0 +1,441 @@
+dnl  AMD64 mpn_mul_basecase optimised for Intel Haswell.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2003-2005, 2007, 2008, 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')
+
+C cycles/limb  mul_1           mul_2           mul_3           addmul_2
+C AMD K8,K9    n/a             n/a              -              n/a
+C AMD K10      n/a             n/a              -              n/a
+C AMD bull     n/a             n/a              -              n/a
+C AMD pile     n/a             n/a              -              n/a
+C AMD steam     ?               ?               -               ?
+C AMD bobcat   n/a             n/a              -              n/a
+C AMD jaguar    ?               ?               -               ?
+C Intel P4     n/a             n/a              -              n/a
+C Intel core   n/a             n/a              -              n/a
+C Intel NHM    n/a             n/a              -              n/a
+C Intel SBR    n/a             n/a              -              n/a
+C Intel IBR    n/a             n/a              -              n/a
+C Intel HWL     1.77            1.86            -               2.15
+C Intel BWL     ?               ?               -               ?
+C Intel atom   n/a             n/a              -              n/a
+C VIA nano     n/a             n/a              -              n/a
+
+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 Torbjörn Granlund.
+
+C TODO
+C  * Adjoin a mul_3.
+C  * Further micro-optimise.
+
+define(`rp',      `%rdi')
+define(`up',      `%rsi')
+define(`un_param',`%rdx')
+define(`vp',      `%rcx')
+define(`vn',      `%r8')
+
+define(`un',      `%rbx')
+
+define(`w0',   `%r10')
+define(`w1',   `%r11')
+define(`w2',   `%r12')
+define(`w3',   `%r13')
+define(`n',    `%rbp')
+define(`v0',   `%r9')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_mul_basecase)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8d  ')
+       push    %rbx
+       push    %rbp
+       push    %r12
+       push    %r13
+       push    %r14
+       mov     un_param, un            C free up rdx
+       neg     un
+
+       mov     un_param, n             C FIXME: share
+       sar     $2, n                   C FIXME: share
+
+       test    $1, R8(vn)
+       jz      L(do_mul_2)
+
+define(`w4',   `%r9')
+define(`w5',   `%r14')
+
+       mov     (vp), %rdx
+
+L(do_mul_1):
+       test    $1, R8(un)
+       jnz     L(m1x1)
+
+L(m1x0):test   $2, R8(un)
+       jnz     L(m110)
+
+L(m100):
+       mulx(   (up), w5, w2)
+       mulx(   8,(up), w1, w3)
+       lea     -24(rp), rp
+       jmp     L(m1l0)
+
+L(m110):
+       mulx(   (up), w3, w4)
+       mulx(   8,(up), w1, w5)
+       lea     -8(rp), rp
+       test    n, n
+       jz      L(cj2)
+       mulx(   16,(up), w0, w2)
+       lea     16(up), up
+       jmp     L(m1l2)
+
+L(m1x1):test   $2, R8(un)
+       jz      L(m111)
+
+L(m101):
+       mulx(   (up), w4, w5)
+       lea     -16(rp), rp
+       test    n, n
+       jz      L(cj1)
+       mulx(   8,(up), w0, w2)
+       lea     8(up), up
+       jmp     L(m1l1)
+
+L(m111):
+       mulx(   (up), w2, w3)
+       mulx(   8,(up), w0, w4)
+       mulx(   16,(up), w1, w5)
+       lea     24(up), up
+       test    n, n
+       jnz     L(gt3)
+       add     w0, w3
+       jmp     L(cj3)
+L(gt3):        add     w0, w3
+       jmp     L(m1l3)
+
+       ALIGN(32)
+L(m1tp):lea    32(rp), rp
+L(m1l3):mov    w2, (rp)
+       mulx(   (up), w0, w2)
+L(m1l2):mov    w3, 8(rp)
+       adc     w1, w4
+L(m1l1):adc    w0, w5
+       mov     w4, 16(rp)
+       mulx(   8,(up), w1, w3)
+L(m1l0):mov    w5, 24(rp)
+       mulx(   16,(up), w0, w4)
+       adc     w1, w2
+       mulx(   24,(up), w1, w5)
+       adc     w0, w3
+       lea     32(up), up
+       dec     n
+       jnz     L(m1tp)
+
+L(m1ed):lea    32(rp), rp
+L(cj3):        mov     w2, (rp)
+L(cj2):        mov     w3, 8(rp)
+       adc     w1, w4
+L(cj1):        mov     w4, 16(rp)
+       adc     $0, w5
+       mov     w5, 24(rp)
+
+       dec     R32(vn)
+       jz      L(ret5)
+
+       lea     8(vp), vp
+       lea     32(rp), rp
+C      push    %r12
+C      push    %r13
+C      push    %r14
+       jmp     L(do_addmul)
+
+L(do_mul_2):
+define(`v1',   `%r14')
+C      push    %r12
+C      push    %r13
+C      push    %r14
+
+       mov     (vp), v0
+       mov     8(vp), v1
+
+       lea     (un), n
+       sar     $2, n
+
+       test    $1, R8(un)
+       jnz     L(m2x1)
+
+L(m2x0):xor    w0, w0
+       test    $2, R8(un)
+       mov     (up), %rdx
+       mulx(   v0, w2, w1)
+       jz      L(m2l0)
+
+L(m210):lea    -16(rp), rp
+       lea     -16(up), up
+       jmp     L(m2l2)
+
+L(m2x1):xor    w2, w2
+       test    $2, R8(un)
+       mov     (up), %rdx
+       mulx(   v0, w0, w3)
+       jz      L(m211)
+
+L(m201):lea    -24(rp), rp
+       lea     8(up), up
+       jmp     L(m2l1)
+
+L(m211):lea    -8(rp), rp
+       lea     -8(up), up
+       jmp     L(m2l3)
+
+       ALIGN(16)
+L(m2tp):mulx(  v1, %rax, w0)
+       add     %rax, w2
+       mov     (up), %rdx
+       mulx(   v0, %rax, w1)
+       adc     $0, w0
+       add     %rax, w2
+       adc     $0, w1
+       add     w3, w2
+L(m2l0):mov    w2, (rp)
+       adc     $0, w1
+       mulx(   v1, %rax, w2)
+       add     %rax, w0
+       mov     8(up), %rdx
+       adc     $0, w2
+       mulx(   v0, %rax, w3)
+       add     %rax, w0
+       adc     $0, w3
+       add     w1, w0
+L(m2l3):mov    w0, 8(rp)
+       adc     $0, w3
+       mulx(   v1, %rax, w0)
+       add     %rax, w2
+       mov     16(up), %rdx
+       mulx(   v0, %rax, w1)
+       adc     $0, w0
+       add     %rax, w2
+       adc     $0, w1
+       add     w3, w2
+L(m2l2):mov    w2, 16(rp)
+       adc     $0, w1
+       mulx(   v1, %rax, w2)
+       add     %rax, w0
+       mov     24(up), %rdx
+       adc     $0, w2
+       mulx(   v0, %rax, w3)
+       add     %rax, w0
+       adc     $0, w3
+       add     w1, w0
+       lea     32(up), up
+L(m2l1):mov    w0, 24(rp)
+       adc     $0, w3
+       inc     n
+       lea     32(rp), rp
+       jnz     L(m2tp)
+
+L(m2ed):mulx(  v1, %rdx, %rax)
+       add     %rdx, w2
+       adc     $0, %rax
+       add     w3, w2
+       mov     w2, (rp)
+       adc     $0, %rax
+       mov     %rax, 8(rp)
+
+       add     $-2, R32(vn)
+       jz      L(ret5)
+       lea     16(vp), vp
+       lea     16(rp), rp
+
+
+L(do_addmul):
+       push    %r15
+       push    vn                      C save vn in new stack slot
+define(`vn',   `(%rsp)')
+define(`X0',   `%r14')
+define(`X1',   `%r15')
+define(`v1',   `%r8')
+
+       lea     (rp,un,8), rp
+       lea     (up,un,8), up
+
+L(outer):
+       mov     (vp), v0
+       mov     8(vp), v1
+
+       lea     2(un), n
+       sar     $2, n
+
+       mov     (up), %rdx
+       test    $1, R8(un)
+       jnz     L(bx1)
+
+L(bx0):        mov     (rp), X0
+       mov     8(rp), X1
+       mulx(   v0, %rax, w1)
+       add     %rax, X0
+       mulx(   v1, %rax, w2)
+       adc     $0, w1
+       mov     X0, (rp)
+       add     %rax, X1
+       adc     $0, w2
+       mov     8(up), %rdx
+       test    $2, R8(un)
+       jnz     L(b10)
+
+L(b00):        lea     16(up), up
+       lea     16(rp), rp
+       jmp     L(lo0)
+
+L(b10):        mov     16(rp), X0
+       lea     32(up), up
+       mulx(   v0, %rax, w3)
+       jmp     L(lo2)
+
+L(bx1):        mov     (rp), X1
+       mov     8(rp), X0
+       mulx(   v0, %rax, w3)
+       add     %rax, X1
+       adc     $0, w3
+       mulx(   v1, %rax, w0)
+       add     %rax, X0
+       adc     $0, w0
+       mov     8(up), %rdx
+       mov     X1, (rp)
+       mulx(   v0, %rax, w1)
+       test    $2, R8(un)
+       jz      L(b11)
+
+L(b01):        mov     16(rp), X1
+       lea     24(rp), rp
+       lea     24(up), up
+       jmp     L(lo1)
+
+L(b11):        lea     8(rp), rp
+       lea     8(up), up
+       jmp     L(lo3)
+
+       ALIGN(16)
+L(top):        mulx(   v0, %rax, w3)
+       add     w0, X1
+       adc     $0, w2
+L(lo2):        add     %rax, X1
+       adc     $0, w3
+       mulx(   v1, %rax, w0)
+       add     %rax, X0
+       adc     $0, w0
+       lea     32(rp), rp
+       add     w1, X1
+       mov     -16(up), %rdx
+       mov     X1, -24(rp)
+       adc     $0, w3
+       add     w2, X0
+       mov     -8(rp), X1
+       mulx(   v0, %rax, w1)
+       adc     $0, w0
+L(lo1):        add     %rax, X0
+       mulx(   v1, %rax, w2)
+       adc     $0, w1
+       add     w3, X0
+       mov     X0, -16(rp)
+       adc     $0, w1
+       add     %rax, X1
+       adc     $0, w2
+       add     w0, X1
+       mov     -8(up), %rdx
+       adc     $0, w2
+L(lo0):        mulx(   v0, %rax, w3)
+       add     %rax, X1
+       adc     $0, w3
+       mov     (rp), X0
+       mulx(   v1, %rax, w0)
+       add     %rax, X0
+       adc     $0, w0
+       add     w1, X1
+       mov     X1, -8(rp)
+       adc     $0, w3
+       mov     (up), %rdx
+       add     w2, X0
+       mulx(   v0, %rax, w1)
+       adc     $0, w0
+L(lo3):        add     %rax, X0
+       adc     $0, w1
+       mulx(   v1, %rax, w2)
+       add     w3, X0
+       mov     8(rp), X1
+       mov     X0, (rp)
+       mov     16(rp), X0
+       adc     $0, w1
+       add     %rax, X1
+       adc     $0, w2
+       mov     8(up), %rdx
+       lea     32(up), up
+       inc     n
+       jnz     L(top)
+
+L(end):        mulx(   v0, %rax, w3)
+       add     w0, X1
+       adc     $0, w2
+       add     %rax, X1
+       adc     $0, w3
+       mulx(   v1, %rdx, %rax)
+       add     w1, X1
+       mov     X1, 8(rp)
+       adc     $0, w3
+       add     w2, %rdx
+       adc     $0, %rax
+       add     w3, %rdx
+       mov     %rdx, 16(rp)
+       adc     $0, %rax
+       mov     %rax, 24(rp)
+
+       addl    $-2, vn
+       lea     16(vp), vp
+       lea     -16(up,un,8), up
+       lea     32(rp,un,8), rp
+       jnz     L(outer)
+
+       pop     %rax            C deallocate vn slot
+       pop     %r15
+L(ret5):pop    %r14
+L(ret4):pop    %r13
+L(ret3):pop    %r12
+L(ret2):pop    %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
diff --git a/mpn/x86_64/coreihwl/mullo_basecase.asm b/mpn/x86_64/coreihwl/mullo_basecase.asm
new file mode 100644 (file)
index 0000000..9986e8b
--- /dev/null
@@ -0,0 +1,426 @@
+dnl  AMD64 mpn_mullo_basecase optimised for Intel Haswell.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2008, 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')
+
+C cycles/limb  mul_2           addmul_2
+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     ?               ?
+C AMD bobcat   n/a             n/a
+C AMD jaguar    ?               ?
+C Intel P4     n/a             n/a
+C Intel core   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.86            2.15
+C Intel BWL     ?               ?
+C Intel atom   n/a             n/a
+C VIA nano     n/a             n/a
+
+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 Torbjörn Granlund.
+
+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')
+define(`n',        `%rcx')
+
+define(`vp',       `%r8')
+define(`X0',       `%r14')
+define(`X1',       `%r15')
+
+define(`w0',       `%r10')
+define(`w1',       `%r11')
+define(`w2',       `%r12')
+define(`w3',       `%r13')
+define(`i',        `%rbp')
+define(`v0',       `%r9')
+define(`v1',       `%rbx')
+
+C rax rbx rcx rdx rdi rsi rbp r8 r9 r10 r11 r12 r13 r14 r15
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_mullo_basecase)
+       FUNC_ENTRY(4)
+
+       mov     vp_param, vp
+       mov     (up), %rdx
+
+       cmp     $4, n
+       jb      L(small)
+
+       push    %rbx
+       push    %rbp
+       push    %r12
+       push    %r13
+
+       mov     (vp), v0
+       mov     8(vp), v1
+
+       lea     2(n), i
+       shr     $2, i
+       neg     n
+       add     $2, n
+
+       push    up                      C put entry `up' on stack
+
+       test    $1, R8(n)
+       jnz     L(m2x1)
+
+L(m2x0):mulx(  v0, w0, w3)
+       xor     R32(w2), R32(w2)
+       test    $2, R8(n)
+       jz      L(m2b2)
+
+L(m2b0):lea    -8(rp), rp
+       lea     -8(up), up
+       jmp     L(m2e0)
+
+L(m2b2):lea    -24(rp), rp
+       lea     8(up), up
+       jmp     L(m2e2)
+
+L(m2x1):mulx(  v0, w2, w1)
+       xor     R32(w0), R32(w0)
+       test    $2, R8(n)
+       jnz     L(m2b3)
+
+L(m2b1):jmp    L(m2e1)
+
+L(m2b3):lea    -16(rp), rp
+       lea     -16(up), up
+       jmp     L(m2e3)
+
+       ALIGN(16)
+L(m2tp):mulx(  v1, %rax, w0)
+       add     %rax, w2
+       mov     (up), %rdx
+       mulx(   v0, %rax, w1)
+       adc     $0, w0
+       add     %rax, w2
+       adc     $0, w1
+       add     w3, w2
+L(m2e1):mov    w2, (rp)
+       adc     $0, w1
+       mulx(   v1, %rax, w2)
+       add     %rax, w0
+       mov     8(up), %rdx
+       adc     $0, w2
+       mulx(   v0, %rax, w3)
+       add     %rax, w0
+       adc     $0, w3
+       add     w1, w0
+L(m2e0):mov    w0, 8(rp)
+       adc     $0, w3
+       mulx(   v1, %rax, w0)
+       add     %rax, w2
+       mov     16(up), %rdx
+       mulx(   v0, %rax, w1)
+       adc     $0, w0
+       add     %rax, w2
+       adc     $0, w1
+       add     w3, w2
+L(m2e3):mov    w2, 16(rp)
+       adc     $0, w1
+       mulx(   v1, %rax, w2)
+       add     %rax, w0
+       mov     24(up), %rdx
+       adc     $0, w2
+       mulx(   v0, %rax, w3)
+       add     %rax, w0
+       adc     $0, w3
+       add     w1, w0
+       lea     32(up), up
+L(m2e2):mov    w0, 24(rp)
+       adc     $0, w3
+       dec     i
+       lea     32(rp), rp
+       jnz     L(m2tp)
+
+L(m2ed):mulx(  v1, %rax, w0)
+       add     %rax, w2
+       mov     (up), %rdx
+       mulx(   v0, %rax, w1)
+       add     w2, %rax
+       add     w3, %rax
+       mov     %rax, (rp)
+
+       mov     (%rsp), up              C restore `up' to beginning
+       lea     16(vp), vp
+       lea     8(rp,n,8), rp           C put back rp to old rp + 2
+       add     $2, n
+       jge     L(cor1)
+
+       push    %r14
+       push    %r15
+
+L(outer):
+       mov     (vp), v0
+       mov     8(vp), v1
+
+       lea     (n), i
+       sar     $2, i
+
+       mov     (up), %rdx
+       test    $1, R8(n)
+       jnz     L(bx1)
+
+L(bx0):        mov     (rp), X1
+       mov     8(rp), X0
+       mulx(   v0, %rax, w3)
+       add     %rax, X1
+       adc     $0, w3
+       mulx(   v1, %rax, w0)
+       add     %rax, X0
+       adc     $0, w0
+       mov     8(up), %rdx
+       mov     X1, (rp)
+       mulx(   v0, %rax, w1)
+       test    $2, R8(n)
+       jz      L(b2)
+
+L(b0): lea     8(rp), rp
+       lea     8(up), up
+       jmp     L(lo0)
+
+L(b2): mov     16(rp), X1
+       lea     24(rp), rp
+       lea     24(up), up
+       jmp     L(lo2)
+
+L(bx1):        mov     (rp), X0
+       mov     8(rp), X1
+       mulx(   v0, %rax, w1)
+       add     %rax, X0
+       mulx(   v1, %rax, w2)
+       adc     $0, w1
+       mov     X0, (rp)
+       add     %rax, X1
+       adc     $0, w2
+       mov     8(up), %rdx
+       test    $2, R8(n)
+       jnz     L(b3)
+
+L(b1): lea     16(up), up
+       lea     16(rp), rp
+       jmp     L(lo1)
+
+L(b3): mov     16(rp), X0
+       lea     32(up), up
+       mulx(   v0, %rax, w3)
+       inc     i
+       jz      L(cj3)
+       jmp     L(lo3)
+
+       ALIGN(16)
+L(top):        mulx(   v0, %rax, w3)
+       add     w0, X1
+       adc     $0, w2
+L(lo3):        add     %rax, X1
+       adc     $0, w3
+       mulx(   v1, %rax, w0)
+       add     %rax, X0
+       adc     $0, w0
+       lea     32(rp), rp
+       add     w1, X1
+       mov     -16(up), %rdx
+       mov     X1, -24(rp)
+       adc     $0, w3
+       add     w2, X0
+       mov     -8(rp), X1
+       mulx(   v0, %rax, w1)
+       adc     $0, w0
+L(lo2):        add     %rax, X0
+       mulx(   v1, %rax, w2)
+       adc     $0, w1
+       add     w3, X0
+       mov     X0, -16(rp)
+       adc     $0, w1
+       add     %rax, X1
+       adc     $0, w2
+       add     w0, X1
+       mov     -8(up), %rdx
+       adc     $0, w2
+L(lo1):        mulx(   v0, %rax, w3)
+       add     %rax, X1
+       adc     $0, w3
+       mov     (rp), X0
+       mulx(   v1, %rax, w0)
+       add     %rax, X0
+       adc     $0, w0
+       add     w1, X1
+       mov     X1, -8(rp)
+       adc     $0, w3
+       mov     (up), %rdx
+       add     w2, X0
+       mulx(   v0, %rax, w1)
+       adc     $0, w0
+L(lo0):        add     %rax, X0
+       adc     $0, w1
+       mulx(   v1, %rax, w2)
+       add     w3, X0
+       mov     8(rp), X1
+       mov     X0, (rp)
+       mov     16(rp), X0
+       adc     $0, w1
+       add     %rax, X1
+       adc     $0, w2
+       mov     8(up), %rdx
+       lea     32(up), up
+       inc     i
+       jnz     L(top)
+
+L(end):        mulx(   v0, %rax, w3)
+       add     w0, X1
+       adc     $0, w2
+L(cj3):        add     %rax, X1
+       adc     $0, w3
+       mulx(   v1, %rax, w0)
+       add     %rax, X0
+       add     w1, X1
+       mov     -16(up), %rdx
+       mov     X1, 8(rp)
+       adc     $0, w3
+       add     w2, X0
+       mulx(   v0, %rax, w1)
+       add     X0, %rax
+       add     w3, %rax
+       mov     %rax, 16(rp)
+
+       mov     16(%rsp), up            C restore `up' to beginning
+       lea     16(vp), vp
+       lea     24(rp,n,8), rp          C put back rp to old rp + 2
+       add     $2, n
+       jl      L(outer)
+
+       pop     %r15
+       pop     %r14
+
+       jnz     L(cor0)
+
+L(cor1):mov    (vp), v0
+       mov     8(vp), v1
+       mov     (up), %rdx
+       mulx(   v0, %r12, %rbp)         C u0 x v2
+       add     (rp), %r12              C FIXME: rp[0] still available in reg?
+       adc     %rax, %rbp
+       mov     8(up), %r10
+       imul    v0, %r10
+       imul    v1, %rdx
+       mov     %r12, (rp)
+       add     %r10, %rdx
+       add     %rbp, %rdx
+       mov     %rdx, 8(rp)
+       pop     %rax                    C deallocate `up' copy
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+L(cor0):mov    (vp), %r11
+       imul    (up), %r11
+       add     %rax, %r11
+       mov     %r11, (rp)
+       pop     %rax                    C deallocate `up' copy
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+       ALIGN(16)
+L(small):
+       cmp     $2, 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), %r11
+       mov     (up), %rdx
+       mulx(   %r11, %rax, %rdx)       C u0 x v1
+       add     %rax, %r10
+       adc     %rdx, %r9
+       imul    8(up), %r11             C u1 x v1
+       add     %r11, %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
+EPILOGUE()
diff --git a/mpn/x86_64/coreihwl/redc_1.asm b/mpn/x86_64/coreihwl/redc_1.asm
new file mode 100644 (file)
index 0000000..f1a475e
--- /dev/null
@@ -0,0 +1,433 @@
+dnl  AMD64 mpn_redc_1 optimised for Intel Haswell.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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      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     2.32
+C Intel BWL     ?
+C Intel atom   n/a
+C VIA nano     n/a
+
+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 Torbjörn Granlund.
+
+C TODO
+C  * Micro-optimise.
+C  * Consider inlining mpn_add_n.  Tests indicate that this saves just 1-2
+C    cycles, though.
+
+define(`rp',          `%rdi')   C rcx
+define(`up',          `%rsi')   C rdx
+define(`mp_param',    `%rdx')   C r8
+define(`n',           `%rcx')   C r9
+define(`u0inv_param', `%r8')    C stack
+
+define(`i',           `%r14')
+define(`j',           `%r15')
+define(`mp',          `%rdi')
+define(`u0inv',       `(%rsp)')  C stack
+
+ABI_SUPPORT(DOS64)    C FIXME: needs verification
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_redc_1)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8   ')
+       push    %rbx
+       push    %rbp
+       push    %r12
+       push    %r13
+       push    %r14
+       push    %r15
+       push    rp
+       mov     mp_param, mp            C note that rp and mp shares register
+       mov     (up), %rdx
+
+       neg     n
+       push    %r8                     C put u0inv on stack
+       imul    u0inv_param, %rdx       C first iteration q0
+       mov     n, j                    C outer loop induction var
+
+       test    $1, R8(n)
+       jnz     L(bx1)
+
+L(bx0):        test    $2, R8(n)
+       jz      L(o0b)
+
+       cmp     $-2, R32(n)
+       jnz     L(o2)
+
+C Special code for n = 2 since general code cannot handle it
+       mov     8(%rsp), %rbx           C rp
+       lea     16(%rsp), %rsp          C deallocate two slots
+       mulx(   (mp), %r9, %r12)
+       mulx(   8,(mp), %r11, %r10)
+       add     %r12, %r11
+       adc     $0, %r10
+       add     (up), %r9               C = 0
+       adc     8(up), %r11             C r11 = up[1]
+       adc     $0, %r10                C -> up[0]
+       mov     %r11, %rdx
+       imul    u0inv_param, %rdx
+       mulx(   (mp), %r13, %r12)
+       mulx(   8,(mp), %r14, %r15)
+       xor     R32(%rax), R32(%rax)
+       add     %r12, %r14
+       adc     $0, %r15
+       add     %r11, %r13              C = 0
+       adc     16(up), %r14            C rp[2]
+       adc     $0, %r15                C -> up[1]
+       add     %r14, %r10
+       adc     24(up), %r15
+       mov     %r10, (%rbx)
+       mov     %r15, 8(%rbx)
+       setc    R8(%rax)
+       jmp     L(ret)
+
+L(o2): lea     2(n), i                 C inner loop induction var
+       mulx(   (mp), %r9, %r8)
+       mulx(   8,(mp), %r11, %r10)
+       sar     $2, i
+       add     %r8, %r11
+       jmp     L(lo2)
+
+       ALIGN(16)
+L(tp2):        adc     %rax, %r9
+       lea     32(up), up
+       adc     %r8, %r11
+L(lo2):        mulx(   16,(mp), %r13, %r12)
+       mov     (up), %r8
+       mulx(   24,(mp), %rbx, %rax)
+       lea     32(mp), mp
+       adc     %r10, %r13
+       adc     %r12, %rbx
+       adc     $0, %rax
+       mov     8(up), %r10
+       mov     16(up), %r12
+       add     %r9, %r8
+       mov     24(up), %rbp
+       mov     %r8, (up)
+       adc     %r11, %r10
+       mulx(   (mp), %r9, %r8)
+       mov     %r10, 8(up)
+       adc     %r13, %r12
+       mov     %r12, 16(up)
+       adc     %rbx, %rbp
+       mulx(   8,(mp), %r11, %r10)
+       mov     %rbp, 24(up)
+       inc     i
+       jnz     L(tp2)
+
+L(ed2):        mov     56(up,n,8), %rdx        C next iteration up[0]
+       lea     16(mp,n,8), mp          C mp = (last starting mp)
+       adc     %rax, %r9
+       adc     %r8, %r11
+       mov     32(up), %r8
+       adc     $0, %r10
+       imul    u0inv, %rdx             C next iteration q0
+       mov     40(up), %rax
+       add     %r9, %r8
+       mov     %r8, 32(up)
+       adc     %r11, %rax
+       mov     %rax, 40(up)
+       lea     56(up,n,8), up          C up = (last starting up) + 1
+       adc     $0, %r10
+       mov     %r10, -8(up)
+       inc     j
+       jnz     L(o2)
+
+       jmp     L(cj)
+
+
+L(bx1):        test    $2, R8(n)
+       jz      L(o3a)
+
+L(o1a):        cmp     $-1, R32(n)
+       jnz     L(o1b)
+
+C Special code for n = 1 since general code cannot handle it
+       mov     8(%rsp), %rbx           C rp
+       lea     16(%rsp), %rsp          C deallocate two slots
+       mulx(   (mp), %r11, %r10)
+       add     (up), %r11
+       adc     8(up), %r10
+       mov     %r10, (%rbx)
+       mov     $0, R32(%rax)
+       setc    R8(%rax)
+       jmp     L(ret)
+
+L(o1b):        lea     24(mp), mp
+L(o1): lea     1(n), i                 C inner loop induction var
+       mulx(   -24,(mp), %r11, %r10)
+       mulx(   -16,(mp), %r13, %r12)
+       mulx(   -8,(mp), %rbx, %rax)
+       sar     $2, i
+       add     %r10, %r13
+       adc     %r12, %rbx
+       adc     $0, %rax
+       mov     (up), %r10
+       mov     8(up), %r12
+       mov     16(up), %rbp
+       add     %r11, %r10
+       jmp     L(lo1)
+
+       ALIGN(16)
+L(tp1):        adc     %rax, %r9
+       lea     32(up), up
+       adc     %r8, %r11
+       mulx(   16,(mp), %r13, %r12)
+       mov     -8(up), %r8
+       mulx(   24,(mp), %rbx, %rax)
+       lea     32(mp), mp
+       adc     %r10, %r13
+       adc     %r12, %rbx
+       adc     $0, %rax
+       mov     (up), %r10
+       mov     8(up), %r12
+       add     %r9, %r8
+       mov     16(up), %rbp
+       mov     %r8, -8(up)
+       adc     %r11, %r10
+L(lo1):        mulx(   (mp), %r9, %r8)
+       mov     %r10, (up)
+       adc     %r13, %r12
+       mov     %r12, 8(up)
+       adc     %rbx, %rbp
+       mulx(   8,(mp), %r11, %r10)
+       mov     %rbp, 16(up)
+       inc     i
+       jnz     L(tp1)
+
+L(ed1):        mov     48(up,n,8), %rdx        C next iteration up[0]
+       lea     40(mp,n,8), mp          C mp = (last starting mp)
+       adc     %rax, %r9
+       adc     %r8, %r11
+       mov     24(up), %r8
+       adc     $0, %r10
+       imul    u0inv, %rdx             C next iteration q0
+       mov     32(up), %rax
+       add     %r9, %r8
+       mov     %r8, 24(up)
+       adc     %r11, %rax
+       mov     %rax, 32(up)
+       lea     48(up,n,8), up          C up = (last starting up) + 1
+       adc     $0, %r10
+       mov     %r10, -8(up)
+       inc     j
+       jnz     L(o1)
+
+       jmp     L(cj)
+
+L(o3a):        cmp     $-3, R32(n)
+       jnz     L(o3b)
+
+C Special code for n = 3 since general code cannot handle it
+L(n3): mulx(   (mp), %rbx, %rax)
+       mulx(   8,(mp), %r9, %r14)
+       add     (up), %rbx
+       mulx(   16,(mp), %r11, %r10)
+       adc     %rax, %r9               C W 1
+       adc     %r14, %r11              C W 2
+       mov     8(up), %r14
+       mov     u0inv_param, %rdx
+       adc     $0, %r10                C W 3
+       mov     16(up), %rax
+       add     %r9, %r14               C W 1
+       mov     %r14, 8(up)
+       mulx(   %r14, %rdx, %r13)       C next iteration q0
+       adc     %r11, %rax              C W 2
+       mov     %rax, 16(up)
+       adc     $0, %r10                C W 3
+       mov     %r10, (up)
+       lea     8(up), up               C up = (last starting up) + 1
+       inc     j
+       jnz     L(n3)
+
+       jmp     L(cj)
+
+L(o3b):        lea     8(mp), mp
+L(o3): lea     4(n), i                 C inner loop induction var
+       mulx(   -8,(mp), %rbx, %rax)
+       mulx(   (mp), %r9, %r8)
+       mov     (up), %rbp
+       mulx(   8,(mp), %r11, %r10)
+       sar     $2, i
+       add     %rbx, %rbp
+       nop
+       adc     %rax, %r9
+       jmp     L(lo3)
+
+       ALIGN(16)
+L(tp3):        adc     %rax, %r9
+       lea     32(up), up
+L(lo3):        adc     %r8, %r11
+       mulx(   16,(mp), %r13, %r12)
+       mov     8(up), %r8
+       mulx(   24,(mp), %rbx, %rax)
+       lea     32(mp), mp
+       adc     %r10, %r13
+       adc     %r12, %rbx
+       adc     $0, %rax
+       mov     16(up), %r10
+       mov     24(up), %r12
+       add     %r9, %r8
+       mov     32(up), %rbp
+       mov     %r8, 8(up)
+       adc     %r11, %r10
+       mulx(   (mp), %r9, %r8)
+       mov     %r10, 16(up)
+       adc     %r13, %r12
+       mov     %r12, 24(up)
+       adc     %rbx, %rbp
+       mulx(   8,(mp), %r11, %r10)
+       mov     %rbp, 32(up)
+       inc     i
+       jnz     L(tp3)
+
+L(ed3):        mov     64(up,n,8), %rdx        C next iteration up[0]
+       lea     24(mp,n,8), mp          C mp = (last starting mp)
+       adc     %rax, %r9
+       adc     %r8, %r11
+       mov     40(up), %r8
+       adc     $0, %r10
+       imul    u0inv, %rdx             C next iteration q0
+       mov     48(up), %rax
+       add     %r9, %r8
+       mov     %r8, 40(up)
+       adc     %r11, %rax
+       mov     %rax, 48(up)
+       lea     64(up,n,8), up          C up = (last starting up) + 1
+       adc     $0, %r10
+       mov     %r10, -8(up)
+       inc     j
+       jnz     L(o3)
+
+       jmp     L(cj)
+
+L(o0b):        lea     16(mp), mp
+L(o0): mov     n, i                    C inner loop induction var
+       mulx(   -16,(mp), %r13, %r12)
+       mulx(   -8,(mp), %rbx, %rax)
+       sar     $2, i
+       add     %r12, %rbx
+       adc     $0, %rax
+       mov     (up), %r12
+       mov     8(up), %rbp
+       mulx(   (mp), %r9, %r8)
+       add     %r13, %r12
+       jmp     L(lo0)
+
+       ALIGN(16)
+L(tp0):        adc     %rax, %r9
+       lea     32(up), up
+       adc     %r8, %r11
+       mulx(   16,(mp), %r13, %r12)
+       mov     -16(up), %r8
+       mulx(   24,(mp), %rbx, %rax)
+       lea     32(mp), mp
+       adc     %r10, %r13
+       adc     %r12, %rbx
+       adc     $0, %rax
+       mov     -8(up), %r10
+       mov     (up), %r12
+       add     %r9, %r8
+       mov     8(up), %rbp
+       mov     %r8, -16(up)
+       adc     %r11, %r10
+       mulx(   (mp), %r9, %r8)
+       mov     %r10, -8(up)
+       adc     %r13, %r12
+       mov     %r12, (up)
+L(lo0):        adc     %rbx, %rbp
+       mulx(   8,(mp), %r11, %r10)
+       mov     %rbp, 8(up)
+       inc     i
+       jnz     L(tp0)
+
+L(ed0):        mov     40(up,n,8), %rdx        C next iteration up[0]
+       lea     32(mp,n,8), mp          C mp = (last starting mp)
+       adc     %rax, %r9
+       adc     %r8, %r11
+       mov     16(up), %r8
+       adc     $0, %r10
+       imul    u0inv, %rdx             C next iteration q0
+       mov     24(up), %rax
+       add     %r9, %r8
+       mov     %r8, 16(up)
+       adc     %r11, %rax
+       mov     %rax, 24(up)
+       lea     40(up,n,8), up          C up = (last starting up) + 1
+       adc     $0, %r10
+       mov     %r10, -8(up)
+       inc     j
+       jnz     L(o0)
+
+L(cj):
+IFSTD(`        mov     8(%rsp), %rdi           C param 1: rp
+       lea     16(%rsp), %rsp          C deallocate two slots
+       lea     (up,n,8), %rdx          C param 3: up - n
+       neg     R32(n)          ')      C param 4: n
+
+IFDOS(`        mov     up, %rdx                C param 2: up
+       lea     (up,n,8), %r8           C param 3: up - n
+       neg     R32(n)
+       mov     n, %r9                  C param 4: n
+       mov     8(%rsp), %rcx           C param 1: rp
+       lea     16(%rsp), %rsp  ')      C deallocate two slots
+
+       CALL(   mpn_add_n)
+
+L(ret):        pop     %r15
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
diff --git a/mpn/x86_64/coreihwl/sqr_basecase.asm b/mpn/x86_64/coreihwl/sqr_basecase.asm
new file mode 100644 (file)
index 0000000..641cdf3
--- /dev/null
@@ -0,0 +1,506 @@
+dnl  AMD64 mpn_sqr_basecase optimised for Intel Haswell.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2008, 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')
+
+C cycles/limb  mul_2           addmul_2        sqr_diag_addlsh1
+C AMD K8,K9    n/a             n/a                     n/a
+C AMD K10      n/a             n/a                     n/a
+C AMD bull     n/a             n/a                     n/a
+C AMD pile     n/a             n/a                     n/a
+C AMD steam     ?               ?                       ?
+C AMD bobcat   n/a             n/a                     n/a
+C AMD jaguar    ?               ?                       ?
+C Intel P4     n/a             n/a                     n/a
+C Intel core   n/a             n/a                     n/a
+C Intel NHM    n/a             n/a                     n/a
+C Intel SBR    n/a             n/a                     n/a
+C Intel IBR    n/a             n/a                     n/a
+C Intel HWL     1.86            2.15                   ~2.5
+C Intel BWL     ?               ?                       ?
+C Intel atom   n/a             n/a                     n/a
+C VIA nano     n/a             n/a                     n/a
+
+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 Torbjörn Granlund, except
+C that the sqr_diag_addlsh1 loop was manually written.
+
+C TODO
+C  * Replace current unoptimised sqr_diag_addlsh1 loop; 1.75 c/l might be
+C    possible.
+C  * Consider splitting outer loop into 2, one for n = 1 (mod 2) and one for
+C    n = 0 (mod 2).  These loops could fall into specific "corner" code.
+C  * Consider splitting outer loop into 4.
+C  * Streamline pointer updates.
+C  * Perhaps suppress a few more xor insns in feed-in code.
+C  * Make sure we write no dead registers in feed-in code.
+C  * We might use 32-bit size ops, since n >= 2^32 is non-terminating.  Watch
+C    out for negative sizes being zero-extended, though.
+C  * Provide straight-line code for n = 4; then look for simplifications in
+C    main code.
+
+define(`rp',     `%rdi')
+define(`up',     `%rsi')
+define(`un_param',`%rdx')
+
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_sqr_basecase)
+       FUNC_ENTRY(3)
+
+       cmp     $2, 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, un_param
+       jae     L(gt3)
+define(`v0', `%r8')
+define(`v1', `%r9')
+define(`w0', `%r10')
+define(`w2', `%r11')
+
+       mov     (up), v0
+       mov     8(up), %rdx
+       mov     %rdx, v1
+       mulx(   v0, w2, %rax)
+       mov     16(up), %rdx
+       mulx(   v0, w0, %rcx)
+       mov     w2, %r8
+       add     %rax, w0
+       adc     $0, %rcx
+       mulx(   v1, %rdx, %rax)
+       add     %rcx, %rdx
+       mov     %rdx, 24(rp)
+       adc     $0, %rax
+       mov     %rax, 32(rp)
+       xor     R32(%rcx), R32(%rcx)
+       mov     (up), %rdx
+       mulx(   %rdx, %rax, w2)
+       mov     %rax, (rp)
+       add     %r8, %r8
+       adc     w0, w0
+       setc    R8(%rcx)
+       mov     8(up), %rdx
+       mulx(   %rdx, %rax, %rdx)
+       add     w2, %r8
+       adc     %rax, w0
+       mov     %r8, 8(rp)
+       mov     w0, 16(rp)
+       mov     24(rp), %r8
+       mov     32(rp), w0
+       lea     (%rdx,%rcx), w2
+       adc     %r8, %r8
+       adc     w0, w0
+       setc    R8(%rcx)
+       mov     16(up), %rdx
+       mulx(   %rdx, %rax, %rdx)
+       add     w2, %r8
+       adc     %rax, w0
+       mov     %r8, 24(rp)
+       mov     w0, 32(rp)
+       adc     %rcx, %rdx
+       mov     %rdx, 40(rp)
+       FUNC_EXIT()
+       ret
+
+L(gt3):
+
+define(`v0', `%r8')
+define(`v1', `%r9')
+define(`w0', `%r10')
+define(`w1', `%r11')
+define(`w2', `%rbx')
+define(`w3', `%rbp')
+define(`un', `%r12')
+define(`n',  `%rcx')
+
+define(`X0', `%r13')
+define(`X1', `%r14')
+
+L(do_mul_2):
+       push    %rbx
+       push    %rbp
+       push    %r12
+       push    %r13
+       push    %r14
+       mov     $0, R32(un)
+       sub     un_param, un            C free up rdx
+       push    un
+       mov     (up), v0
+       mov     8(up), %rdx
+       lea     2(un), n
+       sar     $2, n                   C FIXME: suppress, change loop?
+       inc     un                      C decrement |un|
+       mov     %rdx, v1
+
+       test    $1, R8(un)
+       jnz     L(mx1)
+
+L(mx0):        mulx(   v0, w2, w1)
+       mov     16(up), %rdx
+       mov     w2, 8(rp)
+       xor     w2, w2
+       mulx(   v0, w0, w3)
+       test    $2, R8(un)
+       jz      L(m00)
+
+L(m10):        lea     -8(rp), rp
+       lea     -8(up), up
+       jmp     L(mlo2)
+
+L(m00):        lea     8(up), up
+       lea     8(rp), rp
+       jmp     L(mlo0)
+
+L(mx1):        mulx(   v0, w0, w3)
+       mov     16(up), %rdx
+       mov     w0, 8(rp)
+       xor     w0, w0
+       mulx(   v0, w2, w1)
+       test    $2, R8(un)
+       jz      L(mlo3)
+
+L(m01):        lea     16(rp), rp
+       lea     16(up), up
+       jmp     L(mlo1)
+
+       ALIGN(32)
+L(mtop):mulx(  v1, %rax, w0)
+       add     %rax, w2                C 0
+       mov     (up), %rdx
+       mulx(   v0, %rax, w1)
+       adc     $0, w0                  C 1
+       add     %rax, w2                C 0
+L(mlo1):adc    $0, w1                  C 1
+       add     w3, w2                  C 0
+       mov     w2, (rp)                C 0
+       adc     $0, w1                  C 1
+       mulx(   v1, %rax, w2)
+       add     %rax, w0                C 1
+       mov     8(up), %rdx
+       adc     $0, w2                  C 2
+       mulx(   v0, %rax, w3)
+       add     %rax, w0                C 1
+       adc     $0, w3                  C 2
+L(mlo0):add    w1, w0                  C 1
+       mov     w0, 8(rp)               C 1
+       adc     $0, w3                  C 2
+       mulx(   v1, %rax, w0)
+       add     %rax, w2                C 2
+       mov     16(up), %rdx
+       mulx(   v0, %rax, w1)
+       adc     $0, w0                  C 3
+       add     %rax, w2                C 2
+       adc     $0, w1                  C 3
+L(mlo3):add    w3, w2                  C 2
+       mov     w2, 16(rp)              C 2
+       adc     $0, w1                  C 3
+       mulx(   v1, %rax, w2)
+       add     %rax, w0                C 3
+       mov     24(up), %rdx
+       adc     $0, w2                  C 4
+       mulx(   v0, %rax, w3)
+       add     %rax, w0                C 3
+       adc     $0, w3                  C 4
+L(mlo2):add    w1, w0                  C 3
+       lea     32(up), up
+       mov     w0, 24(rp)              C 3
+       adc     $0, w3                  C 4
+       inc     n
+       lea     32(rp), rp
+       jnz     L(mtop)
+
+L(mend):mulx(  v1, %rdx, %rax)
+       add     %rdx, w2
+       adc     $0, %rax
+       add     w3, w2
+       mov     w2, (rp)
+       adc     $0, %rax
+       mov     %rax, 8(rp)
+
+       lea     16(up), up
+       lea     -16(rp), rp
+
+L(do_addmul_2):
+L(outer):
+       lea     (up,un,8), up           C put back up to 2 positions above last time
+       lea     48(rp,un,8), rp         C put back rp to 4 positions above last time
+
+       mov     -8(up), v0              C shared between addmul_2 and corner
+
+       add     $2, un                  C decrease |un|
+       cmp     $-2, un
+       jge     L(corner)
+
+       mov     (up), v1
+
+       lea     1(un), n
+       sar     $2, n                   C FIXME: suppress, change loop?
+
+       mov     v1, %rdx
+       test    $1, R8(un)
+       jnz     L(bx1)
+
+L(bx0):        mov     (rp), X0
+       mov     8(rp), X1
+       mulx(   v0, %rax, w1)
+       add     %rax, X0
+       adc     $0, w1
+       mov     X0, (rp)
+       xor     w2, w2
+       test    $2, R8(un)
+       jnz     L(b10)
+
+L(b00):        mov     8(up), %rdx
+       lea     16(rp), rp
+       lea     16(up), up
+       jmp     L(lo0)
+
+L(b10):        mov     8(up), %rdx
+       mov     16(rp), X0
+       lea     32(up), up
+       inc     n
+       mulx(   v0, %rax, w3)
+       jz      L(ex)
+       jmp     L(lo2)
+
+L(bx1):        mov     (rp), X1
+       mov     8(rp), X0
+       mulx(   v0, %rax, w3)
+       mov     8(up), %rdx
+       add     %rax, X1
+       adc     $0, w3
+       xor     w0, w0
+       mov     X1, (rp)
+       mulx(   v0, %rax, w1)
+       test    $2, R8(un)
+       jz      L(b11)
+
+L(b01):        mov     16(rp), X1
+       lea     24(rp), rp
+       lea     24(up), up
+       jmp     L(lo1)
+
+L(b11):        lea     8(rp), rp
+       lea     8(up), up
+       jmp     L(lo3)
+
+       ALIGN(32)
+L(top):        mulx(   v0, %rax, w3)
+       add     w0, X1
+       adc     $0, w2
+L(lo2):        add     %rax, X1
+       adc     $0, w3
+       mulx(   v1, %rax, w0)
+       add     %rax, X0
+       adc     $0, w0
+       lea     32(rp), rp
+       add     w1, X1
+       mov     -16(up), %rdx
+       mov     X1, -24(rp)
+       adc     $0, w3
+       add     w2, X0
+       mov     -8(rp), X1
+       mulx(   v0, %rax, w1)
+       adc     $0, w0
+L(lo1):        add     %rax, X0
+       mulx(   v1, %rax, w2)
+       adc     $0, w1
+       add     w3, X0
+       mov     X0, -16(rp)
+       adc     $0, w1
+       add     %rax, X1
+       adc     $0, w2
+       add     w0, X1
+       mov     -8(up), %rdx
+       adc     $0, w2
+L(lo0):        mulx(   v0, %rax, w3)
+       add     %rax, X1
+       adc     $0, w3
+       mov     (rp), X0
+       mulx(   v1, %rax, w0)
+       add     %rax, X0
+       adc     $0, w0
+       add     w1, X1
+       mov     X1, -8(rp)
+       adc     $0, w3
+       mov     (up), %rdx
+       add     w2, X0
+       mulx(   v0, %rax, w1)
+       adc     $0, w0
+L(lo3):        add     %rax, X0
+       adc     $0, w1
+       mulx(   v1, %rax, w2)
+       add     w3, X0
+       mov     8(rp), X1
+       mov     X0, (rp)
+       mov     16(rp), X0
+       adc     $0, w1
+       add     %rax, X1
+       adc     $0, w2
+       mov     8(up), %rdx
+       lea     32(up), up
+       inc     n
+       jnz     L(top)
+
+L(end):        mulx(   v0, %rax, w3)
+       add     w0, X1
+       adc     $0, w2
+L(ex): add     %rax, X1
+       adc     $0, w3
+       mulx(   v1, %rdx, %rax)
+       add     w1, X1
+       mov     X1, 8(rp)
+       adc     $0, w3
+       add     w2, %rdx
+       adc     $0, %rax
+       add     %rdx, w3
+       mov     w3, 16(rp)
+       adc     $0, %rax
+       mov     %rax, 24(rp)
+
+       jmp     L(outer)                C loop until a small corner remains
+
+L(corner):
+       pop     un
+       mov     (up), %rdx
+       jg      L(small_corner)
+
+       mov     %rdx, v1
+       mov     (rp), X0
+       mov     %rax, X1                C Tricky rax reuse of last iteration
+       mulx(   v0, %rax, w1)
+       add     %rax, X0
+       adc     $0, w1
+       mov     X0, (rp)
+       mov     8(up), %rdx
+       mulx(   v0, %rax, w3)
+       add     %rax, X1
+       adc     $0, w3
+       mulx(   v1, %rdx, %rax)
+       add     w1, X1
+       mov     X1, 8(rp)
+       adc     $0, w3
+       add     w3, %rdx
+       mov     %rdx, 16(rp)
+       adc     $0, %rax
+       mov     %rax, 24(rp)
+       lea     32(rp), rp
+       lea     16(up), up
+       jmp     L(com)
+
+L(small_corner):
+       mulx(   v0, X1, w3)
+       add     %rax, X1                C Tricky rax reuse of last iteration
+       adc     $0, w3
+       mov     X1, (rp)
+       mov     w3, 8(rp)
+       lea     16(rp), rp
+       lea     8(up), up
+
+L(com):
+
+L(sqr_diag_addlsh1):
+       lea     8(up,un,8), up          C put back up at its very beginning
+       lea     (rp,un,8), rp
+       lea     (rp,un,8), rp           C put back rp at its very beginning
+       inc     un
+
+       mov     -8(up), %rdx
+       xor     R32(%rbx), R32(%rbx)    C clear CF as side effect
+       mulx(   %rdx, %rax, %r10)
+       mov     %rax, 8(rp)
+       mov     16(rp), %r8
+       mov     24(rp), %r9
+       jmp     L(dm)
+
+       ALIGN(16)
+L(dtop):mov    32(rp), %r8
+       mov     40(rp), %r9
+       lea     16(rp), rp
+       lea     (%rdx,%rbx), %r10
+L(dm): adc     %r8, %r8
+       adc     %r9, %r9
+       setc    R8(%rbx)
+       mov     (up), %rdx
+       lea     8(up), up
+       mulx(   %rdx, %rax, %rdx)
+       add     %r10, %r8
+       adc     %rax, %r9
+       mov     %r8, 16(rp)
+       mov     %r9, 24(rp)
+       inc     un
+       jnz     L(dtop)
+
+L(dend):adc    %rbx, %rdx
+       mov     %rdx, 32(rp)
+
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
index 8854a24de5cc6691dbb460063290bd37f7c11bee..eed64e701e8b072e1112184d3fc8e9cb0f072865 100644 (file)
@@ -7,19 +7,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund.
 dnl  Copyright 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/coreinhm/aorsmul_1.asm b/mpn/x86_64/coreinhm/aorsmul_1.asm
new file mode 100644 (file)
index 0000000..b768905
--- /dev/null
@@ -0,0 +1,187 @@
+dnl  AMD64 mpn_addmul_1 and mpn_submul_1 optimised for Intel Nehalem.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2003-2005, 2007, 2008, 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')
+
+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 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 N.B.: Be careful if editing, making sure the loop alignment padding does not
+C become large, as we currently fall into it.
+
+define(`rp',      `%rdi')   C rcx
+define(`up',      `%rsi')   C rdx
+define(`n_param', `%rdx')   C r8
+define(`v0',      `%rcx')   C r9
+
+define(`n',       `%rbx')
+
+ifdef(`OPERATION_addmul_1',`
+  define(`ADDSUB', `add')
+  define(`func',   `mpn_addmul_1')
+')
+ifdef(`OPERATION_submul_1',`
+  define(`ADDSUB', `sub')
+  define(`func',   `mpn_submul_1')
+')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(func)
+       FUNC_ENTRY(4)
+       push    %rbx
+
+       mov     (up), %rax
+       lea     -8(up,n_param,8), up
+       mov     (rp), %r8
+       lea     -8(rp,n_param,8), rp
+
+       test    $1, R8(n_param)
+       jnz     L(bx1)
+
+L(bx0):        test    $2, R8(n_param)
+       jnz     L(b10)
+
+L(b00):        mov     $3, R32(n)
+       sub     n_param, n
+       mul     v0
+       mov     $0, R32(%r11)
+       mov     %r8, %r10
+       ADDSUB  %rax, %r10
+       mov     -8(up,n,8), %rax
+       adc     %rdx, %r11
+       jmp     L(lo0)
+
+L(b10):        mov     $1, R32(n)
+       sub     n_param, n
+       mul     v0
+       mov     %r8, %r10
+       mov     $0, R32(%r11)
+       ADDSUB  %rax, %r10
+       mov     8(up,n,8), %rax
+       adc     %rdx, %r11
+       jmp     L(lo2)
+
+L(bx1):        test    $2, R8(n_param)
+       jz      L(b01)
+
+L(b11):        mov     $2, R32(n)
+       sub     n_param, n
+       mul     v0
+       ADDSUB  %rax, %r8
+       mov     $0, R32(%r9)
+       mov     (up,n,8), %rax
+       adc     %rdx, %r9
+       jmp     L(lo3)
+
+L(b01):        mov     $0, R32(n)
+       sub     n_param, n
+       xor     %r11, %r11
+       add     $4, n
+       jc      L(end)
+
+       ALIGN(32)
+L(top):        mul     v0
+       ADDSUB  %rax, %r8
+       mov     $0, R32(%r9)
+       mov     -16(up,n,8), %rax
+       adc     %rdx, %r9
+L(lo1):        mul     v0
+       ADDSUB  %r11, %r8
+       mov     $0, R32(%r11)
+       mov     -16(rp,n,8), %r10
+       adc     $0, %r9
+       ADDSUB  %rax, %r10
+       mov     -8(up,n,8), %rax
+       adc     %rdx, %r11
+       mov     %r8, -24(rp,n,8)
+       ADDSUB  %r9, %r10
+       adc     $0, %r11
+L(lo0):        mov     -8(rp,n,8), %r8
+       mul     v0
+       ADDSUB  %rax, %r8
+       mov     $0, R32(%r9)
+       mov     (up,n,8), %rax
+       adc     %rdx, %r9
+       mov     %r10, -16(rp,n,8)
+       ADDSUB  %r11, %r8
+       adc     $0, %r9
+L(lo3):        mul     v0
+       mov     (rp,n,8), %r10
+       mov     $0, R32(%r11)
+       ADDSUB  %rax, %r10
+       mov     8(up,n,8), %rax
+       adc     %rdx, %r11
+       mov     %r8, -8(rp,n,8)
+       ADDSUB  %r9, %r10
+       adc     $0, %r11
+L(lo2):        mov     8(rp,n,8), %r8
+       mov     %r10, (rp,n,8)
+       add     $4, n
+       jnc     L(top)
+
+L(end):        mul     v0
+       ADDSUB  %rax, %r8
+       mov     $0, R32(%rax)
+       adc     %rdx, %rax
+       ADDSUB  %r11, %r8
+       adc     $0, %rax
+       mov     %r8, (rp)
+
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
+ASM_END()
index 4763d5751673546a205a37d92c8efb4632d553e3..6a7c03639f6cc3c2612b123334c9894aa60cd72a 100644 (file)
 /* Nehalem gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2012, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 /* 2667 MHz Core i7 Nehalem */
+/* FFT tuning limit = 100000000 */
+/* Generated by tuneup.c, 2014-03-18, 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          3
+#define MOD_1N_TO_MOD_1_1_THRESHOLD          2
 #define MOD_1U_TO_MOD_1_1_THRESHOLD          3
 #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      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           16
 
 #define MUL_TOOM22_THRESHOLD                18
-#define MUL_TOOM33_THRESHOLD                57
-#define MUL_TOOM44_THRESHOLD               169
-#define MUL_TOOM6H_THRESHOLD               222
-#define MUL_TOOM8H_THRESHOLD               288
+#define MUL_TOOM33_THRESHOLD                60
+#define MUL_TOOM44_THRESHOLD               166
+#define MUL_TOOM6H_THRESHOLD               228
+#define MUL_TOOM8H_THRESHOLD               309
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD      65
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     108
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD      99
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD     105
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD      82
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD      63
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD     114
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD     104
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD     113
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     147
 
 #define SQR_BASECASE_THRESHOLD               0  /* always (native) */
-#define SQR_TOOM2_THRESHOLD                 30
-#define SQR_TOOM3_THRESHOLD                101
+#define SQR_TOOM2_THRESHOLD                 28
+#define SQR_TOOM3_THRESHOLD                 93
 #define SQR_TOOM4_THRESHOLD                250
-#define SQR_TOOM6_THRESHOLD                306
+#define SQR_TOOM6_THRESHOLD                351
 #define SQR_TOOM8_THRESHOLD                454
 
-#define MULMID_TOOM42_THRESHOLD             22
+#define MULMID_TOOM42_THRESHOLD             28
 
-#define MULMOD_BNM1_THRESHOLD               11
-#define SQRMOD_BNM1_THRESHOLD               13
+#define MULMOD_BNM1_THRESHOLD               12
+#define SQRMOD_BNM1_THRESHOLD               15
 
 #define MUL_FFT_MODF_THRESHOLD             380  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
   { {    380, 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}, {     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}, {     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,12}, \
-    {    191,11}, {    383,10}, {    767,11}, {    415,10}, \
-    {    831,12}, {    223,11}, {    447,10}, {    895,13}, \
-    {    127,12}, {    255,11}, {    511,10}, {   1023,11}, \
-    {    543,12}, {    287,11}, {    607,12}, {    319,11}, \
-    {    639,12}, {    351,11}, {    703,10}, {   1407,13}, \
+    {     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,11}, {     63,10}, \
+    {    127, 9}, {    255,10}, {    135,11}, {     79,10}, \
+    {    159, 9}, {    319,10}, {    167,11}, {     95,10}, \
+    {    191, 9}, {    383,12}, {     63,11}, {    127,10}, \
+    {    255, 9}, {    511,11}, {    143,10}, {    287, 9}, \
+    {    575,11}, {    159,10}, {    319,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,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,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,13}, \
     {    191,12}, {    383,11}, {    767,12}, {    415,11}, \
-    {    831,10}, {   1663,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,11}, \
-    {   1407,13}, {    383,12}, {    831,11}, {   1663,13}, \
-    {    447,12}, {    959,11}, {   1919,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 137
-#define MUL_FFT_THRESHOLD                 3712
-
-#define SQR_FFT_MODF_THRESHOLD             304  /* k = 5 */
+    {    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,11}, {   1407,13}, \
+    {    383,12}, {    831,13}, {    447,12}, {    959,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}, \
+    {    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}, \
+    {   1663,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}, {   3071,14}, \
+    {   1663,13}, {   3455,14}, {   1791,13}, {   3583,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}, {  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                 4032
+
+#define SQR_FFT_MODF_THRESHOLD             312  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    304, 5}, {     17, 6}, {      9, 5}, {     19, 6}, \
+  { {    312, 5}, {     17, 6}, {      9, 5}, {     19, 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}, \
@@ -109,73 +139,93 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
     {     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,12}, {     31,11}, {     63,10}, {    127, 9}, \
-    {    255,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,11}, \
-    {    159,10}, {    319,11}, {    175,12}, {     95,11}, \
-    {    191,10}, {    383,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}, {    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,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,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}, {    703,11}, {   1407,13}, \
-    {    383,12}, {    767,11}, {   1535,12}, {    831,13}, \
-    {    447,12}, {    959,11}, {   1919,14}, {  16384,15}, \
-    {  32768,16}, {  65536,17}, { 131072,18}, { 262144,19}, \
+    {     83,10}, {     47, 9}, {     95,10}, {     55,11}, \
+    {     31,10}, {     79,11}, {     47,10}, {     95,12}, \
+    {     31,11}, {     63,10}, {    127, 9}, {    255, 8}, \
+    {    511,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,11}, {    159,10}, {    319, 9}, {    639,12}, \
+    {     95,11}, {    191,10}, {    383, 9}, {    767,11}, \
+    {    207,13}, {     63,12}, {    127,11}, {    255,10}, \
+    {    511, 9}, {   1023,11}, {    271,10}, {    543,11}, \
+    {    287,10}, {    575,11}, {    303,12}, {    159,11}, \
+    {    319,10}, {    639, 9}, {   1279,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,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,12}, {    479,11}, {    959,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,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}, {   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,12}, \
+    {   2431,14}, {    639,13}, {   1279,12}, {   2559,13}, \
+    {   1343,12}, {   2687,13}, {   1407,12}, {   2815,14}, \
+    {    767,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}, {   2815,15}, \
+    {    767,14}, {   1663,13}, {   3455,14}, {   1791,13}, \
+    {   3583,16}, {    511,15}, {   1023,14}, {   2303,13}, \
+    {   4607,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}, {  65536,17}, { 131072,18}, { 262144,19}, \
     { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
     {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 137
-#define SQR_FFT_THRESHOLD                 3200
+#define SQR_FFT_TABLE3_SIZE 217
+#define SQR_FFT_THRESHOLD                 2752
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
 #define MULLO_DC_THRESHOLD                  45
-#define MULLO_MUL_N_THRESHOLD             6633
-
-#define DC_DIV_QR_THRESHOLD                 38
-#define DC_DIVAPPR_Q_THRESHOLD             123
-#define DC_BDIV_QR_THRESHOLD                36
-#define DC_BDIV_Q_THRESHOLD                 26
-
-#define INV_MULMOD_BNM1_THRESHOLD           35
-#define INV_NEWTON_THRESHOLD               163
-#define INV_APPR_THRESHOLD                 147
-
-#define BINV_NEWTON_THRESHOLD              230
-#define REDC_1_TO_REDC_2_THRESHOLD          10
-#define REDC_2_TO_REDC_N_THRESHOLD          54
-
-#define MU_DIV_QR_THRESHOLD               1187
-#define MU_DIVAPPR_Q_THRESHOLD            1187
-#define MUPI_DIV_QR_THRESHOLD               75
-#define MU_BDIV_QR_THRESHOLD              1078
-#define MU_BDIV_Q_THRESHOLD               1142
-
-#define POWM_SEC_TABLE  2,65,322,1036,2699
-
-#define MATRIX22_STRASSEN_THRESHOLD         16
-#define HGCD_THRESHOLD                     142
-#define HGCD_APPR_THRESHOLD                177
-#define HGCD_REDUCE_THRESHOLD             2121
-#define GCD_DC_THRESHOLD                   345
-#define GCDEXT_DC_THRESHOLD                372
+#define MULLO_MUL_N_THRESHOLD             8397
+
+#define DC_DIV_QR_THRESHOLD                 46
+#define DC_DIVAPPR_Q_THRESHOLD             135
+#define DC_BDIV_QR_THRESHOLD                38
+#define DC_BDIV_Q_THRESHOLD                 31
+
+#define INV_MULMOD_BNM1_THRESHOLD           34
+#define INV_NEWTON_THRESHOLD               212
+#define INV_APPR_THRESHOLD                 155
+
+#define BINV_NEWTON_THRESHOLD              254
+#define REDC_1_TO_REDC_2_THRESHOLD          32
+#define REDC_2_TO_REDC_N_THRESHOLD          50
+
+#define MU_DIV_QR_THRESHOLD               1334
+#define MU_DIVAPPR_Q_THRESHOLD            1360
+#define MUPI_DIV_QR_THRESHOLD               85
+#define MU_BDIV_QR_THRESHOLD              1142
+#define MU_BDIV_Q_THRESHOLD               1210
+
+#define POWM_SEC_TABLE  3,46,194,494,1678
+
+#define MATRIX22_STRASSEN_THRESHOLD         21
+#define HGCD_THRESHOLD                     141
+#define HGCD_APPR_THRESHOLD                175
+#define HGCD_REDUCE_THRESHOLD             2205
+#define GCD_DC_THRESHOLD                   330
+#define GCDEXT_DC_THRESHOLD                361
 #define JACOBI_BASE_METHOD                   4
 
-#define GET_STR_DC_THRESHOLD                12
-#define GET_STR_PRECOMPUTE_THRESHOLD        20
-#define SET_STR_DC_THRESHOLD               378
-#define SET_STR_PRECOMPUTE_THRESHOLD      1585
+#define GET_STR_DC_THRESHOLD                15
+#define GET_STR_PRECOMPUTE_THRESHOLD        21
+#define SET_STR_DC_THRESHOLD               517
+#define SET_STR_PRECOMPUTE_THRESHOLD      1430
 
 #define FAC_DSC_THRESHOLD                  351
 #define FAC_ODD_THRESHOLD                   43
index 9e35f2d6cf52a2b80220f7195b836dabc8677a11..93e1e5632b252e927102c843edabb2146a2fa29d 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD64 mpn_hamdist -- hamming distance.
 
-dnl  Copyright 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index c93c93ba50ca99a49162203a15cf1bda92ef8156..8f22a715b661d52e7cc8e7a81ae6f61745141a84 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD64 mpn_popcount -- population count.
 
-dnl  Copyright 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
diff --git a/mpn/x86_64/coreinhm/redc_1.asm b/mpn/x86_64/coreinhm/redc_1.asm
new file mode 100644 (file)
index 0000000..4d9261d
--- /dev/null
@@ -0,0 +1,544 @@
+dnl  X86-64 mpn_redc_1 optimised for Intel Nehalem and Westmere.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2003-2005, 2007, 2008, 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')
+
+C           cycles/limb
+C AMD K8,K9     ?
+C AMD K10       ?
+C AMD bull      ?
+C AMD pile      ?
+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 VIA nano      ?
+
+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 Torbjörn Granlund.
+
+C TODO
+C  * Micro-optimise, none performed thus far.
+C  * Consider inlining mpn_add_n.
+C  * Single basecases out before the pushes.
+
+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')   C rcx
+define(`up',          `%rsi')   C rdx
+define(`mp_param',    `%rdx')   C r8
+define(`n',           `%rcx')   C r9
+define(`u0inv',       `%r8')    C stack
+
+define(`i',           `%r14')
+define(`j',           `%r15')
+define(`mp',          `%r12')
+define(`q0',          `%r13')
+
+C rax rbx rcx rdx rdi rsi rbp r8 r9 r10 r11 r12 r13 r14 r15
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+define(`ALIGNx', `ALIGN(16)')
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_redc_1)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8   ')
+       push    %rbx
+       push    %rbp
+       push    %r12
+       push    %r13
+       push    %r14
+       push    %r15
+
+       mov     (up), q0
+       mov     n, j                    C outer loop induction var
+       lea     (mp_param,n,8), mp
+       lea     (up,n,8), up
+       neg     n
+       imul    u0inv, q0               C first iteration q0
+
+       test    $1, R8(n)
+       jz      L(bx0)
+
+L(bx1):        test    $2, R8(n)
+       jz      L(b3)
+
+L(b1): cmp     $-1, R32(n)
+       jz      L(n1)
+
+L(otp1):lea    3(n), i
+       mov     (mp,n,8), %rax
+       mov     (up,n,8), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     $0, R32(%r9)
+       mov     8(mp,n,8), %rax
+       adc     %rdx, %r9
+       mul     q0
+       mov     $0, R32(%r11)
+       mov     8(up,n,8), %rbx
+       add     %rax, %rbx
+       mov     16(mp,n,8), %rax
+       adc     %rdx, %r11
+       add     %r9, %rbx
+       adc     $0, %r11
+       mov     16(up,n,8), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     $0, R32(%r9)
+       mov     24(mp,n,8), %rax
+       adc     %rdx, %r9
+       mov     %rbx, 8(up,n,8)
+       imul    u0inv, %rbx             C next q limb
+       jmp     L(e1)
+
+       ALIGNx
+L(tp1):        mul     q0
+       add     %rax, %rbp
+       mov     $0, R32(%r9)
+       mov     -16(mp,i,8), %rax
+       adc     %rdx, %r9
+       mul     q0
+       add     %r11, %rbp
+       mov     $0, R32(%r11)
+       mov     -16(up,i,8), %r10
+       adc     $0, %r9
+       add     %rax, %r10
+       mov     -8(mp,i,8), %rax
+       adc     %rdx, %r11
+       mov     %rbp, -24(up,i,8)
+       add     %r9, %r10
+       adc     $0, %r11
+       mov     -8(up,i,8), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     $0, R32(%r9)
+       mov     (mp,i,8), %rax
+       adc     %rdx, %r9
+       mov     %r10, -16(up,i,8)
+L(e1): add     %r11, %rbp
+       adc     $0, %r9
+       mul     q0
+       mov     (up,i,8), %r10
+       mov     $0, R32(%r11)
+       add     %rax, %r10
+       mov     8(mp,i,8), %rax
+       adc     %rdx, %r11
+       mov     %rbp, -8(up,i,8)
+       add     %r9, %r10
+       adc     $0, %r11
+       mov     8(up,i,8), %rbp
+       mov     %r10, (up,i,8)
+       add     $4, i
+       jnc     L(tp1)
+
+L(ed1):        mul     q0
+       add     %rax, %rbp
+       adc     $0, %rdx
+       add     %r11, %rbp
+       adc     $0, %rdx
+       mov     %rbp, I(-8(up),-24(up,i,8))
+       mov     %rdx, (up,n,8)          C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp1)
+       jmp     L(cj)
+
+L(b3): cmp     $-3, R32(n)
+       jz      L(n3)
+
+L(otp3):lea    5(n), i
+       mov     (mp,n,8), %rax
+       mov     (up,n,8), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     $0, R32(%r9)
+       mov     8(mp,n,8), %rax
+       adc     %rdx, %r9
+       mul     q0
+       mov     8(up,n,8), %rbx
+       mov     $0, R32(%r11)
+       add     %rax, %rbx
+       mov     16(mp,n,8), %rax
+       adc     %rdx, %r11
+       add     %r9, %rbx
+       adc     $0, %r11
+       mov     16(up,n,8), %rbp
+       mov     %rbx, 8(up,n,8)
+       imul    u0inv, %rbx             C next q limb
+C      jmp     L(tp3)
+
+       ALIGNx
+L(tp3):        mul     q0
+       add     %rax, %rbp
+       mov     $0, R32(%r9)
+       mov     -16(mp,i,8), %rax
+       adc     %rdx, %r9
+       mul     q0
+       add     %r11, %rbp
+       mov     $0, R32(%r11)
+       mov     -16(up,i,8), %r10
+       adc     $0, %r9
+       add     %rax, %r10
+       mov     -8(mp,i,8), %rax
+       adc     %rdx, %r11
+       mov     %rbp, -24(up,i,8)
+       add     %r9, %r10
+       adc     $0, %r11
+       mov     -8(up,i,8), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     $0, R32(%r9)
+       mov     (mp,i,8), %rax
+       adc     %rdx, %r9
+       mov     %r10, -16(up,i,8)
+       add     %r11, %rbp
+       adc     $0, %r9
+       mul     q0
+       mov     (up,i,8), %r10
+       mov     $0, R32(%r11)
+       add     %rax, %r10
+       mov     8(mp,i,8), %rax
+       adc     %rdx, %r11
+       mov     %rbp, -8(up,i,8)
+       add     %r9, %r10
+       adc     $0, %r11
+       mov     8(up,i,8), %rbp
+       mov     %r10, (up,i,8)
+       add     $4, i
+       jnc     L(tp3)
+
+L(ed3):        mul     q0
+       add     %rax, %rbp
+       adc     $0, %rdx
+       add     %r11, %rbp
+       adc     $0, %rdx
+       mov     %rbp, I(-8(up),-24(up,i,8))
+       mov     %rdx, (up,n,8)          C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp3)
+C      jmp     L(cj)
+
+L(cj):
+IFSTD(`        lea     (up,n,8), up            C param 2: up
+       lea     (up,n,8), %rdx          C param 3: up - n
+       neg     R32(n)          ')      C param 4: n
+
+IFDOS(`        lea     (up,n,8), %rdx          C param 2: up
+       lea     (%rdx,n,8), %r8         C param 3: up - n
+       neg     R32(n)
+       mov     n, %r9                  C param 4: n
+       mov     rp, %rcx        ')      C param 1: rp
+
+       CALL(   mpn_add_n)
+
+L(ret):        pop     %r15
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+L(bx0):        test    $2, R8(n)
+       jnz     L(b2)
+
+L(b0):
+L(otp0):lea    2(n), i
+       mov     (mp,n,8), %rax
+       mul     q0
+       mov     $0, R32(%r11)
+       mov     (up,n,8), %r10
+       add     %rax, %r10
+       mov     8(mp,n,8), %rax
+       adc     %rdx, %r11
+       mov     8(up,n,8), %rbx
+       mul     q0
+       add     %rax, %rbx
+       mov     $0, R32(%r9)
+       mov     16(mp,n,8), %rax
+       adc     %rdx, %r9
+       add     %r11, %rbx
+       adc     $0, %r9
+       mul     q0
+       mov     16(up,n,8), %r10
+       mov     $0, R32(%r11)
+       add     %rax, %r10
+       mov     24(mp,n,8), %rax
+       adc     %rdx, %r11
+       mov     %rbx, 8(up,n,8)
+       imul    u0inv, %rbx             C next q limb
+       jmp     L(e0)
+
+       ALIGNx
+L(tp0):        mul     q0
+       add     %rax, %rbp
+       mov     $0, R32(%r9)
+       mov     -16(mp,i,8), %rax
+       adc     %rdx, %r9
+       mul     q0
+       add     %r11, %rbp
+       mov     $0, R32(%r11)
+       mov     -16(up,i,8), %r10
+       adc     $0, %r9
+       add     %rax, %r10
+       mov     -8(mp,i,8), %rax
+       adc     %rdx, %r11
+       mov     %rbp, -24(up,i,8)
+       add     %r9, %r10
+       adc     $0, %r11
+       mov     -8(up,i,8), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     $0, R32(%r9)
+       mov     (mp,i,8), %rax
+       adc     %rdx, %r9
+       mov     %r10, -16(up,i,8)
+       add     %r11, %rbp
+       adc     $0, %r9
+       mul     q0
+       mov     (up,i,8), %r10
+       mov     $0, R32(%r11)
+       add     %rax, %r10
+       mov     8(mp,i,8), %rax
+       adc     %rdx, %r11
+       mov     %rbp, -8(up,i,8)
+L(e0): add     %r9, %r10
+       adc     $0, %r11
+       mov     8(up,i,8), %rbp
+       mov     %r10, (up,i,8)
+       add     $4, i
+       jnc     L(tp0)
+
+L(ed0):        mul     q0
+       add     %rax, %rbp
+       adc     $0, %rdx
+       add     %r11, %rbp
+       adc     $0, %rdx
+       mov     %rbp, I(-8(up),-24(up,i,8))
+       mov     %rdx, (up,n,8)          C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp0)
+       jmp     L(cj)
+
+L(b2): cmp     $-2, R32(n)
+       jz      L(n2)
+
+L(otp2):lea    4(n), i
+       mov     (mp,n,8), %rax
+       mul     q0
+       mov     (up,n,8), %r10
+       mov     $0, R32(%r11)
+       add     %rax, %r10
+       mov     8(mp,n,8), %rax
+       adc     %rdx, %r11
+       mov     8(up,n,8), %rbx
+       mul     q0
+       add     %rax, %rbx
+       mov     $0, R32(%r9)
+       mov     16(mp,n,8), %rax
+       adc     %rdx, %r9
+       mul     q0
+       add     %r11, %rbx
+       mov     $0, R32(%r11)
+       mov     16(up,n,8), %r10
+       adc     $0, %r9
+       add     %rax, %r10
+       mov     24(mp,n,8), %rax
+       adc     %rdx, %r11
+       mov     %rbx, 8(up,n,8)
+       imul    u0inv, %rbx             C next q limb
+       jmp     L(e2)
+
+       ALIGNx
+L(tp2):        mul     q0
+       add     %rax, %rbp
+       mov     $0, R32(%r9)
+       mov     -16(mp,i,8), %rax
+       adc     %rdx, %r9
+       mul     q0
+       add     %r11, %rbp
+       mov     $0, R32(%r11)
+       mov     -16(up,i,8), %r10
+       adc     $0, %r9
+       add     %rax, %r10
+       mov     -8(mp,i,8), %rax
+       adc     %rdx, %r11
+       mov     %rbp, -24(up,i,8)
+L(e2): add     %r9, %r10
+       adc     $0, %r11
+       mov     -8(up,i,8), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     $0, R32(%r9)
+       mov     (mp,i,8), %rax
+       adc     %rdx, %r9
+       mov     %r10, -16(up,i,8)
+       add     %r11, %rbp
+       adc     $0, %r9
+       mul     q0
+       mov     (up,i,8), %r10
+       mov     $0, R32(%r11)
+       add     %rax, %r10
+       mov     8(mp,i,8), %rax
+       adc     %rdx, %r11
+       mov     %rbp, -8(up,i,8)
+       add     %r9, %r10
+       adc     $0, %r11
+       mov     8(up,i,8), %rbp
+       mov     %r10, (up,i,8)
+       add     $4, i
+       jnc     L(tp2)
+
+L(ed2):        mul     q0
+       add     %rax, %rbp
+       adc     $0, %rdx
+       add     %r11, %rbp
+       adc     $0, %rdx
+       mov     %rbp, I(-8(up),-24(up,i,8))
+       mov     %rdx, (up,n,8)          C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp2)
+       jmp     L(cj)
+
+L(n1): mov     (mp_param), %rax
+       mul     q0
+       add     -8(up), %rax
+       adc     (up), %rdx
+       mov     %rdx, (rp)
+       mov     $0, R32(%rax)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+
+L(n2): mov     (mp_param), %rax
+       mov     -16(up), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     %rdx, %r9
+       adc     $0, %r9
+       mov     -8(mp), %rax
+       mov     -8(up), %r10
+       mul     q0
+       add     %rax, %r10
+       mov     %rdx, %r11
+       adc     $0, %r11
+       add     %r9, %r10
+       adc     $0, %r11
+       mov     %r10, q0
+       imul    u0inv, q0               C next q0
+       mov     -16(mp), %rax
+       mul     q0
+       add     %rax, %r10
+       mov     %rdx, %r9
+       adc     $0, %r9
+       mov     -8(mp), %rax
+       mov     (up), %r14
+       mul     q0
+       add     %rax, %r14
+       adc     $0, %rdx
+       add     %r9, %r14
+       adc     $0, %rdx
+       xor     R32(%rax), R32(%rax)
+       add     %r11, %r14
+       adc     8(up), %rdx
+       mov     %r14, (rp)
+       mov     %rdx, 8(rp)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+
+       ALIGNx
+L(n3): mov     -24(mp), %rax
+       mov     -24(up), %r10
+       mul     q0
+       add     %rax, %r10
+       mov     -16(mp), %rax
+       mov     %rdx, %r11
+       adc     $0, %r11
+       mov     -16(up), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     %rdx, %r9
+       adc     $0, %r9
+       mov     -8(mp), %rax
+       add     %r11, %rbp
+       mov     -8(up), %r10
+       adc     $0, %r9
+       mul     q0
+       mov     %rbp, q0
+       imul    u0inv, q0               C next q0
+       add     %rax, %r10
+       mov     %rdx, %r11
+       adc     $0, %r11
+       mov     %rbp, -16(up)
+       add     %r9, %r10
+       adc     $0, %r11
+       mov     %r10, -8(up)
+       mov     %r11, -24(up)           C up[0]
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(n3)
+
+       mov     -48(up), %rdx
+       mov     -40(up), %rbx
+       xor     R32(%rax), R32(%rax)
+       add     %rbp, %rdx
+       adc     %r10, %rbx
+       adc     -8(up), %r11
+       mov     %rdx, (rp)
+       mov     %rbx, 8(rp)
+       mov     %r11, 16(rp)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+EPILOGUE()
+ASM_END()
diff --git a/mpn/x86_64/coreinhm/sec_tabselect.asm b/mpn/x86_64/coreinhm/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..e436034
--- /dev/null
@@ -0,0 +1,37 @@
+dnl  X86-64 mpn_sec_tabselect.
+
+dnl  Copyright 2012, 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')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_sec_tabselect)
+include_mpn(`x86_64/fastsse/sec_tabselect.asm')
index 8173e3daabe58d549ff51a160e0b52960b32a3f5..21f0bf465f6423845f4aeb4fd9137f1acd98cb0a 100644 (file)
-dnl  X86-64 mpn_addmul_2 optimised for Intel Sandy Bridge.
+dnl  AMD64 mpn_addmul_2 optimised for Intel Sandy Bridge.
 
-dnl  Copyright 2008, 2011, 2012 Free Software Foundation, Inc.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
-dnl  This file is part of the GNU MP Library.
+dnl  Copyright 2003-2005, 2007, 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
-C           cycles/limb
+C           cycles/limb        best
 C AMD K8,K9
-C AMD K10       4.07
-C AMD bd1
-C AMD bobcat    5.25
-C Intel P4     16.1
-C Intel core2
+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     3.2
+C Intel SBR     2.93           this
+C Intel IBR     2.66           this
+C Intel HWL     2.5             2.15
+C Intel BWL
 C Intel atom
-C VIA nano      5.23
+C VIA nano
 
 C This code is the result of running a code generation and optimisation tool
 C suite written by David Harvey and Torbjorn Granlund.
 
-C TODO
-C  * Tune feed-in and wind-down code.
+C When playing with pointers, set this to $2 to fall back to conservative
+C indexing in wind-down code.
+define(`I',`$1')
+
 
-C INPUT PARAMETERS
-define(`rp',     `%rdi')
-define(`up',     `%rsi')
-define(`n_param',`%rdx')
-define(`vp',     `%rcx')
+define(`rp',      `%rdi')   C rcx
+define(`up',      `%rsi')   C rdx
+define(`n_param', `%rdx')   C r8
+define(`vp',      `%rcx')   C r9
 
-define(`v0', `%r12')
-define(`v1', `%r13')
-define(`n',  `%r11')
+define(`n',      `%rcx')
+define(`v0',      `%rbx')
+define(`v1',      `%rbp')
+define(`w0',      `%r8')
+define(`w1',      `%r9')
+define(`w2',      `%r10')
+define(`w3',      `%r11')
+define(`X0',      `%r12')
+define(`X1',      `%r13')
 
 ABI_SUPPORT(DOS64)
 ABI_SUPPORT(STD64)
 
 ASM_START()
        TEXT
-       ALIGN(16)
+       ALIGN(32)
 PROLOGUE(mpn_addmul_2)
        FUNC_ENTRY(4)
        push    %rbx
+       push    %rbp
        push    %r12
        push    %r13
-       push    %r14
+
+       mov     (vp), v0
+       mov     8(vp), v1
 
        mov     (up), %rax
 
        mov     n_param, n
-       mov     0(vp), v0
-       mov     8(vp), v1
-       shr     $2, n
-       and     $3, R32(n_param)
-       jz      L(b0)
-       cmp     $2, R32(n_param)
-       jb      L(b1)
-       jz      L(b2)
-
-L(b3): mov     (rp), %r10
-       mov     $0, R32(%rcx)
-       mul     v0
-       add     %rax, %r10
-       mov     %rdx, %r14
-       adc     $0, %r14
-       lea     -16(rp), rp
-       lea     -16(up), up
-       mov     $0, R32(%r9)
-       mov     $0, R32(%rbx)
-       inc     n
-       jmp     L(L3)
+       neg     n
 
-L(b0): mov     (rp), %r8
+       lea     (up,n_param,8), up
+       lea     8(rp,n_param,8), rp
        mul     v0
-       add     %rax, %r8
-       mov     %rdx, %r9
-       adc     $0, %r9
-       mov     $0, R32(%rbx)
-       lea     -8(rp), rp
-       lea     -8(up), up
-       jmp     L(L0)
-
-L(b1): mov     (rp), %r10
-       mov     $0, R32(%rcx)
-       mul     v0
-       add     %rax, %r10
-       mov     %rdx, %r14
-       adc     $0, %r14
-       mov     %r10, 0(rp)
-       jmp     L(L1)
 
-L(b2): mov     (rp), %r8
-       mul     v0
-       add     %rax, %r8
-       mov     $0, R32(%rbx)
-       mov     %rdx, %r9
-       adc     $0, %r9
-       lea     -24(rp), rp
-       lea     -24(up), up
+       test    $1, R8(n)
+       jnz     L(bx1)
+
+L(bx0):        mov     -8(rp,n,8), X0
+       mov     %rdx, w1
+       add     %rax, X0
+       adc     $0, w1
+       mov     (up,n,8), %rax
+       xor     w0, w0
+       xor     w3, w3
+       test    $2, R8(n)
+       jnz     L(b10)
+
+L(b00):        nop                             C this nop make loop go faster on SBR!
+       mul     v1
+       mov     (rp,n,8), X1
+       jmp     L(lo0)
+
+L(b10):        lea     -2(n), n
+       jmp     L(lo2)
+
+L(bx1):        mov     -8(rp,n,8), X1
+       mov     %rdx, w3
+       add     %rax, X1
+       adc     $0, w3
+       mov     (up,n,8), %rax
+       xor     w1, w1
+       xor     w2, w2
+       test    $2, R8(n)
+       jz      L(b11)
+
+L(b01):        mov     (rp,n,8), X0
        inc     n
-       jmp     L(L2)
+       jmp     L(lo1)
+
+L(b11):        dec     n
+       jmp     L(lo3)
 
        ALIGN(32)
-L(top):        mov     %r10, 32(rp)
-       adc     %rbx, %r14              C 10
-       lea     32(rp), rp
-L(L1): mov     0(up), %rax
-       adc     $0, R32(%rcx)
-       mul     v1
-       mov     $0, R32(%rbx)
-       mov     8(rp), %r8
-       add     %rax, %r8
-       mov     %rdx, %r9
-       mov     8(up), %rax
-       adc     $0, %r9
+L(top):
+L(lo1):        mul     v1
+       mov     %rdx, w0                C 1
+       add     %rax, X0                C 0
+       adc     $0, w0                  C 1
+       add     w1, X1                  C 3
+       adc     $0, w3                  C 0
+       add     w2, X0                  C 0
+       adc     $0, w0                  C 1
+       mov     (up,n,8), %rax
        mul     v0
-       add     %rax, %r8
-       adc     %rdx, %r9
-       adc     $0, R32(%rbx)
-       add     %r14, %r8               C 0 12
-       adc     %rcx, %r9               C 1
-L(L0): mov     8(up), %rax
-       adc     $0, R32(%rbx)
-       mov     16(rp), %r10
+       add     %rax, X0                C 0
+       mov     %rdx, w1                C 1
+       adc     $0, w1                  C 1
+       mov     (up,n,8), %rax
        mul     v1
-       add     %rax, %r10
-       mov     %rdx, %r14
-       mov     16(up), %rax
-       mov     $0, R32(%rcx)
-       adc     $0, %r14
+       mov     X1, -16(rp,n,8)         C 3
+       mov     (rp,n,8), X1            C 1
+       add     w3, X0                  C 0
+       adc     $0, w1                  C 1
+L(lo0):        mov     %rdx, w2                C 2
+       mov     X0, -8(rp,n,8)          C 0
+       add     %rax, X1                C 1
+       adc     $0, w2                  C 2
+       mov     8(up,n,8), %rax
+       add     w0, X1                  C 1
+       adc     $0, w2                  C 2
        mul     v0
-       add     %rax, %r10
-       adc     %rdx, %r14
-       adc     $0, R32(%rcx)
-       mov     %r8, 8(rp)
-L(L3): mov     24(rp), %r8
-       mov     16(up), %rax
-       mul     v1
-       add     %r9, %r10               C 3
-       adc     %rbx, %r14              C 4
-       adc     $0, R32(%rcx)
-       add     %rax, %r8
-       mov     %rdx, %r9
-       adc     $0, %r9
-       mov     24(up), %rax
+       add     %rax, X1                C 1
+       mov     %rdx, w3                C 2
+       adc     $0, w3                  C 2
+       mov     8(up,n,8), %rax
+L(lo3):        mul     v1
+       add     w1, X1                  C 1
+       mov     8(rp,n,8), X0           C 2
+       adc     $0, w3                  C 2
+       mov     %rdx, w0                C 3
+       add     %rax, X0                C 2
+       adc     $0, w0                  C 3
+       mov     16(up,n,8), %rax
        mul     v0
-       add     %rax, %r8
-       mov     $0, R32(%rbx)
-       adc     %rdx, %r9
-       adc     $0, R32(%rbx)
-       add     %r14, %r8               C 6
-       adc     %rcx, %r9               C 7
-       mov     %r10, 16(rp)
-L(L2): mov     24(up), %rax
-       adc     $0, R32(%rbx)
-       mov     32(rp), %r10
-       mul     v1
-       add     %rax, %r10
-       mov     32(up), %rax
-       lea     32(up), up
-       mov     %rdx, %r14
-       adc     $0, %r14
-       mov     %r8, 24(rp)
-       mov     $0, R32(%rcx)
+       add     w2, X0                  C 2
+       mov     X1, (rp,n,8)            C 1
+       mov     %rdx, w1                C 3
+       adc     $0, w0                  C 3
+       add     %rax, X0                C 2
+       adc     $0, w1                  C 3
+       mov     16(up,n,8), %rax
+       add     w3, X0                  C 2
+       adc     $0, w1                  C 3
+L(lo2):        mul     v1
+       mov     16(rp,n,8), X1          C 3
+       add     %rax, X1                C 3
+       mov     %rdx, w2                C 4
+       adc     $0, w2                  C 4
+       mov     24(up,n,8), %rax
+       mov     X0, 8(rp,n,8)           C 2
        mul     v0
-       add     %rax, %r10
-       adc     %rdx, %r14
-       adc     $0, R32(%rcx)
-       add     %r9, %r10               C 9
-       dec     n
-       jnz     L(top)
-
-       mov     %r10, 32(rp)
-       adc     %rbx, %r14
-       mov     0(up), %rax
-       adc     $0, R32(%rcx)
-       mul     v1
-       mov     %rax, %r8
+       add     w0, X1                  C 3
+       mov     %rdx, w3                C 4
+       adc     $0, w2                  C 4
+       add     %rax, X1                C 3
+       mov     24(up,n,8), %rax
+       mov     24(rp,n,8), X0          C 0     useless but harmless final read
+       adc     $0, w3                  C 4
+       add     $4, n
+       jnc     L(top)
+
+L(end):        mul     v1
+       add     w1, X1
+       adc     $0, w3
+       add     w2, %rax
+       adc     $0, %rdx
+       mov     X1, I(-16(rp),-16(rp,n,8))
+       add     w3, %rax
+       adc     $0, %rdx
+       mov     %rax, I(-8(rp),-8(rp,n,8))
        mov     %rdx, %rax
-       add     %r14, %r8
-       adc     %rcx, %rax
-       mov     %r8, 40(rp)
 
-       pop     %r14
        pop     %r13
        pop     %r12
+       pop     %rbp
        pop     %rbx
        FUNC_EXIT()
        ret
 EPILOGUE()
-ASM_END()
index 00a0c33887012ab06583dad1b545a137cd6a4d7c..2319a80060735de7fd8bdcd144d818188fae33c1 100644 (file)
@@ -3,22 +3,33 @@ dnl  AMD64 mpn_rsblsh1_n -- rp[] = (vp[] << 1) - up[]
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index cf907eccf3fcabc5b5c4529c15c782a86d4d81bc..9416d5a164559c8b4dfa57418282cf66133ff647 100644 (file)
@@ -3,22 +3,33 @@ dnl  AMD64 mpn_rsblsh2_n -- rp[] = (vp[] << 1) - up[]
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index e3c8bb575f019667b7b748d04df92743fe5663ff..23ace418895e559c7a935b8d52c55ac0793569ee 100644 (file)
@@ -1,22 +1,33 @@
 dnl  AMD64 mpn_addlshC_n -- rp[] = up[] + (vp[] << C)
 dnl  AMD64 mpn_rsblshC_n -- rp[] = (vp[] << C) - up[]
 
-dnl  Copyright 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2009-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 C           cycles/limb
index a8b5b5dcb68c1493bd5561b9a6881e82fefd1d2c..db8ee688496c79d3371ae750457e15e5ebb7a739 100644 (file)
@@ -7,19 +7,30 @@ dnl  Contributed to the GNU project by Torbjorn Granlund.
 dnl  Copyright 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 1b227636c26ead7e0c395a8ec73c4c0a4f3a2cf2..01abf78a0d84a7bede2d838b47dbe1f27c03fe26 100644 (file)
@@ -1,51 +1,78 @@
-dnl  X86-64 mpn_add_n, mpn_sub_n, optimized for Intel Sandy Bridge.
+dnl  AMD64 mpn_add_n, mpn_sub_n optimised for Sandy bridge, Ivy bridge, and
+dnl  Haswell.
 
-dnl  Copyright 2003, 2004, 2005, 2007, 2008, 2010, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
-dnl  This file is part of the GNU MP Library.
+dnl  Copyright 2003-2005, 2007, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
-
 C           cycles/limb
-C AMD K8,K9     1.85
-C AMD K10       ?
-C Intel P4      ?
-C Intel core2   5
-C Intel NHM     5.5
-C Intel SBR     1.61
-C Intel atom    3
-C VIA nano      3
-
-C INPUT PARAMETERS
-define(`rp',   `%rdi')
-define(`up',   `%rsi')
-define(`vp',   `%rdx')
-define(`n',    `%rcx')
-define(`cy',   `%r8')          C (only for mpn_add_nc and mpn_sub_nc)
+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 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
+C No micro-optimisation has been done.
+C
+C N.B.!  The loop alignment padding insns are executed.  If editing the code,
+C make sure the padding does not become excessive.  It is now a 4-byte nop.
+
+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)')
+  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)')
+  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)
 
@@ -54,101 +81,116 @@ ABI_SUPPORT(STD64)
 
 ASM_START()
        TEXT
-       ALIGN(16)
+       ALIGN(32)
 PROLOGUE(func)
        FUNC_ENTRY(4)
        xor     %r8, %r8
+
 L(ent):        mov     R32(n), R32(%rax)
        shr     $2, n
-       and     $3, R32(%rax)
-       jz      L(b0)
-       cmp     $2, R32(%rax)
-       jz      L(b2)
-       jg      L(b3)
-
-L(b1): mov     (up), %r10
-       test    n, n
-       jnz     L(gt1)
-       neg     R32(%r8)                C set CF from argument
-       ADCSBB  (vp), %r10
-       mov     %r10, (rp)
-       mov     R32(n), R32(%rax)       C zero rax
-       adc     R32(%rax), R32(%rax)
-       FUNC_EXIT()
-       ret
-L(gt1):        neg     R32(%r8)
-       ADCSBB  (vp), %r10
-       mov     8(up), %r11
-       lea     16(up), up
-       lea     -16(vp), vp
-       lea     -16(rp), rp
-       jmp     L(m1)
 
-L(b3): mov     (up), %rax
+       test    $1, R8(%rax)
+       jnz     L(bx1)
+
+L(bx0):        test    $2, R8(%rax)
+       jnz     L(b10)
+
+L(b00):        neg     %r8
+       mov     (up), %r8
        mov     8(up), %r9
+       ADCSBB  (vp), %r8
+       ADCSBB  8(vp), %r9
        mov     16(up), %r10
-       test    n, n
-       jnz     L(gt3)
-       neg     R32(%r8)
-       lea     -32(rp), rp
-       jmp     L(e3)
-L(gt3):        neg     R32(%r8)
-       ADCSBB  (vp), %rax
-       jmp     L(m3)
-
-       nop                             C alignment
-       nop                             C alignment
-L(b0): mov     (up), %r11
-       neg     R32(%r8)
-       lea     -24(vp), vp
-       lea     -24(rp), rp
-       lea     8(up), up
-       jmp     L(m0)
+       mov     24(up), %r11
+       lea     32(up), up
+       ADCSBB  16(vp), %r10
+       ADCSBB  24(vp), %r11
+       lea     32(vp), vp
+       lea     -16(rp), rp
+       jmp     L(lo0)
 
-L(b2): mov     (up), %r9
-       mov     8(up), %r10
-       lea     -8(vp), vp
-       test    n, n
-       jnz     L(gt2)
-       neg     R32(%r8)
-       lea     -40(rp), rp
-       jmp     L(e2)
-L(gt2):        neg     R32(%r8)
-       lea     -8(up), up
+L(b10):        neg     %r8
+       mov     (up), %r10
+       mov     8(up), %r11
+       ADCSBB  0(vp), %r10
+       ADCSBB  8(vp), %r11
+       jrcxz   L(e2)
+       mov     16(up), %r8
+       mov     24(up), %r9
+       lea     16(up), up
+       ADCSBB  16(vp), %r8
+       ADCSBB  24(vp), %r9
+       lea     16(vp), vp
+       lea     (rp), rp
+       jmp     L(lo2)
+
+L(e2): mov     %r10, (rp)
+       mov     %r11, 8(rp)
+       setc    R8(%rax)
+       FUNC_EXIT()
+       ret
+
+L(bx1):        test    $2, R8(%rax)
+       jnz     L(b11)
+
+L(b01):        neg     %r8
+       mov     (up), %r11
+       ADCSBB  (vp), %r11
+       jrcxz   L(e1)
+       mov     8(up), %r8
+       mov     16(up), %r9
+       lea     8(up), up
        lea     -8(rp), rp
-       jmp     L(m2)
+       ADCSBB  8(vp), %r8
+       ADCSBB  16(vp), %r9
+       lea     8(vp), vp
+       jmp     L(lo1)
 
-       ALIGN(8)
-L(top):        mov     %r11, 24(rp)
-       ADCSBB  (vp), %rax
-       lea     32(rp), rp
-L(m3): mov     %rax, (rp)
-L(m2): ADCSBB  8(vp), %r9
+L(e1): mov     %r11, (rp)
+       setc    R8(%rax)
+       FUNC_EXIT()
+       ret
+
+L(b11):        neg     %r8
+       mov     (up), %r9
+       ADCSBB  (vp), %r9
+       mov     8(up), %r10
+       mov     16(up), %r11
+       lea     24(up), up
+       ADCSBB  8(vp), %r10
+       ADCSBB  16(vp), %r11
+       lea     24(vp), vp
+       mov     %r9, (rp)
+       lea     8(rp), rp
+       jrcxz   L(end)
+
+       ALIGN(32)
+L(top):        mov     (up), %r8
+       mov     8(up), %r9
+       ADCSBB  (vp), %r8
+       ADCSBB  8(vp), %r9
+L(lo2):        mov     %r10, (rp)
+L(lo1):        mov     %r11, 8(rp)
+       mov     16(up), %r10
        mov     24(up), %r11
-       mov     %r9, 8(rp)
-       ADCSBB  16(vp), %r10
        lea     32(up), up
-L(m1): mov     %r10, 16(rp)
-L(m0): ADCSBB  24(vp), %r11
-       mov     (up), %rax
-       mov     8(up), %r9
+       ADCSBB  16(vp), %r10
+       ADCSBB  24(vp), %r11
        lea     32(vp), vp
+L(lo0):        mov     %r8, 16(rp)
+L(lo3):        mov     %r9, 24(rp)
+       lea     32(rp), rp
        dec     n
-       mov     16(up), %r10
        jnz     L(top)
 
-       mov     %r11, 24(rp)
-L(e3): ADCSBB  (vp), %rax
-       mov     %rax, 32(rp)
-L(e2): ADCSBB  8(vp), %r9
-       mov     %r9, 40(rp)
-L(e1): ADCSBB  16(vp), %r10
-       mov     %r10, 48(rp)
-       mov     R32(n), R32(%rax)       C zero rax
-       adc     R32(%rax), R32(%rax)
+L(end):        mov     R32(n), R32(%rax)       C zero rax
+       mov     %r10, (rp)
+       mov     %r11, 8(rp)
+       setc    R8(%rax)
        FUNC_EXIT()
        ret
 EPILOGUE()
+       ALIGN(16)
 PROLOGUE(func_nc)
        FUNC_ENTRY(4)
 IFDOS(`        mov     56(%rsp), %r8   ')
index 4df5939b12da4d4d286eac5425fc200c8d621d68..9f01d9c061224673a7bcc52d13bf9e99be5376e5 100644 (file)
@@ -1,49 +1,66 @@
 dnl  X86-64 mpn_addmul_1 and mpn_submul_1 optimised for Intel Sandy Bridge.
 
-dnl  Copyright 2003, 2004, 2005, 2007, 2008, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
-dnl  This file is part of the GNU MP Library.
+dnl  Copyright 2003-2005, 2007, 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 C           cycles/limb
-C AMD K8,K9     4.77
-C AMD K10       4.77
-C AMD bd1       ?
-C AMD bobcat    5.78
-C Intel P4     15-17
-C Intel core2   5.4
-C Intel NHM     5.23
-C Intel SBR     3.25
-C Intel atom    ?
-C VIA nano      5.5
+C AMD K8,K9
+C AMD K10
+C AMD bull
+C AMD pile
+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 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 optimization tool suite written by David Harvey and Torbjörn Granlund.
 
 define(`rp',      `%rdi')   C rcx
 define(`up',      `%rsi')   C rdx
 define(`n_param', `%rdx')   C r8
 define(`v0',      `%rcx')   C r9
 
-define(`n',      `%rbx')
+define(`n',       `%rbx')
+
+define(`I',`$1')
 
 ifdef(`OPERATION_addmul_1',`
       define(`ADDSUB',        `add')
@@ -54,21 +71,20 @@ ifdef(`OPERATION_submul_1',`
       define(`func',  `mpn_submul_1')
 ')
 
-dnl Disable until tested ABI_SUPPORT(DOS64)
+ABI_SUPPORT(DOS64)
 ABI_SUPPORT(STD64)
 
 MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
 
-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
+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
 
 ASM_START()
        TEXT
-       ALIGN(16)
+       ALIGN(32)
 PROLOGUE(func)
 
 IFDOS(``push   %rsi            '')
@@ -77,107 +93,117 @@ IFDOS(``mov       %rdx, %rsi      '')
 
        mov     (up), %rax
        push    %rbx
-IFSTD(`        mov     R32(n_param), R32(%rdx) ')
-IFDOS(`        mov     n, %rdx                 ')
-IFSTD(`        mov     R32(n_param), R32(n)    ')
-
-       lea     -8(up,n,8), up
-       and     $3, R32(%rdx)
-       jz      L(b0)
-       cmp     $2, R32(%rdx)
-       jz      L(b2)
-       jnc     L(b3)
-
-L(b1): mov     (rp), %r8
-       lea     -8(rp,n,8), rp
-       neg     n
-       mov     $0, R32(%r11)
-       add     $4, n
-       jc      L(end)
-       jmp     L(top)
+       lea     (up,n_param,8), up
+       lea     (rp,n_param,8), rp
+
+       test    $1, R8(n_param)
+       jnz     L(b13)
 
-L(b2): mov     (rp), %r10
-       lea     -8(rp,n,8), rp
-       neg     n
-       add     $1, n
+L(b02):        xor     R32(%r11), R32(%r11)
+       test    $2, R8(n_param)
+       jnz     L(b2)
+
+L(b0): mov     $1, R32(n)
+       sub     n_param, n
        mul     v0
-       ADDSUB  %rax, %r10
-       mov     8(up,n,8), %rax
-       mov     %rdx, %r11
-       mov     $0, R32(%r9)
-       jmp     L(L2)
+       mov     %rdx, %r9
+       mov     -8(rp,n,8), %r8
+       jmp     L(e0)
 
-L(b3): mov     (rp), %r8
-       lea     -8(rp,n,8), rp
-       neg     n
-       add     $2, n
+       ALIGN(16)
+L(b2): mov     $-1, n
+       sub     n_param, n
        mul     v0
+       mov     8(rp,n,8), %r8
        mov     %rdx, %r9
-       mov     $0, R32(%r11)
-       jmp     L(L3)
+       jmp     L(e2)
 
-L(b0): mov     (rp), %r10
-       lea     -8(rp,n,8), rp
-       neg     n
-       add     $3, n
+       ALIGN(16)
+L(b13):        xor     R32(%r9), R32(%r9)
+       test    $2, R8(n_param)
+       jnz     L(b3)
+
+L(b1): mov     $2, R32(n)
+       sub     n_param, n
+       jns     L(1)
        mul     v0
-       ADDSUB  %rax, %r10
+       mov     -16(rp,n,8), %r10
        mov     %rdx, %r11
-       mov     -8(up,n,8), %rax
-       adc     $0, %r11
-       mov     $0, R32(%r9)
-       jmp     L(L0)
+       jmp     L(e1)
 
        ALIGN(16)
+L(b3): xor     R32(n), R32(n)
+       sub     n_param, n
+       mul     v0
+       mov     (rp,n,8), %r10
+       jmp     L(e3)
+
+       ALIGN(32)
 L(top):        mul     v0
-       ADDSUB  %rax, %r8
-       mov     %rdx, %r9
-       adc     $0, %r9
-       mov     -16(up,n,8), %rax
-       ADDSUB  %r11, %r8
        mov     -16(rp,n,8), %r10
-       adc     $0, %r9
-       mul     v0
-       ADDSUB  %rax, %r10
+       ADDSUB  %r11, %r8
        mov     %rdx, %r11
+       adc     $0, %r9
+       mov     %r8, -24(rp,n,8)
+L(e1): ADDSUB  %rax, %r10
        mov     -8(up,n,8), %rax
        adc     $0, %r11
-       mov     %r8, -24(rp,n,8)
-L(L0): mul     v0
+       mul     v0
        ADDSUB  %r9, %r10
+       mov     %rdx, %r9
        mov     -8(rp,n,8), %r8
        adc     $0, %r11
-       mov     %rdx, %r9
        mov     %r10, -16(rp,n,8)
-L(L3): ADDSUB  %rax, %r8
+L(e0): ADDSUB  %rax, %r8
        adc     $0, %r9
        mov     (up,n,8), %rax
+       mul     v0
+       mov     (rp,n,8), %r10
        ADDSUB  %r11, %r8
+       mov     %r8, -8(rp,n,8)
        adc     $0, %r9
-       mov     (rp,n,8), %r10
-       mul     v0
+L(e3): mov     %rdx, %r11
        ADDSUB  %rax, %r10
        mov     8(up,n,8), %rax
-       mov     %rdx, %r11
-       mov     %r8, -8(rp,n,8)
-L(L2): adc     $0, %r11
+       adc     $0, %r11
+       mul     v0
        mov     8(rp,n,8), %r8
        ADDSUB  %r9, %r10
-       adc     $0, %r11
+       mov     %rdx, %r9
        mov     %r10, (rp,n,8)
+       adc     $0, %r11
+L(e2): ADDSUB  %rax, %r8
+       adc     $0, %r9
+       mov     16(up,n,8), %rax
        add     $4, n
        jnc     L(top)
 
 L(end):        mul     v0
-       ADDSUB  %rax, %r8
-       mov     %rdx, %rax
-       adc     $0, %rax
+       mov     I(-8(rp),-16(rp,n,8)), %r10
        ADDSUB  %r11, %r8
-       adc     $0, %rax
-       mov     %r8, (rp)
+       mov     %rdx, %r11
+       adc     $0, %r9
+       mov     %r8, I(-16(rp),-24(rp,n,8))
+       ADDSUB  %rax, %r10
+       adc     $0, %r11
+       ADDSUB  %r9, %r10
+       adc     $0, %r11
+       mov     %r10, I(-8(rp),-16(rp,n,8))
+       mov     %r11, %rax
 
        pop     %rbx
 IFDOS(``pop    %rdi            '')
+IFDOS(``pop    %rsi            '')
+       ret
+
+       ALIGN(16)
+L(1):  mul     v0
+       ADDSUB  %rax, -8(rp)
+       mov     %rdx, %rax
+       adc     $0, %rax
+       pop     %rbx
+IFDOS(``pop    %rdi            '')
 IFDOS(``pop    %rsi            '')
        ret
 EPILOGUE()
+ASM_END()
diff --git a/mpn/x86_64/coreisbr/divrem_1.asm b/mpn/x86_64/coreisbr/divrem_1.asm
new file mode 100644 (file)
index 0000000..d9f371f
--- /dev/null
@@ -0,0 +1,37 @@
+dnl  X86-64 mpn_divrem_1
+
+dnl  Copyright 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')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_divrem_1 mpn_preinv_divrem_1)
+include_mpn(`x86_64/divrem_1.asm')
index 2f1cb85ec96a3626f1682c7a0aaab8cd626f0f19..3a91b4c30e4d8433f0d0b33d3e558e92dfa85bcb 100644 (file)
@@ -1,27 +1,39 @@
 /* Sandy Bridge gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 /* 3300 MHz Core i5 Sandy Bridge */
+/* FFT tuning limit = 100000000 */
+/* Generated by tuneup.c, 2014-03-12, gcc 4.5 */
 
 #define MOD_1_NORM_THRESHOLD                 0  /* always */
 #define MOD_1_UNNORM_THRESHOLD               0  /* always */
@@ -31,182 +43,182 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #define MOD_1_2_TO_MOD_1_4_THRESHOLD        20
 #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           30
 
-#define MUL_TOOM22_THRESHOLD                18
-#define MUL_TOOM33_THRESHOLD                57
-#define MUL_TOOM44_THRESHOLD               154
-#define MUL_TOOM6H_THRESHOLD               226
+#define MUL_TOOM22_THRESHOLD                20
+#define MUL_TOOM33_THRESHOLD                65
+#define MUL_TOOM44_THRESHOLD               166
+#define MUL_TOOM6H_THRESHOLD               254
 #define MUL_TOOM8H_THRESHOLD               333
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD      97
-#define MUL_TOOM32_TO_TOOM53_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     138
+#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                 26
-#define SQR_TOOM3_THRESHOLD                 81
+#define SQR_TOOM2_THRESHOLD                 28
+#define SQR_TOOM3_THRESHOLD                 93
 #define SQR_TOOM4_THRESHOLD                250
-#define SQR_TOOM6_THRESHOLD                345
-#define SQR_TOOM8_THRESHOLD                381
+#define SQR_TOOM6_THRESHOLD                348
+#define SQR_TOOM8_THRESHOLD                454
 
-#define MULMID_TOOM42_THRESHOLD             24
+#define MULMID_TOOM42_THRESHOLD             36
 
-#define MULMOD_BNM1_THRESHOLD               14
-#define SQRMOD_BNM1_THRESHOLD               14
-
-#define POWM_SEC_TABLE  4,35,516,1036,1222
+#define MULMOD_BNM1_THRESHOLD               12
+#define SQRMOD_BNM1_THRESHOLD               15
 
 #define MUL_FFT_MODF_THRESHOLD             380  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    380, 5}, {     17, 6}, {      9, 5}, {     19, 6}, \
+  { {    380, 5}, {     19, 6}, {     10, 5}, {     21, 6}, \
     {     11, 5}, {     23, 6}, {     21, 7}, {     11, 6}, \
-    {     23, 7}, {     21, 8}, {     11, 7}, {     24, 8}, \
+    {     23, 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}, \
-    {     49, 9}, {     27,10}, {     15, 9}, {     39,10}, \
+    {     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,11}, {     63,10}, \
-    {    135,11}, {     79,10}, {    159, 9}, {    319,10}, \
-    {    167,11}, {     95,10}, {    191, 9}, {    383,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}, \
-    {    303,10}, {    607,12}, {    159,11}, {    319,10}, \
-    {    639,11}, {    351,10}, {    703, 9}, {   1407,11}, \
-    {    367,12}, {    191,11}, {    383,10}, {    767,11}, \
-    {    415,10}, {    831,12}, {    223,11}, {    447,10}, \
-    {    895,13}, {    127,12}, {    255,11}, {    543,10}, \
-    {   1087,12}, {    287,11}, {    575,10}, {   1151,11}, \
-    {    607,12}, {    319,11}, {    639,12}, {    351,11}, \
-    {    703,10}, {   1407,11}, {    735,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,12}, {    575,11}, {   1151,12}, {    607,11}, \
-    {   1215,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,11}, {   2431,13}, \
-    {    639,12}, {   1279,13}, {    703,12}, {   1407,14}, \
-    {    383,13}, {    831,12}, {   1663,13}, {    959,12}, \
-    {   1919,14}, {    511,13}, {   1087,12}, {   2175,13}, \
-    {   1215,12}, {   2431,14}, {    639,13}, {   1343,12}, \
-    {   2687,13}, {   1407,12}, {   2815,13}, {   1471,14}, \
+    {    127, 9}, {    255,10}, {    135,11}, {     79,10}, \
+    {    159, 9}, {    319,10}, {    167,11}, {     95,10}, \
+    {    191, 9}, {    383, 8}, {    767, 7}, {   1599, 8}, \
+    {    831, 9}, {    447,10}, {    239,12}, {     63,11}, \
+    {    127,10}, {    255,11}, {    143,10}, {    287, 9}, \
+    {    575,12}, {     95,11}, {    191,10}, {    383,11}, \
+    {    207,10}, {    447,13}, {     63,12}, {    127,11}, \
+    {    255,10}, {    511,11}, {    271,10}, {    543, 8}, \
+    {   2175,11}, {    303,12}, {    159,11}, {    319,10}, \
+    {    671,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}, {    511,10}, {   1023,11}, {    543,12}, \
+    {    287,11}, {    575,10}, {   1151,11}, {    607,12}, \
+    {    319,11}, {    671,12}, {    351,11}, {    703,10}, \
+    {   1407,13}, {    191,12}, {    383,11}, {    767,12}, \
+    {    415,11}, {    831,12}, {    479,14}, {    127,13}, \
+    {    255,12}, {    511,11}, {   1023,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,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}, {    959,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}, {   1919,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,13}, {   3839,16}, {    511,15}, \
-    {   1023,14}, {   2431,13}, {   4863,15}, {   1279,14}, \
-    {   2943,13}, {   5887,15}, {  32768,16}, {  65536,17}, \
+    {   1407,13}, {   2943,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}, {  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 SQR_FFT_MODF_THRESHOLD             304  /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD             336  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    304, 5}, {     17, 6}, {      9, 5}, {     19, 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}, \
-    {     41, 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,11}, {     31,10}, {     79,11}, \
-    {     47,12}, {     31,11}, {     63,10}, {    127, 9}, \
-    {    255, 8}, {    511,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,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,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,10}, {    959,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,12}, {    479,11}, \
-    {    959,10}, {   1919,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}, {    703,11}, {   1407,13}, \
-    {    383,12}, {    767,11}, {   1535,12}, {    831,13}, \
-    {    447,12}, {    959,11}, {   1919,14}, {    255,13}, \
-    {    511,12}, {   1087,13}, {    575,12}, {   1215,11}, \
-    {   2431,13}, {    639,12}, {   1279,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,13}, {   1471,14}, \
-    {    767,13}, {   1663,14}, {    895,13}, {   1919,15}, \
+  { {    336, 5}, {     11, 4}, {     23, 5}, {     19, 6}, \
+    {     10, 5}, {     21, 6}, {     11, 5}, {     23, 6}, \
+    {     25, 7}, {     13, 6}, {     27, 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}, \
+    {     63,10}, {     39, 9}, {     79,10}, {     55,11}, \
+    {     31,10}, {     79,11}, {     47,10}, {     95,12}, \
+    {     31,11}, {     63,10}, {    127, 9}, {    255, 8}, \
+    {    511,10}, {    135,11}, {     79, 9}, {    319, 8}, \
+    {    639,11}, {     95,10}, {    191, 9}, {    383,12}, \
+    {     63,11}, {    127,10}, {    255, 9}, {    511,10}, \
+    {    271, 9}, {    543,11}, {    143,10}, {    287, 8}, \
+    {   1151,10}, {    303, 6}, {   4863, 8}, {   1279, 9}, \
+    {    671,11}, {    175,10}, {    367,12}, {     95,11}, \
+    {    191,10}, {    383,11}, {    207, 9}, {    831,10}, \
+    {    447,13}, {     63,12}, {    127,11}, {    255,10}, \
+    {    511,11}, {    271, 9}, {   1087,10}, {    575,11}, \
+    {    303,10}, {    607,11}, {    319,10}, {    671,11}, \
+    {    367,12}, {    191,11}, {    383,10}, {    767,11}, \
+    {    415,12}, {    223,11}, {    447,10}, {    959,12}, \
+    {    255,11}, {    511,10}, {   1023,11}, {    575,10}, \
+    {   1151,11}, {    607,10}, {   1215,12}, {    319,11}, \
+    {    671, 9}, {   2687,12}, {    351,11}, {    703,13}, \
+    {    191,12}, {    415,11}, {    831,12}, {    479,14}, \
+    {    127,13}, {    255,12}, {    511,11}, {   1023,12}, \
+    {    607,13}, {    319,12}, {    671,11}, {   1343,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,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}, {   1663,13}, \
-    {   3455,14}, {   1919,16}, {    511,15}, {   1023,14}, \
-    {   2431,13}, {   4863,15}, {   1279,14}, {   2943,13}, \
-    {   5887,15}, {  32768,16}, {  65536,17}, { 131072,18}, \
+    {   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}, {  65536,17}, { 131072,18}, \
     { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
     {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 198
-#define SQR_FFT_THRESHOLD                 2752
+#define SQR_FFT_TABLE3_SIZE 190
+#define SQR_FFT_THRESHOLD                 3264
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
-#define MULLO_DC_THRESHOLD                  51
-#define MULLO_MUL_N_THRESHOLD             8648
+#define MULLO_DC_THRESHOLD                  62
+#define MULLO_MUL_N_THRESHOLD             8907
 
-#define DC_DIV_QR_THRESHOLD                 63
-#define DC_DIVAPPR_Q_THRESHOLD             196
-#define DC_BDIV_QR_THRESHOLD                59
-#define DC_BDIV_Q_THRESHOLD                134
+#define DC_DIV_QR_THRESHOLD                 52
+#define DC_DIVAPPR_Q_THRESHOLD             166
+#define DC_BDIV_QR_THRESHOLD                46
+#define DC_BDIV_Q_THRESHOLD                104
 
-#define INV_MULMOD_BNM1_THRESHOLD           46
-#define INV_NEWTON_THRESHOLD               202
-#define INV_APPR_THRESHOLD                 190
+#define INV_MULMOD_BNM1_THRESHOLD           42
+#define INV_NEWTON_THRESHOLD               166
+#define INV_APPR_THRESHOLD                 165
 
-#define BINV_NEWTON_THRESHOLD              224
-#define REDC_1_TO_REDC_2_THRESHOLD          16
-#define REDC_2_TO_REDC_N_THRESHOLD          55
+#define BINV_NEWTON_THRESHOLD              228
+#define REDC_1_TO_REDC_2_THRESHOLD          32
+#define REDC_2_TO_REDC_N_THRESHOLD          52
 
-#define MU_DIV_QR_THRESHOLD               1442
-#define MU_DIVAPPR_Q_THRESHOLD            1528
-#define MUPI_DIV_QR_THRESHOLD               85
+#define MU_DIV_QR_THRESHOLD               1334
+#define MU_DIVAPPR_Q_THRESHOLD            1387
+#define MUPI_DIV_QR_THRESHOLD               69
 #define MU_BDIV_QR_THRESHOLD              1187
-#define MU_BDIV_Q_THRESHOLD               1387
-
-#define MATRIX22_STRASSEN_THRESHOLD         15
-#define HGCD_THRESHOLD                     113
-#define HGCD_APPR_THRESHOLD                 84
-#define HGCD_REDUCE_THRESHOLD             2681
-#define GCD_DC_THRESHOLD                   555
-#define GCDEXT_DC_THRESHOLD                396
+#define MU_BDIV_Q_THRESHOLD               1334
+
+#define POWM_SEC_TABLE  3,22,194,452,1167
+
+#define MATRIX22_STRASSEN_THRESHOLD         14
+#define HGCD_THRESHOLD                     119
+#define HGCD_APPR_THRESHOLD                 51
+#define HGCD_REDUCE_THRESHOLD             2479
+#define GCD_DC_THRESHOLD                   478
+#define GCDEXT_DC_THRESHOLD                368
 #define JACOBI_BASE_METHOD                   4
 
-#define GET_STR_DC_THRESHOLD                12
-#define GET_STR_PRECOMPUTE_THRESHOLD        20
-#define SET_STR_DC_THRESHOLD              1204
-#define SET_STR_PRECOMPUTE_THRESHOLD      2251
+#define GET_STR_DC_THRESHOLD                14
+#define GET_STR_PRECOMPUTE_THRESHOLD        22
+#define SET_STR_DC_THRESHOLD               802
+#define SET_STR_PRECOMPUTE_THRESHOLD      2042
 
-#define FAC_DSC_THRESHOLD                  800
-#define FAC_ODD_THRESHOLD                   28
+#define FAC_DSC_THRESHOLD                  644
+#define FAC_ODD_THRESHOLD                   24
index 72f02e4de09bd786e62792f0b0495fd22cdfde6d..a1cbc31f61bdc04fd688f05365431227cbc8d95f 100644 (file)
@@ -3,19 +3,30 @@ dnl  X86-64 mpn_lshift optimised for Intel Sandy Bridge.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 7e96f49eb6ac6aaa489938010dabcb56474ab804..ac90edb76b0538dc0b1d18d509e84563277e99d9 100644 (file)
@@ -3,19 +3,30 @@ dnl  X86-64 mpn_lshiftc optimised for Intel Sandy Bridge.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index c09480317e58ae60c0d26fec694f2eff583dd993..ded7d899c2350e1c2af1943f53f928f5f5f8bef1 100644 (file)
@@ -1,22 +1,34 @@
 dnl  X86-64 mpn_mul_1 optimised for Intel Sandy Bridge.
 
-dnl  Copyright 2003, 2004, 2005, 2007, 2008, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
-dnl  This file is part of the GNU MP Library.
+dnl  Copyright 2003-2005, 2007, 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -28,7 +40,8 @@ C AMD bobcat
 C Intel P4
 C Intel core2
 C Intel NHM
-C Intel SBR
+C Intel SBR     2.5
+C Intel IBR     2.4
 C Intel atom
 C VIA nano
 
@@ -38,6 +51,8 @@ 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
@@ -46,29 +61,29 @@ define(`v0',      `%rcx')   C r9
 
 define(`n',      `%r11')
 
-dnl Disable until tested ABI_SUPPORT(DOS64)
+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',  ``%r8'')   ') dnl
-IFDOS(`        define(`r8', ``r11'')   ') dnl
+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
 
 ASM_START()
        TEXT
        ALIGN(16)
-
 PROLOGUE(mpn_mul_1)
+
 IFDOS(``push   %rsi            '')
 IFDOS(``push   %rdi            '')
 IFDOS(``mov    %rdx, %rsi      '')
 
        mov     (up), %rax
-IFSTD(`        mov     R32(n_param), R32(%r10) ')
-IFDOS(`        mov     n, %r10                 ')
-IFSTD(`        mov     R32(n_param), R32(n)    ')
+       mov     R32(`n_param'), R32(%r10)
+IFSTD(`        mov     n_param, n              ')
 
        lea     (up,n_param,8), up
        lea     -8(rp,n_param,8), rp
@@ -92,6 +107,8 @@ L(b1):       mov     %rax, %r9
        jnc     L(L1)
        mov     %rax, (rp)
        mov     %rdx, %rax
+IFDOS(``pop    %rdi            '')
+IFDOS(``pop    %rsi            '')
        ret
 
 L(b2): add     $-2, n
diff --git a/mpn/x86_64/coreisbr/mul_2.asm b/mpn/x86_64/coreisbr/mul_2.asm
new file mode 100644 (file)
index 0000000..ffee78a
--- /dev/null
@@ -0,0 +1,163 @@
+dnl  AMD64 mpn_mul_2 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  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        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 VIA nano
+
+C This code is the result of running a code generation and optimisation tool
+C suite written by David Harvey and Torbjorn Granlund.
+
+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')   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(`w0',   `%r8')
+define(`w1',   `%r9')
+define(`w2',   `%r10')
+define(`w3',   `%r11')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_mul_2)
+       FUNC_ENTRY(4)
+       push    %rbx
+       push    %rbp
+
+       mov     (vp), v0
+       mov     8(vp), v1
+
+       mov     (up), %rax
+       lea     (up,n_param,8), up
+       lea     (rp,n_param,8), rp
+
+       test    $1, R8(n_param)
+       jnz     L(b1)
+
+L(b0): mov     $0, R32(n)
+       sub     n_param, n
+       xor     w0, w0
+       mul     v0
+       mov     %rax, w2
+       mov     %rdx, w1
+       mov     (up,n,8), %rax
+       jmp     L(lo0)
+
+L(b1): mov     $1, R32(n)
+       sub     n_param, n
+       xor     w2, w2
+       mul     v0
+       mov     %rax, w0
+       mov     %rdx, w3
+       mov     -8(up,n,8), %rax
+       mul     v1
+       jmp     L(lo1)
+
+       ALIGN(32)
+L(top):        mul     v0
+       add     %rax, w0                C 1
+       mov     %rdx, w3                C 2
+       adc     $0, w3                  C 2
+       mov     -8(up,n,8), %rax
+       mul     v1
+       add     w1, w0                  C 1
+       adc     $0, w3                  C 2
+L(lo1):        add     %rax, w2                C 2
+       mov     w0, -8(rp,n,8)          C 1
+       mov     %rdx, w0                C 3
+       adc     $0, w0                  C 3
+       mov     (up,n,8), %rax
+       mul     v0
+       add     %rax, w2                C 2
+       mov     %rdx, w1                C 3
+       adc     $0, w1                  C 3
+       add     w3, w2                  C 2
+       mov     (up,n,8), %rax
+       adc     $0, w1                  C 1
+L(lo0):        mul     v1
+       mov     w2, (rp,n,8)            C 2
+       add     %rax, w0                C 3
+       mov     %rdx, w2                C 4
+       mov     8(up,n,8), %rax
+       adc     $0, w2                  C 4
+       add     $2, n
+       jnc     L(top)
+
+L(end):        mul     v0
+       add     %rax, w0
+       mov     %rdx, w3
+       adc     $0, w3
+       mov     I(-8(up),-8(up,n,8)), %rax
+       mul     v1
+       add     w1, w0
+       adc     $0, w3
+       add     %rax, w2
+       mov     w0, I(-8(rp),-8(rp,n,8))
+       adc     $0, %rdx
+       add     w3, w2
+       mov     w2, I((rp),(rp,n,8))
+       adc     $0, %rdx
+       mov     %rdx, %rax
+
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
diff --git a/mpn/x86_64/coreisbr/mul_basecase.asm b/mpn/x86_64/coreisbr/mul_basecase.asm
new file mode 100644 (file)
index 0000000..f026136
--- /dev/null
@@ -0,0 +1,407 @@
+dnl  AMD64 mpn_mul_basecase optimised for Intel Sandy bridge and Ivy bridge.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2003-2005, 2007, 2008, 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')
+
+C cycles/limb  mul_1           mul_2           mul_3           addmul_2
+C AMD K8,K9
+C AMD K10
+C AMD bull
+C AMD pile
+C AMD steam
+C AMD bobcat
+C AMD jaguar
+C Intel P4
+C Intel core
+C Intel NHM
+C Intel SBR     2.5             2.5             -               2.95
+C Intel IBR     2.4             2.3             -               2.68
+C Intel HWL     2.35            2.0             -               2.5
+C Intel BWL
+C Intel atom
+C VIA nano
+
+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.
+
+C TODO
+C  * Fix the addmul_2 fluctuation affecting SBR.
+C  * Improve feed-in code, avoiding zeroing of many registers and dummy adds in
+C    the loops at the expense of code size.
+C  * Adjoin a mul_3, avoiding slow mul_1 for odd vn.
+C  * Consider replacing the 2-way mul_2 code with 4-way code, for a very slight
+C    speedup.
+C  * Further 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(`un_param',`%rdx')
+define(`vp',      `%rcx')
+define(`vn',      `%r8')
+
+define(`un',      `%rbx')
+
+define(`w0',   `%r10')
+define(`w1',   `%r11')
+define(`w2',   `%r12')
+define(`w3',   `%r13')
+define(`n',    `%rbp')
+define(`v0',   `%r9')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_mul_basecase)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8d  ')
+       push    %rbx
+       push    %rbp
+       mov     un_param, un            C free up rdx
+       neg     un
+
+       mov     (up), %rax              C shared for mul_1 and mul_2
+       lea     (up,un_param,8), up     C point at operand end
+       lea     (rp,un_param,8), rp     C point at rp[un-1]
+
+       mov     (vp), v0                C shared for mul_1 and mul_2
+       mul     v0                      C shared for mul_1 and mul_2
+
+       test    $1, R8(vn)
+       jz      L(do_mul_2)
+
+L(do_mul_1):
+       test    $1, R8(un)
+       jnz     L(m1x1)
+
+L(m1x0):mov    %rax, w0                C un = 2, 4, 6, 8, ...
+       mov     %rdx, w1
+       mov     8(up,un,8), %rax
+       test    $2, R8(un)
+       jnz     L(m110)
+
+L(m100):lea    2(un), n                C un = 4, 8, 12, ...
+       jmp     L(m1l0)
+
+L(m110):lea    (un), n                 C un = 2, 6, 10, ...
+       jmp     L(m1l2)
+
+L(m1x1):mov    %rax, w1                C un = 1, 3, 5, 7, ...
+       mov     %rdx, w0
+       test    $2, R8(un)
+       jz      L(m111)
+
+L(m101):lea    3(un), n                C un = 1, 5, 9, ...
+       test    n, n
+       js      L(m1l1)
+       mov     %rax, -8(rp)
+       mov     %rdx, (rp)
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+L(m111):lea    1(un), n                C un = 3, 7, 11, ...
+       mov     8(up,un,8), %rax
+       jmp     L(m1l3)
+
+       ALIGN(16)               C FIXME
+L(m1tp):mov    %rdx, w0
+       add     %rax, w1
+L(m1l1):mov    -16(up,n,8), %rax
+       adc     $0, w0
+       mul     v0
+       add     %rax, w0
+       mov     w1, -24(rp,n,8)
+       mov     -8(up,n,8), %rax
+       mov     %rdx, w1
+       adc     $0, w1
+L(m1l0):mul    v0
+       mov     w0, -16(rp,n,8)
+       add     %rax, w1
+       mov     %rdx, w0
+       mov     (up,n,8), %rax
+       adc     $0, w0
+L(m1l3):mul    v0
+       mov     w1, -8(rp,n,8)
+       mov     %rdx, w1
+       add     %rax, w0
+       mov     8(up,n,8), %rax
+       adc     $0, w1
+L(m1l2):mul    v0
+       mov     w0, (rp,n,8)
+       add     $4, n
+       jnc     L(m1tp)
+
+L(m1ed):add    %rax, w1
+       adc     $0, %rdx
+       mov     w1, I(-8(rp),-24(rp,n,8))
+       mov     %rdx, I((rp),-16(rp,n,8))
+
+       dec     R32(vn)
+       jz      L(ret2)
+
+       lea     8(vp), vp
+       lea     8(rp), rp
+       push    %r12
+       push    %r13
+       push    %r14
+       jmp     L(do_addmul)
+
+L(do_mul_2):
+define(`v1',   `%r14')
+       push    %r12
+       push    %r13
+       push    %r14
+
+       mov     8(vp), v1
+
+       test    $1, R8(un)
+       jnz     L(m2b1)
+
+L(m2b0):lea    (un), n
+       xor     w0, w0
+       mov     %rax, w2
+       mov     %rdx, w1
+       jmp     L(m2l0)
+
+L(m2b1):lea    1(un), n
+       xor     w1, w1
+       xor     w2, w2
+       mov     %rax, w0
+       mov     %rdx, w3
+       jmp     L(m2l1)
+
+       ALIGN(32)
+L(m2tp):mul    v0
+       add     %rax, w0
+       mov     %rdx, w3
+       adc     $0, w3
+L(m2l1):mov    -8(up,n,8), %rax
+       mul     v1
+       add     w1, w0
+       adc     $0, w3
+       add     %rax, w2
+       mov     w0, -8(rp,n,8)
+       mov     %rdx, w0
+       adc     $0, w0
+       mov     (up,n,8), %rax
+       mul     v0
+       add     %rax, w2
+       mov     %rdx, w1
+       adc     $0, w1
+       add     w3, w2
+L(m2l0):mov    (up,n,8), %rax
+       adc     $0, w1
+       mul     v1
+       mov     w2, (rp,n,8)
+       add     %rax, w0
+       mov     %rdx, w2
+       mov     8(up,n,8), %rax
+       adc     $0, w2
+       add     $2, n
+       jnc     L(m2tp)
+
+L(m2ed):mul    v0
+       add     %rax, w0
+       mov     %rdx, w3
+       adc     $0, w3
+       mov     I(-8(up),-8(up,n,8)), %rax
+       mul     v1
+       add     w1, w0
+       adc     $0, w3
+       add     %rax, w2
+       mov     w0, I(-8(rp),-8(rp,n,8))
+       adc     $0, %rdx
+       add     w3, w2
+       mov     w2, I((rp),(rp,n,8))
+       adc     $0, %rdx
+       mov     %rdx, I(8(rp),8(rp,n,8))
+
+       add     $-2, R32(vn)
+       jz      L(ret5)
+       lea     16(vp), vp
+       lea     16(rp), rp
+
+
+L(do_addmul):
+       push    %r15
+       push    vn                      C save vn in new stack slot
+define(`vn',   `(%rsp)')
+define(`X0',   `%r14')
+define(`X1',   `%r15')
+define(`v1',   `%r8')
+
+L(outer):
+       mov     (vp), v0
+       mov     8(vp), v1
+       mov     (up,un,8), %rax
+       mul     v0
+       test    $1, R8(un)
+       jnz     L(a1x1)
+
+L(a1x0):mov    (rp,un,8), X0
+       xor     w0, w0
+       mov     %rdx, w1
+       test    $2, R8(un)
+       jnz     L(a110)
+
+L(a100):lea    2(un), n                C un = 4, 8, 12, ...
+       add     %rax, X0
+       adc     $0, w1
+       mov     (up,un,8), %rax
+       mul     v1
+       mov     8(rp,un,8), X1          C FIXME: Use un
+       jmp     L(lo0)
+
+L(a110):lea    (un), n                 C un = 2, 6, 10, ...
+       xor     w3, w3
+       jmp     L(lo2)
+
+L(a1x1):mov    (rp,un,8), X1
+       xor     w2, w2
+       xor     w1, w1
+       test    $2, R8(un)
+       jz      L(a111)
+
+L(a101):lea    3(un), n                C un = 1, 5, 9, ...
+       mov     %rdx, w3
+       add     %rax, X1
+       mov     (up,un,8), %rax
+       mov     8(rp,un,8), X0
+       adc     $0, w3
+       jmp     L(top)
+
+L(a111):lea    1(un), n                C un = 3, 7, 11, ...
+       jmp     L(lo3)
+
+       ALIGN(32)
+L(top):        mul     v1
+       mov     %rdx, w0
+       add     %rax, X0
+       adc     $0, w0
+       add     w1, X1
+       adc     $0, w3
+       add     w2, X0
+       adc     $0, w0
+       mov     -16(up,n,8), %rax
+       mul     v0
+       add     %rax, X0
+       mov     %rdx, w1
+       adc     $0, w1
+       mov     -16(up,n,8), %rax
+       mul     v1
+       mov     X1, -24(rp,n,8)
+       mov     -8(rp,n,8), X1
+       add     w3, X0
+       adc     $0, w1
+L(lo0):        mov     %rdx, w2
+       mov     X0, -16(rp,n,8)
+       add     %rax, X1
+       adc     $0, w2
+       mov     -8(up,n,8), %rax
+       add     w0, X1
+       adc     $0, w2
+       mul     v0
+L(lo3):        add     %rax, X1
+       mov     %rdx, w3
+       adc     $0, w3
+       mov     -8(up,n,8), %rax
+       mul     v1
+       add     w1, X1
+       mov     (rp,n,8), X0
+       adc     $0, w3
+       mov     %rdx, w0
+       add     %rax, X0
+       adc     $0, w0
+       mov     (up,n,8), %rax
+       mul     v0
+       add     w2, X0
+       mov     X1, -8(rp,n,8)
+       mov     %rdx, w1
+       adc     $0, w0
+L(lo2):        add     %rax, X0
+       adc     $0, w1
+       mov     (up,n,8), %rax
+       add     w3, X0
+       adc     $0, w1
+       mul     v1
+       mov     8(rp,n,8), X1
+       add     %rax, X1
+       mov     %rdx, w2
+       adc     $0, w2
+       mov     8(up,n,8), %rax
+       mov     X0, (rp,n,8)
+       mul     v0
+       add     w0, X1
+       mov     %rdx, w3
+       adc     $0, w2
+       add     %rax, X1
+       mov     8(up,n,8), %rax
+       mov     16(rp,n,8), X0          C useless but harmless in final iter
+       adc     $0, w3
+       add     $4, n
+       jnc     L(top)
+
+L(end):        mul     v1
+       add     w1, X1
+       adc     $0, w3
+       add     w2, %rax
+       adc     $0, %rdx
+       mov     X1, I(-8(rp),-24(rp,n,8))
+       add     w3, %rax
+       adc     $0, %rdx
+       mov     %rax, I((rp),-16(rp,n,8))
+       mov     %rdx, I(8(rp),-8(rp,n,8))
+
+       addl    $-2, vn
+       lea     16(vp), vp
+       lea     16(rp), rp
+       jnz     L(outer)
+
+       pop     %rax            C deallocate vn slot
+       pop     %r15
+L(ret5):pop    %r14
+       pop     %r13
+       pop     %r12
+L(ret2):pop    %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
diff --git a/mpn/x86_64/coreisbr/mullo_basecase.asm b/mpn/x86_64/coreisbr/mullo_basecase.asm
new file mode 100644 (file)
index 0000000..a41a8ac
--- /dev/null
@@ -0,0 +1,384 @@
+dnl  AMD64 mpn_mullo_basecase optimised for Intel Sandy bridge and Ivy bridge.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2008, 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')
+
+C cycles/limb  mul_2           addmul_2
+C AMD K8,K9
+C AMD K10
+C AMD bull
+C AMD pile
+C AMD steam
+C AMD bobcat
+C AMD jaguar
+C Intel P4
+C Intel core
+C Intel NHM
+C Intel SBR     2.5             2.95
+C Intel IBR     2.3             2.68
+C Intel HWL     2.0             2.5
+C Intel BWL
+C Intel atom
+C VIA nano
+
+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 Torbjörn Granlund.
+
+C TODO
+C   * Implement proper cor2, replacing current cor0.
+C   * Offset n by 2 in order to avoid the outer loop cmp.  (And sqr_basecase?)
+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')
+define(`n',        `%rcx')
+
+define(`vp',       `%r8')
+define(`X0',       `%r14')
+define(`X1',       `%r15')
+
+define(`w0',       `%r10')
+define(`w1',       `%r11')
+define(`w2',       `%r12')
+define(`w3',       `%r13')
+define(`i',        `%rbp')
+define(`v0',       `%r9')
+define(`v1',       `%rbx')
+
+C rax rbx rcx rdx rdi rsi rbp r8 r9 r10 r11 r12 r13 r14 r15
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_mullo_basecase)
+       FUNC_ENTRY(4)
+
+       mov     (up), %rax
+       mov     vp_param, vp
+
+       cmp     $4, n
+       jb      L(small)
+
+       mov     (vp_param), v0
+       push    %rbx
+       lea     (rp,n,8), rp            C point rp at R[un]
+       push    %rbp
+       lea     (up,n,8), up            C point up right after U's end
+       push    %r12
+       neg     n
+       push    %r13
+       mul     v0
+       mov     8(vp), v1
+
+       test    $1, R8(n)
+       jnz     L(m2b1)
+
+L(m2b0):lea    (n), i
+       xor     w0, w0
+       mov     %rax, w2
+       mov     %rdx, w1
+       jmp     L(m2l0)
+
+L(m2b1):lea    1(n), i
+       xor     w1, w1
+       xor     w2, w2
+       mov     %rax, w0
+       mov     %rdx, w3
+       jmp     L(m2l1)
+
+       ALIGN(32)
+L(m2tp):mul    v0
+       add     %rax, w0
+       mov     %rdx, w3
+       adc     $0, w3
+L(m2l1):mov    -8(up,i,8), %rax
+       mul     v1
+       add     w1, w0
+       adc     $0, w3
+       add     %rax, w2
+       mov     w0, -8(rp,i,8)
+       mov     %rdx, w0
+       adc     $0, w0
+       mov     (up,i,8), %rax
+       mul     v0
+       add     %rax, w2
+       mov     %rdx, w1
+       adc     $0, w1
+       add     w3, w2
+L(m2l0):mov    (up,i,8), %rax
+       adc     $0, w1
+       mul     v1
+       mov     w2, (rp,i,8)
+       add     %rax, w0
+       mov     %rdx, w2                C FIXME: dead in last iteration
+       mov     8(up,i,8), %rax
+       adc     $0, w2                  C FIXME: dead in last iteration
+       add     $2, i
+       jnc     L(m2tp)
+
+L(m2ed):imul   v0, %rax
+       add     w0, %rax
+       add     w1, %rax
+       mov     %rax, I(-8(rp),-8(rp,i,8))
+
+       add     $2, n
+       lea     16(vp), vp
+       lea     -16(up), up
+       cmp     $-2, n
+       jge     L(cor1)
+
+       push    %r14
+       push    %r15
+
+L(outer):
+       mov     (vp), v0
+       mov     8(vp), v1
+       mov     (up,n,8), %rax
+       mul     v0
+       test    $1, R8(n)
+       jnz     L(a1x1)
+
+L(a1x0):mov    (rp,n,8), X1
+       xor     w2, w2
+       xor     w1, w1
+       test    $2, R8(n)
+       jnz     L(a110)
+
+L(a100):lea    1(n), i
+       jmp     L(lo0)
+
+L(a110):lea    3(n), i
+       mov     %rdx, w3
+       add     %rax, X1
+       mov     (up,n,8), %rax
+       mov     8(rp,n,8), X0
+       adc     $0, w3
+       jmp     L(lo2)
+
+L(a1x1):mov    (rp,n,8), X0
+       xor     w0, w0
+       mov     %rdx, w1
+       test    $2, R8(n)
+       jz      L(a111)
+
+L(a101):lea    2(n), i
+       add     %rax, X0
+       adc     $0, w1
+       mov     (up,n,8), %rax
+       mul     v1
+       mov     8(rp,n,8), X1
+       jmp     L(lo1)
+
+L(a111):lea    (n), i
+       xor     w3, w3
+       jmp     L(lo3)
+
+       ALIGN(32)
+L(top):
+L(lo2):        mul     v1
+       mov     %rdx, w0
+       add     %rax, X0
+       adc     $0, w0
+       add     w1, X1
+       adc     $0, w3
+       add     w2, X0
+       adc     $0, w0
+       mov     -16(up,i,8), %rax
+       mul     v0
+       add     %rax, X0
+       mov     %rdx, w1
+       adc     $0, w1
+       mov     -16(up,i,8), %rax
+       mul     v1
+       mov     X1, -24(rp,i,8)
+       mov     -8(rp,i,8), X1
+       add     w3, X0
+       adc     $0, w1
+L(lo1):        mov     %rdx, w2
+       mov     X0, -16(rp,i,8)
+       add     %rax, X1
+       adc     $0, w2
+       mov     -8(up,i,8), %rax
+       add     w0, X1
+       adc     $0, w2
+       mul     v0
+L(lo0):        add     %rax, X1
+       mov     %rdx, w3
+       adc     $0, w3
+       mov     -8(up,i,8), %rax
+       mul     v1
+       add     w1, X1
+       mov     (rp,i,8), X0
+       adc     $0, w3
+       mov     %rdx, w0
+       add     %rax, X0
+       adc     $0, w0
+       mov     (up,i,8), %rax
+       mul     v0
+       add     w2, X0
+       mov     X1, -8(rp,i,8)
+       mov     %rdx, w1
+       adc     $0, w0
+L(lo3):        add     %rax, X0
+       adc     $0, w1
+       mov     (up,i,8), %rax
+       add     w3, X0
+       adc     $0, w1
+       mul     v1
+       mov     8(rp,i,8), X1
+       add     %rax, X1
+       mov     %rdx, w2
+       adc     $0, w2
+       mov     8(up,i,8), %rax
+       mov     X0, (rp,i,8)
+       mul     v0
+       add     w0, X1
+       mov     %rdx, w3
+       adc     $0, w2
+       add     %rax, X1
+       mov     8(up,i,8), %rax
+       mov     16(rp,i,8), X0
+       adc     $0, w3
+       add     $4, i
+       jnc     L(top)
+
+L(end):        imul    v1, %rax
+       add     %rax, X0
+       add     w1, X1
+       adc     $0, w3
+       add     w2, X0
+       mov     I(-8(up),-16(up,i,8)), %rax
+       imul    v0, %rax
+       add     X0, %rax
+       mov     X1, I(-16(rp),-24(rp,i,8))
+       add     w3, %rax
+       mov     %rax, I(-8(rp),-16(rp,i,8))
+
+       add     $2, n
+       lea     16(vp), vp
+       lea     -16(up), up
+       cmp     $-2, n
+       jl      L(outer)
+
+       pop     %r15
+       pop     %r14
+
+       jnz     L(cor0)
+
+L(cor1):mov    (vp), v0
+       mov     8(vp), v1
+       mov     -16(up), %rax
+       mul     v0                      C u0 x v2
+       add     -16(rp), %rax           C FIXME: rp[0] still available in reg?
+       adc     -8(rp), %rdx            C FIXME: rp[1] still available in reg?
+       mov     -8(up), %r10
+       imul    v0, %r10
+       mov     -16(up), %r11
+       imul    v1, %r11
+       mov     %rax, -16(rp)
+       add     %r10, %r11
+       add     %rdx, %r11
+       mov     %r11, -8(rp)
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+L(cor0):mov    (vp), %r11
+       imul    -8(up), %r11
+       add     %rax, %r11
+       mov     %r11, -8(rp)
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+       ALIGN(16)
+L(small):
+       cmp     $2, n
+       jae     L(gt1)
+L(n1): imul    (vp_param), %rax
+       mov     %rax, (rp)
+       FUNC_EXIT()
+       ret
+L(gt1):        ja      L(gt2)
+L(n2): mov     (vp_param), %r9
+       mul     %r9
+       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_param), %r9
+       mul     %r9             C u0 x v0
+       mov     %rax, (rp)
+       mov     %rdx, %r10
+       mov     8(up), %rax
+       mul     %r9             C u1 x v0
+       imul    16(up), %r9     C u2 x v0
+       add     %rax, %r10
+       adc     %rdx, %r9
+       mov     8(vp), %r11
+       mov     (up), %rax
+       mul     %r11            C u0 x v1
+       add     %rax, %r10
+       adc     %rdx, %r9
+       imul    8(up), %r11     C u1 x v1
+       add     %r11, %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
+EPILOGUE()
diff --git a/mpn/x86_64/coreisbr/popcount.asm b/mpn/x86_64/coreisbr/popcount.asm
new file mode 100644 (file)
index 0000000..a5be33e
--- /dev/null
@@ -0,0 +1,118 @@
+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/mpn/x86_64/coreisbr/redc_1.asm b/mpn/x86_64/coreisbr/redc_1.asm
new file mode 100644 (file)
index 0000000..8a5170e
--- /dev/null
@@ -0,0 +1,541 @@
+dnl  X86-64 mpn_redc_1 optimised for Intel Sandy Bridge and Ivy Bridge.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2003-2005, 2007, 2008, 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')
+
+C           cycles/limb
+C AMD K8,K9     ?
+C AMD K10       ?
+C AMD bull      ?
+C AMD pile      ?
+C AMD steam     ?
+C AMD bobcat    ?
+C AMD jaguar    ?
+C Intel P4      ?
+C Intel core    ?
+C Intel NHM     ?
+C Intel SBR     3.24
+C Intel IBR     3.04
+C Intel HWL     ?
+C Intel BWL     ?
+C Intel atom    ?
+C VIA nano      ?
+
+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 Torbjörn Granlund.
+
+C TODO
+C  * Micro-optimise, none performed thus far.
+C  * Consider inlining mpn_add_n.
+C  * Single basecases out before the pushes.
+
+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')   C rcx
+define(`up',          `%rsi')   C rdx
+define(`mp_param',    `%rdx')   C r8
+define(`n',           `%rcx')   C r9
+define(`u0inv',       `%r8')    C stack
+
+define(`i',           `%r14')
+define(`j',           `%r15')
+define(`mp',          `%r12')
+define(`q0',          `%r13')
+
+C rax rbx rcx rdx rdi rsi rbp r8 r9 r10 r11 r12 r13 r14 r15
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+define(`ALIGNx', `ALIGN(16)')
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_redc_1)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8   ')
+       push    %rbx
+       push    %rbp
+       push    %r12
+       push    %r13
+       push    %r14
+       push    %r15
+
+       mov     (up), q0
+       mov     n, j                    C outer loop induction var
+       lea     8(mp_param,n,8), mp
+       lea     8(up,n,8), up
+       neg     n
+       imul    u0inv, q0               C first iteration q0
+
+       test    $1, R8(n)
+       jz      L(bx0)
+
+L(bx1):        test    $2, R8(n)
+       jz      L(b3)
+
+L(b1): cmp     $-1, R32(n)
+       jz      L(n1)
+
+L(otp1):lea    1(n), i
+       mov     -8(mp,n,8), %rax
+       mul     q0
+       mov     -8(up,n,8), %r10
+       mov     %rdx, %r11
+       add     %rax, %r10
+       mov     (mp,n,8), %rax
+       adc     $0, %r11
+       mul     q0
+       mov     %rdx, %r9
+       mov     (up,n,8), %rbx
+       add     %rax, %rbx
+       adc     $0, %r9
+       mov     (mp,i,8), %rax
+       mul     q0
+       mov     (up,i,8), %r10
+       add     %r11, %rbx
+       mov     %rbx, -8(up,i,8)        C next low remainder limb
+       adc     $0, %r9
+       imul    u0inv, %rbx             C next q limb
+       jmp     L(e1)
+
+       ALIGNx
+L(tp1):        mul     q0
+       mov     -16(up,i,8), %r10
+       add     %r11, %rbp
+       mov     %rdx, %r11
+       adc     $0, %r9
+       mov     %rbp, -24(up,i,8)
+       add     %rax, %r10
+       mov     -8(mp,i,8), %rax
+       adc     $0, %r11
+       mul     q0
+       add     %r9, %r10
+       mov     %rdx, %r9
+       mov     -8(up,i,8), %rbp
+       adc     $0, %r11
+       mov     %r10, -16(up,i,8)
+       add     %rax, %rbp
+       adc     $0, %r9
+       mov     (mp,i,8), %rax
+       mul     q0
+       mov     (up,i,8), %r10
+       add     %r11, %rbp
+       mov     %rbp, -8(up,i,8)
+       adc     $0, %r9
+L(e1): mov     %rdx, %r11
+       add     %rax, %r10
+       mov     8(mp,i,8), %rax
+       adc     $0, %r11
+       mul     q0
+       mov     8(up,i,8), %rbp
+       add     %r9, %r10
+       mov     %rdx, %r9
+       mov     %r10, (up,i,8)
+       adc     $0, %r11
+       add     %rax, %rbp
+       adc     $0, %r9
+       mov     16(mp,i,8), %rax
+       add     $4, i
+       jnc     L(tp1)
+
+L(ed1):        mul     q0
+       mov     I(-16(up),-16(up,i,8)), %r10
+       add     %r11, %rbp
+       adc     $0, %r9
+       mov     %rbp, I(-24(up),-24(up,i,8))
+       add     %rax, %r10
+       adc     $0, %rdx
+       add     %r9, %r10
+       adc     $0, %rdx
+       mov     %r10, I(-16(up),-16(up,i,8))
+       mov     %rdx, -8(up,n,8)        C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp1)
+       jmp     L(cj)
+
+L(b3): cmp     $-3, R32(n)
+       jz      L(n3)
+
+L(otp3):lea    3(n), i
+       mov     -8(mp,n,8), %rax
+       mul     q0
+       mov     -8(up,n,8), %r10
+       mov     %rdx, %r11
+       add     %rax, %r10
+       mov     (mp,n,8), %rax
+       adc     $0, %r11
+       mul     q0
+       mov     (up,n,8), %rbx
+       mov     %rdx, %r9
+       add     %rax, %rbx
+       adc     $0, %r9
+       mov     8(mp,n,8), %rax
+       mul     q0
+       mov     8(up,n,8), %r10
+       add     %r11, %rbx
+       mov     %rdx, %r11
+       adc     $0, %r9
+       mov     %rbx, (up,n,8)
+       imul    u0inv, %rbx             C next q limb
+       jmp     L(e3)
+
+       ALIGNx
+L(tp3):        mul     q0
+       mov     -16(up,i,8), %r10
+       add     %r11, %rbp
+       mov     %rdx, %r11
+       adc     $0, %r9
+       mov     %rbp, -24(up,i,8)
+L(e3): add     %rax, %r10
+       mov     -8(mp,i,8), %rax
+       adc     $0, %r11
+       mul     q0
+       add     %r9, %r10
+       mov     %rdx, %r9
+       mov     -8(up,i,8), %rbp
+       adc     $0, %r11
+       mov     %r10, -16(up,i,8)
+       add     %rax, %rbp
+       adc     $0, %r9
+       mov     (mp,i,8), %rax
+       mul     q0
+       mov     (up,i,8), %r10
+       add     %r11, %rbp
+       mov     %rbp, -8(up,i,8)
+       adc     $0, %r9
+       mov     %rdx, %r11
+       add     %rax, %r10
+       mov     8(mp,i,8), %rax
+       adc     $0, %r11
+       mul     q0
+       mov     8(up,i,8), %rbp
+       add     %r9, %r10
+       mov     %rdx, %r9
+       mov     %r10, (up,i,8)
+       adc     $0, %r11
+       add     %rax, %rbp
+       adc     $0, %r9
+       mov     16(mp,i,8), %rax
+       add     $4, i
+       jnc     L(tp3)
+
+L(ed3):        mul     q0
+       mov     I(-16(up),-16(up,i,8)), %r10
+       add     %r11, %rbp
+       adc     $0, %r9
+       mov     %rbp, I(-24(up),-24(up,i,8))
+       add     %rax, %r10
+       adc     $0, %rdx
+       add     %r9, %r10
+       adc     $0, %rdx
+       mov     %r10, I(-16(up),-16(up,i,8))
+       mov     %rdx, -8(up,n,8)        C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp3)
+C      jmp     L(cj)
+
+L(cj):
+IFSTD(`        lea     -8(up,n,8), up          C param 2: up
+       lea     (up,n,8), %rdx          C param 3: up - n
+       neg     R32(n)          ')      C param 4: n
+
+IFDOS(`        lea     -8(up,n,8), %rdx        C param 2: up
+       lea     (%rdx,n,8), %r8         C param 3: up - n
+       neg     R32(n)
+       mov     n, %r9                  C param 4: n
+       mov     rp, %rcx        ')      C param 1: rp
+
+       CALL(   mpn_add_n)
+
+L(ret):        pop     %r15
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+L(bx0):        test    $2, R8(n)
+       jnz     L(b2)
+
+L(b0):
+L(otp0):lea    (n), i
+       mov     -8(mp,n,8), %rax
+       mul     q0
+       mov     %rdx, %r9
+       mov     -8(up,n,8), %rbp
+       add     %rax, %rbp
+       adc     $0, %r9
+       mov     (mp,n,8), %rax
+       mul     q0
+       mov     (up,n,8), %rbx
+       mov     %rdx, %r11
+       add     %rax, %rbx
+       mov     8(mp,n,8), %rax
+       adc     $0, %r11
+       mul     q0
+       mov     8(up,n,8), %rbp
+       add     %r9, %rbx
+       mov     %rdx, %r9
+       mov     %rbx, (up,n,8)
+       adc     $0, %r11
+       imul    u0inv, %rbx             C next q limb
+       jmp     L(e0)
+
+       ALIGNx
+L(tp0):        mul     q0
+       mov     -16(up,i,8), %r10
+       add     %r11, %rbp
+       mov     %rdx, %r11
+       adc     $0, %r9
+       mov     %rbp, -24(up,i,8)
+       add     %rax, %r10
+       mov     -8(mp,i,8), %rax
+       adc     $0, %r11
+       mul     q0
+       add     %r9, %r10
+       mov     %rdx, %r9
+       mov     -8(up,i,8), %rbp
+       adc     $0, %r11
+       mov     %r10, -16(up,i,8)
+       add     %rax, %rbp
+       adc     $0, %r9
+       mov     (mp,i,8), %rax
+       mul     q0
+       mov     (up,i,8), %r10
+       add     %r11, %rbp
+       mov     %rbp, -8(up,i,8)
+       adc     $0, %r9
+       mov     %rdx, %r11
+       add     %rax, %r10
+       mov     8(mp,i,8), %rax
+       adc     $0, %r11
+       mul     q0
+       mov     8(up,i,8), %rbp
+       add     %r9, %r10
+       mov     %rdx, %r9
+       mov     %r10, (up,i,8)
+       adc     $0, %r11
+L(e0): add     %rax, %rbp
+       adc     $0, %r9
+       mov     16(mp,i,8), %rax
+       add     $4, i
+       jnc     L(tp0)
+
+L(ed0):        mul     q0
+       mov     I(-16(up),-16(up,i,8)), %r10
+       add     %r11, %rbp
+       adc     $0, %r9
+       mov     %rbp, I(-24(up),-24(up,i,8))
+       add     %rax, %r10
+       adc     $0, %rdx
+       add     %r9, %r10
+       adc     $0, %rdx
+       mov     %r10, I(-16(up),-16(up,i,8))
+       mov     %rdx, -8(up,n,8)        C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp0)
+       jmp     L(cj)
+
+L(b2): cmp     $-2, R32(n)
+       jz      L(n2)
+
+L(otp2):lea    2(n), i
+       mov     -8(mp,n,8), %rax
+       mul     q0
+       mov     -8(up,n,8), %rbp
+       mov     %rdx, %r9
+       add     %rax, %rbp
+       adc     $0, %r9
+       mov     (mp,n,8), %rax
+       mul     q0
+       mov     (up,n,8), %rbx
+       mov     %rdx, %r11
+       add     %rax, %rbx
+       mov     8(mp,n,8), %rax
+       adc     $0, %r11
+       mul     q0
+       add     %r9, %rbx
+       mov     %rdx, %r9
+       mov     8(up,n,8), %rbp
+       adc     $0, %r11
+       mov     %rbx, (up,n,8)
+       imul    u0inv, %rbx             C next q limb
+       jmp     L(e2)
+
+       ALIGNx
+L(tp2):        mul     q0
+       mov     -16(up,i,8), %r10
+       add     %r11, %rbp
+       mov     %rdx, %r11
+       adc     $0, %r9
+       mov     %rbp, -24(up,i,8)
+       add     %rax, %r10
+       mov     -8(mp,i,8), %rax
+       adc     $0, %r11
+       mul     q0
+       add     %r9, %r10
+       mov     %rdx, %r9
+       mov     -8(up,i,8), %rbp
+       adc     $0, %r11
+       mov     %r10, -16(up,i,8)
+L(e2): add     %rax, %rbp
+       adc     $0, %r9
+       mov     (mp,i,8), %rax
+       mul     q0
+       mov     (up,i,8), %r10
+       add     %r11, %rbp
+       mov     %rbp, -8(up,i,8)
+       adc     $0, %r9
+       mov     %rdx, %r11
+       add     %rax, %r10
+       mov     8(mp,i,8), %rax
+       adc     $0, %r11
+       mul     q0
+       mov     8(up,i,8), %rbp
+       add     %r9, %r10
+       mov     %rdx, %r9
+       mov     %r10, (up,i,8)
+       adc     $0, %r11
+       add     %rax, %rbp
+       adc     $0, %r9
+       mov     16(mp,i,8), %rax
+       add     $4, i
+       jnc     L(tp2)
+
+L(ed2):        mul     q0
+       mov     I(-16(up),-16(up,i,8)), %r10
+       add     %r11, %rbp
+       adc     $0, %r9
+       mov     %rbp, I(-24(up),-24(up,i,8))
+       add     %rax, %r10
+       adc     $0, %rdx
+       add     %r9, %r10
+       adc     $0, %rdx
+       mov     %r10, I(-16(up),-16(up,i,8))
+       mov     %rdx, -8(up,n,8)        C up[0]
+       mov     %rbx, q0                C previously computed q limb -> q0
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(otp2)
+       jmp     L(cj)
+
+L(n1): mov     (mp_param), %rax
+       mul     q0
+       add     -16(up), %rax
+       adc     -8(up), %rdx
+       mov     %rdx, (rp)
+       mov     $0, R32(%rax)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+
+L(n2): mov     (mp_param), %rax
+       mov     -24(up), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     %rdx, %r9
+       adc     $0, %r9
+       mov     -16(mp), %rax
+       mov     -16(up), %r10
+       mul     q0
+       add     %rax, %r10
+       mov     %rdx, %r11
+       adc     $0, %r11
+       add     %r9, %r10
+       adc     $0, %r11
+       mov     %r10, q0
+       imul    u0inv, q0               C next q0
+       mov     -24(mp), %rax
+       mul     q0
+       add     %rax, %r10
+       mov     %rdx, %r9
+       adc     $0, %r9
+       mov     -16(mp), %rax
+       mov     -8(up), %r14
+       mul     q0
+       add     %rax, %r14
+       adc     $0, %rdx
+       add     %r9, %r14
+       adc     $0, %rdx
+       xor     R32(%rax), R32(%rax)
+       add     %r11, %r14
+       adc     (up), %rdx
+       mov     %r14, (rp)
+       mov     %rdx, 8(rp)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+
+       ALIGNx
+L(n3): mov     -32(mp), %rax
+       mov     -32(up), %r10
+       mul     q0
+       add     %rax, %r10
+       mov     -24(mp), %rax
+       mov     %rdx, %r11
+       adc     $0, %r11
+       mov     -24(up), %rbp
+       mul     q0
+       add     %rax, %rbp
+       mov     %rdx, %r9
+       adc     $0, %r9
+       mov     -16(mp), %rax
+       add     %r11, %rbp
+       mov     -16(up), %r10
+       adc     $0, %r9
+       mul     q0
+       mov     %rbp, q0
+       imul    u0inv, q0               C next q0
+       add     %rax, %r10
+       mov     %rdx, %r11
+       adc     $0, %r11
+       mov     %rbp, -24(up)
+       add     %r9, %r10
+       adc     $0, %r11
+       mov     %r10, -16(up)
+       mov     %r11, -32(up)           C up[0]
+       lea     8(up), up               C up++
+       dec     j
+       jnz     L(n3)
+       jmp     L(cj)
+EPILOGUE()
+ASM_END()
index daad0ccca641d2aff5ec55803ec659b3ed0a736b..fd2eaea7bb96a809e103f864bfc4b2142ab6e3b8 100644 (file)
@@ -1,22 +1,32 @@
 dnl  X86-64 mpn_rsh1add_n, mpn_rsh1sub_n optimised for Intel Sandy Bridge.
 
-dnl  Copyright 2003, 2005, 2009, 2010, 2011, 2012 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 2003, 2005, 2009-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 5d16361c0c8c0affcd32953b95808340e05bdfc3..4c1c0d4cde0869fb6efcc4a2708abd410eceaef5 100644 (file)
@@ -3,19 +3,30 @@ dnl  X86-64 mpn_rshift optimised for Intel Sandy Bridge.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/coreisbr/sec_tabselect.asm b/mpn/x86_64/coreisbr/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..e436034
--- /dev/null
@@ -0,0 +1,37 @@
+dnl  X86-64 mpn_sec_tabselect.
+
+dnl  Copyright 2012, 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')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_sec_tabselect)
+include_mpn(`x86_64/fastsse/sec_tabselect.asm')
diff --git a/mpn/x86_64/coreisbr/sqr_basecase.asm b/mpn/x86_64/coreisbr/sqr_basecase.asm
new file mode 100644 (file)
index 0000000..46a3612
--- /dev/null
@@ -0,0 +1,484 @@
+dnl  AMD64 mpn_sqr_basecase optimised for Intel Sandy bridge and Ivy bridge.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2008, 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')
+
+C cycles/limb  mul_2           addmul_2        sqr_diag_addlsh1
+C AMD K8,K9     ?               ?                       ?
+C AMD K10       ?               ?                       ?
+C AMD bull      ?               ?                       ?
+C AMD pile      ?               ?                       ?
+C AMD steam     ?               ?                       ?
+C AMD bobcat    ?               ?                       ?
+C AMD jaguar    ?               ?                       ?
+C Intel P4      ?               ?                       ?
+C Intel core    ?               ?                       ?
+C Intel NHM     ?               ?                       ?
+C Intel SBR     2.57            2.93                    3.0
+C Intel IBR     2.35            2.66                    3.0
+C Intel HWL     2.02            2.5                     2.5
+C Intel BWL     ?               ?                       ?
+C Intel atom    ?               ?                       ?
+C VIA nano      ?               ?                       ?
+
+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 Torbjörn Granlund, except
+C that the sqr_diag_addlsh1 loop was manually written.
+
+C TODO
+C  * Replace current unoptimised sqr_diag_addlsh1 loop, 2.5 c/l should be easy.
+C  * Streamline pointer updates.
+C  * Perhaps suppress a few more xor insns in feed-in code.
+C  * Make sure we write no dead registers in feed-in code.
+C  * We might use 32-bit size ops, since n >= 2^32 is non-terminating.  Watch
+C    out for negative sizes being zero-extended, though.
+C  * The straight-line code for n <= 3 comes from the K8 code, and might be
+C    quite sub-optimal here.  Write specific code, and add code for n = 4.
+C  * The mul_2 loop has a 10 insn common sequence in the loop start and the
+C    wind-down code.  Try re-rolling it.
+C  * This file has been the subject to just basic micro-optimisation.
+
+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(`un_param',`%rdx')
+
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_sqr_basecase)
+       FUNC_ENTRY(3)
+
+       cmp     $2, un_param
+       jae     L(gt1)
+
+       mov     (up), %rax
+       mul     %rax
+       mov     %rax, (rp)
+       mov     %rdx, 8(rp)
+       FUNC_EXIT()
+       ret
+
+L(gt1):        jne     L(gt2)
+
+       mov     (up), %rax
+       mov     %rax, %r8
+       mul     %rax
+       mov     8(up), %r11
+       mov     %rax, (rp)
+       mov     %r11, %rax
+       mov     %rdx, %r9
+       mul     %rax
+       mov     %rax, %r10
+       mov     %r11, %rax
+       mov     %rdx, %r11
+       mul     %r8
+       xor     %r8, %r8
+       add     %rax, %r9
+       adc     %rdx, %r10
+       adc     %r8, %r11
+       add     %rax, %r9
+       mov     %r9, 8(rp)
+       adc     %rdx, %r10
+       mov     %r10, 16(rp)
+       adc     %r8, %r11
+       mov     %r11, 24(rp)
+       FUNC_EXIT()
+       ret
+
+L(gt2):        cmp     $4, un_param
+       jae     L(gt3)
+define(`v0', `%r8')
+define(`v1', `%r9')
+define(`w0', `%r10')
+define(`w2', `%r11')
+
+       mov     (up), %rax
+       mov     %rax, %r10
+       mul     %rax
+       mov     8(up), %r11
+       mov     %rax, (rp)
+       mov     %r11, %rax
+       mov     %rdx, 8(rp)
+       mul     %rax
+       mov     16(up), %rcx
+       mov     %rax, 16(rp)
+       mov     %rcx, %rax
+       mov     %rdx, 24(rp)
+       mul     %rax
+       mov     %rax, 32(rp)
+       mov     %rdx, 40(rp)
+
+       mov     %r11, %rax
+       mul     %r10
+       mov     %rax, %r8
+       mov     %rcx, %rax
+       mov     %rdx, %r9
+       mul     %r10
+       xor     %r10, %r10
+       add     %rax, %r9
+       mov     %r11, %rax
+       mov     %r10, %r11
+       adc     %rdx, %r10
+
+       mul     %rcx
+       add     %rax, %r10
+       adc     %r11, %rdx
+       add     %r8, %r8
+       adc     %r9, %r9
+       adc     %r10, %r10
+       adc     %rdx, %rdx
+       adc     %r11, %r11
+       add     %r8, 8(rp)
+       adc     %r9, 16(rp)
+       adc     %r10, 24(rp)
+       adc     %rdx, 32(rp)
+       adc     %r11, 40(rp)
+       FUNC_EXIT()
+       ret
+
+L(gt3):
+
+define(`v0', `%r8')
+define(`v1', `%r9')
+define(`w0', `%r10')
+define(`w1', `%r11')
+define(`w2', `%rbx')
+define(`w3', `%rbp')
+define(`un', `%r12')
+define(`n',  `%rcx')
+
+define(`X0', `%r13')
+define(`X1', `%r14')
+
+L(do_mul_2):
+       mov     (up), v0
+       push    %rbx
+       lea     (rp,un_param,8), rp     C point rp at R[un]
+       mov     8(up), %rax
+       push    %rbp
+       lea     (up,un_param,8), up     C point up right after U's end
+       mov     %rax, v1
+       push    %r12
+       mov     $1, R32(un)             C free up rdx
+       push    %r13
+       sub     un_param, un
+       push    %r14
+       push    un
+       mul     v0
+       mov     %rax, (rp,un,8)
+       mov     8(up,un,8), %rax
+       test    $1, R8(un)
+       jnz     L(m2b1)
+
+L(m2b0):lea    2(un), n
+       xor     R32(w1), R32(w1)        C FIXME
+       xor     R32(w2), R32(w2)        C FIXME
+       mov     %rdx, w0
+       jmp     L(m2l0)
+
+L(m2b1):lea    1(un), n
+       xor     R32(w3), R32(w3)        C FIXME
+       xor     R32(w0), R32(w0)        C FIXME
+       mov     %rdx, w2
+       jmp     L(m2l1)
+
+       ALIGN(32)
+L(m2tp):
+L(m2l0):mul    v0
+       add     %rax, w0
+       mov     %rdx, w3
+       adc     $0, w3
+       mov     -8(up,n,8), %rax
+       mul     v1
+       add     w1, w0
+       adc     $0, w3
+       add     %rax, w2
+       mov     w0, -8(rp,n,8)
+       mov     %rdx, w0
+       adc     $0, w0
+       mov     (up,n,8), %rax
+L(m2l1):mul    v0
+       add     %rax, w2
+       mov     %rdx, w1
+       adc     $0, w1
+       add     w3, w2
+       mov     (up,n,8), %rax
+       adc     $0, w1
+       mul     v1
+       mov     w2, (rp,n,8)
+       add     %rax, w0
+       mov     %rdx, w2
+       mov     8(up,n,8), %rax
+       adc     $0, w2
+       add     $2, n
+       jnc     L(m2tp)
+
+L(m2ed):mul    v0
+       add     %rax, w0
+       mov     %rdx, w3
+       adc     $0, w3
+       mov     I(-8(up),-8(up,n,8)), %rax
+       mul     v1
+       add     w1, w0
+       adc     $0, w3
+       add     %rax, w2
+       mov     w0, I(-8(rp),-8(rp,n,8))
+       adc     $0, %rdx
+       add     w3, w2
+       mov     w2, I((rp),(rp,n,8))
+       adc     $0, %rdx
+       mov     %rdx, I(8(rp),8(rp,n,8))
+
+       add     $2, un                  C decrease |un|
+
+L(do_addmul_2):
+L(outer):
+       lea     16(rp), rp
+       cmp     $-2, R32(un)            C jump if un C {-1,0}  FIXME jump if un C {-2,1}
+       jge     L(corner)               C FIXME: move to before the lea above
+
+       mov     -8(up,un,8), v0
+       mov     (up,un,8), %rax
+       mov     %rax, v1
+       mul     v0
+       test    $1, R8(un)
+       jnz     L(a1x1)
+
+L(a1x0):mov    (rp,un,8), X0
+       xor     w0, w0
+       mov     8(rp,un,8), X1
+       add     %rax, X0
+       mov     %rdx, w1
+       adc     $0, w1
+       xor     w2, w2
+       mov     X0, (rp,un,8)
+       mov     8(up,un,8), %rax
+       test    $2, R8(un)
+       jnz     L(a110)
+
+L(a100):lea    2(un), n                C un = 4, 8, 12, ...
+       jmp     L(lo0)
+
+L(a110):lea    (un), n                 C un = 2, 6, 10, ...
+       jmp     L(lo2)
+
+L(a1x1):mov    (rp,un,8), X1
+       xor     w2, w2
+       mov     8(rp,un,8), X0
+       add     %rax, X1
+       mov     %rdx, w3
+       adc     $0, w3
+       xor     w0, w0
+       mov     8(up,un,8), %rax
+       test    $2, R8(un)
+       jz      L(a111)
+
+L(a101):lea    3(un), n                C un = 1, 5, 9, ...
+       jmp     L(lo1)
+
+L(a111):lea    1(un), n                C un = 3, 7, 11, ...
+       jmp     L(lo3)
+
+       ALIGN(32)
+L(top):        mul     v1
+       mov     %rdx, w0
+       add     %rax, X0
+       adc     $0, w0
+       add     w1, X1
+       adc     $0, w3
+       add     w2, X0
+       adc     $0, w0
+       mov     -16(up,n,8), %rax
+L(lo1):        mul     v0
+       add     %rax, X0
+       mov     %rdx, w1
+       adc     $0, w1
+       mov     -16(up,n,8), %rax
+       mul     v1
+       mov     X1, -24(rp,n,8)
+       mov     -8(rp,n,8), X1
+       add     w3, X0
+       adc     $0, w1
+       mov     %rdx, w2
+       mov     X0, -16(rp,n,8)
+       add     %rax, X1
+       adc     $0, w2
+       mov     -8(up,n,8), %rax
+       add     w0, X1
+       adc     $0, w2
+L(lo0):        mul     v0
+       add     %rax, X1
+       mov     %rdx, w3
+       adc     $0, w3
+       mov     -8(up,n,8), %rax
+       mul     v1
+       add     w1, X1
+       mov     (rp,n,8), X0
+       adc     $0, w3
+       mov     %rdx, w0
+       add     %rax, X0
+       adc     $0, w0
+       mov     (up,n,8), %rax
+L(lo3):        mul     v0
+       add     w2, X0
+       mov     X1, -8(rp,n,8)
+       mov     %rdx, w1
+       adc     $0, w0
+       add     %rax, X0
+       adc     $0, w1
+       mov     (up,n,8), %rax
+       add     w3, X0
+       adc     $0, w1
+       mul     v1
+       mov     8(rp,n,8), X1
+       add     %rax, X1
+       mov     %rdx, w2
+       adc     $0, w2
+       mov     8(up,n,8), %rax
+       mov     X0, (rp,n,8)
+L(lo2):        mul     v0
+       add     w0, X1
+       mov     %rdx, w3
+       adc     $0, w2
+       add     %rax, X1
+       mov     8(up,n,8), %rax
+       mov     16(rp,n,8), X0
+       adc     $0, w3
+       add     $4, n
+       jnc     L(top)
+
+L(end):        mul     v1
+       add     w1, X1
+       adc     $0, w3
+       add     w2, %rax
+       adc     $0, %rdx
+       mov     X1, I(-8(rp),-24(rp,n,8))
+       add     w3, %rax
+       adc     $0, %rdx
+       mov     %rax, I((rp),-16(rp,n,8))
+       mov     %rdx, I(8(rp),-8(rp,n,8))
+
+       add     $2, un                  C decrease |un|
+       jmp     L(outer)                C loop until a small corner remains
+
+L(corner):
+       pop     n
+       jg      L(small_corner)
+
+       lea     8(rp), rp
+       mov     -24(up), v0
+       mov     -16(up), %rax
+       mov     %rax, v1
+       mul     v0
+       mov     -24(rp), X0
+       mov     -16(rp), X1
+       add     %rax, X0
+       mov     %rdx, w1
+       adc     $0, w1
+       xor     w2, w2
+       mov     X0, -24(rp)
+       mov     -8(up), %rax
+       mul     v0
+       add     $0, X1
+       mov     %rdx, w3
+       adc     $0, w2
+       add     %rax, X1
+       mov     -8(up), %rax
+       adc     $0, w3
+       mul     v1
+       add     w1, X1
+       adc     $0, w3
+       add     w2, %rax
+       adc     $0, %rdx
+       mov     X1, -16(rp)
+       jmp     L(com)
+
+L(small_corner):
+       mov     -8(rp), w3
+       mov     -16(up), v0
+       mov     -8(up), %rax
+       mul     v0
+L(com):        add     w3, %rax
+       adc     $0, %rdx
+       mov     %rax, -8(rp)
+       mov     %rdx, (rp)
+
+L(sqr_diag_addlsh1):
+       mov     -8(up,n,8), %rax
+       shl     n
+       mul     %rax
+       mov     %rax, (rp,n,8)
+
+       xor     R32(%rbx), R32(%rbx)
+       mov     8(rp,n,8), %r8
+       mov     16(rp,n,8), %r9
+       jmp     L(dm)
+
+       ALIGN(32)
+L(dtop):add    %r8, %r10
+       adc     %r9, %rax
+       mov     8(rp,n,8), %r8
+       mov     16(rp,n,8), %r9
+       mov     %r10, -8(rp,n,8)
+       mov     %rax, (rp,n,8)
+L(dm): adc     %r8, %r8
+       adc     %r9, %r9
+       mov     (up,n,4), %rax
+       lea     (%rdx,%rbx), %r10
+       setc    R8(%rbx)
+       mul     %rax
+       add     $2, n
+       js      L(dtop)
+
+L(dend):add    %r8, %r10
+       adc     %r9, %rax
+       mov     %r10, I(-8(rp),-8(rp,n,8))
+       mov     %rax, I((rp),(rp,n,8))
+       adc     %rbx, %rdx
+       mov     %rdx, I(8(rp),8(rp,n,8))
+
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
index 0530650cfa996967e5a32f4100049ff1c56f9954..6f8ec7893d9694b7a78764d2f8fd309b3fadbce4 100644 (file)
@@ -2,19 +2,30 @@ divert(-1)
 dnl  Copyright 2008, 2011, 2012 Free Software Foundation, Inc.
 dnl
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 define(`DARWIN')
 
diff --git a/mpn/x86_64/div_qr_1n_pi1.asm b/mpn/x86_64/div_qr_1n_pi1.asm
new file mode 100644 (file)
index 0000000..cb072e9
--- /dev/null
@@ -0,0 +1,247 @@
+dnl  x86-64 mpn_div_qr_1n_pi1
+dnl  -- Divide an mpn number by a normalized single-limb number,
+dnl     using a single-limb inverse.
+
+dnl  Contributed to the GNU project by Niels Möller
+
+dnl  Copyright 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              c/l
+C AMD K8,K9    13
+C AMD K10      13
+C AMD bull     16.5
+C AMD pile     15
+C AMD steam     ?
+C AMD bobcat   16
+C AMD jaguar    ?
+C Intel P4     47      poor
+C Intel core   19.25
+C Intel NHM    18
+C Intel SBR    15      poor
+C Intel IBR    13
+C Intel HWL    11.7
+C Intel BWL     ?
+C Intel atom   52      very poor
+C VIA nano     19
+
+
+C INPUT Parameters
+define(`QP', `%rdi')
+define(`UP', `%rsi')
+define(`UN_INPUT', `%rdx')
+define(`U1', `%rcx')   C Also in %rax
+define(`D', `%r8')
+define(`DINV', `%r9')
+
+C Invariants
+define(`B2', `%rbp')
+define(`B2md', `%rbx')
+
+C Variables
+define(`UN', `%r8')    C Overlaps D input
+define(`T', `%r10')
+define(`U0', `%r11')
+define(`U2', `%r12')
+define(`Q0', `%r13')
+define(`Q1', `%r14')
+define(`Q2', `%r15')
+
+ABI_SUPPORT(STD64)
+
+       ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_div_qr_1n_pi1)
+       FUNC_ENTRY(6)
+IFDOS(`        mov     56(%rsp), %r8   ')
+IFDOS(`        mov     64(%rsp), %r9   ')
+       dec     UN_INPUT
+       jnz     L(first)
+
+       C Just a single 2/1 division.
+       C T, U0 are allocated in scratch registers
+       lea     1(U1), T
+       mov     U1, %rax
+       mul     DINV
+       mov     (UP), U0
+       add     U0, %rax
+       adc     T, %rdx
+       mov     %rdx, T
+       imul    D, %rdx
+       sub     %rdx, U0
+       cmp     U0, %rax
+       lea     (U0, D), %rax
+       cmovnc  U0, %rax
+       sbb     $0, T
+       cmp     D, %rax
+       jc      L(single_div_done)
+       sub     D, %rax
+       add     $1, T
+L(single_div_done):
+       mov     T, (QP)
+       FUNC_EXIT
+       ret
+L(first):
+       C FIXME: Could delay some of these until we enter the loop.
+       push    %r15
+       push    %r14
+       push    %r13
+       push    %r12
+       push    %rbx
+       push    %rbp
+
+       mov     D, B2
+       imul    DINV, B2
+       neg     B2
+       mov     B2, B2md
+       sub     D, B2md
+
+       C D not needed until final reduction
+       push    D
+       mov     UN_INPUT, UN    C Clobbers D
+
+       mov     DINV, %rax
+       mul     U1
+       mov     %rax, Q0
+       add     U1, %rdx
+       mov     %rdx, T
+
+       mov     B2, %rax
+       mul     U1
+       mov     -8(UP, UN, 8), U0
+       mov     (UP, UN, 8), U1
+       mov     T, (QP, UN, 8)
+       add     %rax, U0
+       adc     %rdx, U1
+       sbb     U2, U2
+       dec     UN
+       mov     U1, %rax
+       jz      L(final)
+
+       ALIGN(16)
+
+       C Loop is 28 instructions, 30 decoder slots, should run in 10 cycles.
+       C At entry, %rax holds an extra copy of U1
+L(loop):
+       C {Q2, Q1, Q0} <-- DINV * U1 + B (Q0 + U2 DINV) + B^2 U2
+       C Remains to add in B (U1 + c)
+       mov     DINV, Q1
+       mov     U2, Q2
+       and     U2, Q1
+       neg     Q2
+       mul     DINV
+       add     %rdx, Q1
+       adc     $0, Q2
+       add     Q0, Q1
+       mov     %rax, Q0
+       mov     B2, %rax
+       lea     (B2md, U0), T
+       adc     $0, Q2
+
+       C {U2, U1, U0} <-- (U0 + U2 B2 -c U) B + U1 B2 + u
+       mul     U1
+       and     B2, U2
+       add     U2, U0
+       cmovnc  U0, T
+
+       C {QP+UN, ...} <-- {QP+UN, ...} + {Q2, Q1} + U1 + c
+       adc     U1, Q1
+       mov     -8(UP, UN, 8), U0
+       adc     Q2, 8(QP, UN, 8)
+       jc      L(q_incr)
+L(q_incr_done):
+       add     %rax, U0
+       mov     T, %rax
+       adc     %rdx, %rax
+       mov     Q1, (QP, UN, 8)
+       sbb     U2, U2
+       dec     UN
+       mov     %rax, U1
+       jnz     L(loop)
+
+L(final):
+       pop     D
+
+       mov     U2, Q1
+       and     D, U2
+       sub     U2, %rax
+       neg     Q1
+
+       mov     %rax, U1
+       sub     D, %rax
+       cmovc   U1, %rax
+       sbb     $-1, Q1
+
+       lea     1(%rax), T
+       mul     DINV
+       add     U0, %rax
+       adc     T, %rdx
+       mov     %rdx, T
+       imul    D, %rdx
+       sub     %rdx, U0
+       cmp     U0, %rax
+       lea     (U0, D), %rax
+       cmovnc  U0, %rax
+       sbb     $0, T
+       cmp     D, %rax
+       jc      L(div_done)
+       sub     D, %rax
+       add     $1, T
+L(div_done):
+       add     T, Q0
+       mov     Q0, (QP)
+       adc     Q1, 8(QP)
+       jnc     L(done)
+L(final_q_incr):
+       addq    $1, 16(QP)
+       lea     8(QP), QP
+       jc      L(final_q_incr)
+
+L(done):
+       pop     %rbp
+       pop     %rbx
+       pop     %r12
+       pop     %r13
+       pop     %r14
+       pop     %r15
+       FUNC_EXIT
+       ret
+
+L(q_incr):
+       C U1 is not live, so use it for indexing
+       lea     16(QP, UN, 8), U1
+L(q_incr_loop):
+       addq    $1, (U1)
+       jnc     L(q_incr_done)
+       lea     8(U1), U1
+       jmp     L(q_incr_loop)
+EPILOGUE()
index aef6938a3c418fbbc9cb2877161a1427c23f6e3c..5e59a0ac5d6482e5ab00303b579c55aa388267a0 100644 (file)
@@ -2,22 +2,33 @@ dnl  x86-64 mpn_div_qr_2n_pi1
 dnl  -- Divide an mpn number by a normalized 2-limb number,
 dnl     using a single-limb inverse.
 
-dnl  Copyright 2007, 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2007, 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index bdb64c148a77afb70b7a90f3e07ede05e365f73e..85af96fbf6f48c02a1ea287e73e8ca04dad741e7 100644 (file)
@@ -5,19 +5,30 @@ dnl     using a single-limb inverse and shifting the dividend on the fly.
 dnl  Copyright 2007, 2008, 2010, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 45cf63b81f13ba3723f401ec1e71748dc76f4416..988bdab632d1f848626f6ece3b96c176e1d256b3 100644 (file)
@@ -1,22 +1,32 @@
 dnl  AMD64 mpn_divexact_1 -- mpn by limb exact division.
 
-dnl  Copyright 2001, 2002, 2004, 2005, 2006, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2001, 2002, 2004-2006, 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 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  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
+dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 64602d165921fbb7b1397a01ffb6f3c7a1000848..91928d9aa30f1d1b0f5f70ed9f9c6a6f5d78beaf 100644 (file)
@@ -1,22 +1,32 @@
 dnl  x86-64 mpn_divrem_1 -- mpn by limb division.
 
-dnl  Copyright 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2004, 2005, 2007-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -141,8 +151,7 @@ IFSTD(`     pop     %rdi            ')
        jmp     L(nent)
 
        ALIGN(16)
-L(ntop):                               C           K8-K10  P6-CNR P6-NHM  P4
-       mov     (up,un,8), %r10         C
+L(ntop):mov    (up,un,8), %r10         C           K8-K10  P6-CNR P6-NHM  P4
        mul     dinv                    C             0,13   0,20   0,18   0,45
        add     %r10, %rax              C             4      8      3     12
        adc     %rbp, %rdx              C             5      9     10     13
index 15914804f47caca9b62b3b0fd275757239a38cfe..66c2da1a0544fe53b9aaccb1d675ad3da8f8111f 100644 (file)
@@ -3,29 +3,48 @@ dnl  x86-64 mpn_divrem_2 -- Divide an mpn number by a normalized 2-limb number.
 dnl  Copyright 2007, 2008, 2010 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
 
-C              c/l
+C           cycles/limb        best
 C AMD K8,K9    18
 C AMD K10      18
+C AMD bull
+C AMD pile
+C AMD bobcat
+C AMD jaguar
 C Intel P4     68
-C Intel core2  34
-C Intel corei  30.5
+C Intel core   34
+C Intel NHM    30.25
+C Intel SBR    21.3
+C Intel IBR    21.4
+C Intel HWL    20.6
+C Intel BWL
 C Intel atom   73
 C VIA nano     33
 
index 6263f85f857b54485559b3c6fcd01315520479d8..9414623b56c1fb51ee222f85ac6c911ccdde4301 100644 (file)
@@ -1,20 +1,31 @@
 divert(-1)
-dnl  Copyright 2011, 2012 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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  The GNU MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+dnl  or both in parallel, as here.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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/.
 
 define(`HOST_DOS64')
 
@@ -30,6 +41,13 @@ define(`LEA',`
 ')
 
 
+dnl  Usage: CALL(funcname)
+dnl
+dnl  Simply override the definition in x86_64-defs.m4.
+
+define(`CALL',`call    GSYM_PREFIX`'$1')
+
+
 dnl  Usage: JUMPTABSECT
 
 define(`JUMPTABSECT', `RODATA')
diff --git a/mpn/x86_64/fastavx/copyd.asm b/mpn/x86_64/fastavx/copyd.asm
new file mode 100644 (file)
index 0000000..41c55de
--- /dev/null
@@ -0,0 +1,171 @@
+dnl  AMD64 mpn_copyd optimised for CPUs with fast AVX.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2003, 2005, 2007, 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')
+
+C cycles/limb aligned        unaligned       best seen      for cpu?
+C AMD K8,K9    n/a
+C AMD K10      n/a
+C AMD bull     n/a
+C AMD pile      4.87            4.87                           N
+C AMD steam     ?               ?
+C AMD bobcat   n/a
+C AMD jaguar   n/a
+C Intel P4     n/a
+C Intel core   n/a
+C Intel NHM    n/a
+C Intel SBR     0.50            0.91                           N
+C Intel IBR     ?
+C Intel HWL     0.25            0.30                           Y
+C Intel BWL     ?
+C Intel atom   n/a
+C VIA nano     n/a
+
+C We try to do as many 32-byte operations as possible.  The top-most and
+C bottom-most writes might need 8-byte operations.  For the bulk copying, we
+C write using aligned 32-byte operations, but we read with both aligned and
+C unaligned 32-byte operations.
+
+define(`rp', `%rdi')
+define(`up', `%rsi')
+define(`n',  `%rdx')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+dnl define(`vmovdqu', vlddqu)
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_copyd)
+       FUNC_ENTRY(3)
+
+       lea     -32(rp,n,8), rp
+       lea     -32(up,n,8), up
+
+       cmp     $7, n                   C basecase needed for correctness
+       jbe     L(bc)
+
+       test    $8, R8(rp)              C is rp 16-byte aligned?
+       jz      L(a2)                   C jump if rp aligned
+       mov     24(up), %rax
+       lea     -8(up), up
+       mov     %rax, 24(rp)
+       lea     -8(rp), rp
+       dec     n
+L(a2): test    $16, R8(rp)             C is rp 32-byte aligned?
+       jz      L(a3)                   C jump if rp aligned
+       vmovdqu 16(up), %xmm0
+       lea     -16(up), up
+       vmovdqa %xmm0, 16(rp)
+       lea     -16(rp), rp
+       sub     $2, n
+L(a3): sub     $16, n
+       jc      L(sma)
+
+       ALIGN(16)
+L(top):        vmovdqu (up), %ymm0
+       vmovdqu -32(up), %ymm1
+       vmovdqu -64(up), %ymm2
+       vmovdqu -96(up), %ymm3
+       lea     -128(up), up
+       vmovdqa %ymm0, (rp)
+       vmovdqa %ymm1, -32(rp)
+       vmovdqa %ymm2, -64(rp)
+       vmovdqa %ymm3, -96(rp)
+       lea     -128(rp), rp
+L(ali):        sub     $16, n
+       jnc     L(top)
+
+L(sma):        test    $8, R8(n)
+       jz      1f
+       vmovdqu (up), %ymm0
+       vmovdqu -32(up), %ymm1
+       lea     -64(up), up
+       vmovdqa %ymm0, (rp)
+       vmovdqa %ymm1, -32(rp)
+       lea     -64(rp), rp
+1:
+       test    $4, R8(n)
+       jz      1f
+       vmovdqu (up), %ymm0
+       lea     -32(up), up
+       vmovdqa %ymm0, (rp)
+       lea     -32(rp), rp
+1:
+       test    $2, R8(n)
+       jz      1f
+       vmovdqu 16(up), %xmm0
+       lea     -16(up), up
+       vmovdqa %xmm0, 16(rp)
+       lea     -16(rp), rp
+1:
+       test    $1, R8(n)
+       jz      1f
+       mov     24(up), %r8
+       mov     %r8, 24(rp)
+1:
+       FUNC_EXIT()
+       ret
+
+       ALIGN(16)
+L(bc): test    $4, R8(n)
+       jz      1f
+       mov     24(up), %rax
+       mov     16(up), %rcx
+       mov     8(up), %r8
+       mov     (up), %r9
+       lea     -32(up), up
+       mov     %rax, 24(rp)
+       mov     %rcx, 16(rp)
+       mov     %r8, 8(rp)
+       mov     %r9, (rp)
+       lea     -32(rp), rp
+1:
+       test    $2, R8(n)
+       jz      1f
+       mov     24(up), %rax
+       mov     16(up), %rcx
+       lea     -16(up), up
+       mov     %rax, 24(rp)
+       mov     %rcx, 16(rp)
+       lea     -16(rp), rp
+1:
+       test    $1, R8(n)
+       jz      1f
+       mov     24(up), %rax
+       mov     %rax, 24(rp)
+1:
+       FUNC_EXIT()
+       ret
+EPILOGUE()
diff --git a/mpn/x86_64/fastavx/copyi.asm b/mpn/x86_64/fastavx/copyi.asm
new file mode 100644 (file)
index 0000000..97264ef
--- /dev/null
@@ -0,0 +1,168 @@
+dnl  AMD64 mpn_copyi optimised for CPUs with fast AVX.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2003, 2005, 2007, 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')
+
+C cycles/limb aligned        unaligned       best seen      for cpu?
+C AMD K8,K9    n/a
+C AMD K10      n/a
+C AMD bull     n/a
+C AMD pile      4.87            4.87                           N
+C AMD steam     ?               ?
+C AMD bobcat   n/a
+C AMD jaguar   n/a
+C Intel P4     n/a
+C Intel core   n/a
+C Intel NHM    n/a
+C Intel SBR     0.50            0.91                           N
+C Intel IBR     ?
+C Intel HWL     0.25            0.30                           Y
+C Intel BWL     ?
+C Intel atom   n/a
+C VIA nano     n/a
+
+C We try to do as many 32-byte operations as possible.  The top-most and
+C bottom-most writes might need 8-byte operations.  For the bulk copying, we
+C write using aligned 32-byte operations, but we read with both aligned and
+C unaligned 32-byte operations.
+
+define(`rp', `%rdi')
+define(`up', `%rsi')
+define(`n',  `%rdx')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+dnl define(`vmovdqu', vlddqu)
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_copyi)
+       FUNC_ENTRY(3)
+
+       cmp     $7, n
+       jbe     L(bc)
+
+       test    $8, R8(rp)              C is rp 16-byte aligned?
+       jz      L(a2)                   C jump if rp aligned
+       mov     (up), %rax
+       lea     8(up), up
+       mov     %rax, (rp)
+       lea     8(rp), rp
+       dec     n
+L(a2): test    $16, R8(rp)             C is rp 32-byte aligned?
+       jz      L(a3)                   C jump if rp aligned
+       vmovdqu (up), %xmm0
+       lea     16(up), up
+       vmovdqa %xmm0, (rp)
+       lea     16(rp), rp
+       sub     $2, n
+L(a3): sub     $16, n
+       jc      L(sma)
+
+       ALIGN(16)
+L(top):        vmovdqu (up), %ymm0
+       vmovdqu 32(up), %ymm1
+       vmovdqu 64(up), %ymm2
+       vmovdqu 96(up), %ymm3
+       lea     128(up), up
+       vmovdqa %ymm0, (rp)
+       vmovdqa %ymm1, 32(rp)
+       vmovdqa %ymm2, 64(rp)
+       vmovdqa %ymm3, 96(rp)
+       lea     128(rp), rp
+L(ali):        sub     $16, n
+       jnc     L(top)
+
+L(sma):        test    $8, R8(n)
+       jz      1f
+       vmovdqu (up), %ymm0
+       vmovdqu 32(up), %ymm1
+       lea     64(up), up
+       vmovdqa %ymm0, (rp)
+       vmovdqa %ymm1, 32(rp)
+       lea     64(rp), rp
+1:
+       test    $4, R8(n)
+       jz      1f
+       vmovdqu (up), %ymm0
+       lea     32(up), up
+       vmovdqa %ymm0, (rp)
+       lea     32(rp), rp
+1:
+       test    $2, R8(n)
+       jz      1f
+       vmovdqu (up), %xmm0
+       lea     16(up), up
+       vmovdqa %xmm0, (rp)
+       lea     16(rp), rp
+1:
+L(end):        test    $1, R8(n)
+       jz      1f
+       mov     (up), %r8
+       mov     %r8, (rp)
+1:
+       FUNC_EXIT()
+       ret
+
+       ALIGN(16)
+L(bc): test    $4, R8(n)
+       jz      1f
+       mov     (up), %rax
+       mov     8(up), %rcx
+       mov     16(up), %r8
+       mov     24(up), %r9
+       lea     32(up), up
+       mov     %rax, (rp)
+       mov     %rcx, 8(rp)
+       mov     %r8, 16(rp)
+       mov     %r9, 24(rp)
+       lea     32(rp), rp
+1:
+       test    $2, R8(n)
+       jz      1f
+       mov     (up), %rax
+       mov     8(up), %rcx
+       lea     16(up), up
+       mov     %rax, (rp)
+       mov     %rcx, 8(rp)
+       lea     16(rp), rp
+1:
+       test    $1, R8(n)
+       jz      1f
+       mov     (up), %rax
+       mov     %rax, (rp)
+1:
+       FUNC_EXIT()
+       ret
+EPILOGUE()
index 8399efd2d330135da38dfe885f2e7cb9639d6831..520551ed99dfca3b6a29fe81db5b3edc3fe3eda1 100644 (file)
@@ -17,4 +17,5 @@ Current processors that do not benefit from this code are:
   Intel Atom
 
 Intel Conroe/Penryn is a border case; its handling of non-aligned
-128-bit memory operands is poor.
+128-bit memory operands is poor.  VIA Nano also have poor handling of
+non-aligned operands.
diff --git a/mpn/x86_64/fastsse/com-palignr.asm b/mpn/x86_64/fastsse/com-palignr.asm
new file mode 100644 (file)
index 0000000..d9641e8
--- /dev/null
@@ -0,0 +1,302 @@
+dnl  AMD64 mpn_com optimised for CPUs with fast SSE copying and SSSE3.
+
+dnl  Copyright 2012, 2013 Free Software Foundation, Inc.
+
+dnl  Contributed to the GNU project by Torbjorn Granlund.
+
+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     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 bd1       1.39            ? 1.45                         Y/N
+C AMD bobcat    1.97            ? 8.17         1.5/1.5         N
+C Intel P4      2.26            illop                          Y/N
+C Intel core2   0.52            0.82           opt/0.74        Y
+C Intel NHM     0.52            0.65           opt/opt         Y
+C Intel SBR     0.51            0.55           opt/0.51        Y
+C Intel atom    1.16            1.70           opt/opt         Y
+C VIA nano      1.09            1.10           opt/opt         Y
+
+C We use only 16-byte operations, except for unaligned top-most and bottom-most
+C limbs.  We use the SSSE3 palignr instruction when rp - up = 8 (mod 16).  That
+C instruction is better adapted to mpn_copyd's needs, we need to contort the
+C code to use it here.
+C
+C For operands of < COM_SSE_THRESHOLD limbs, we use a plain 64-bit loop, taken
+C from the x86_64 default code.
+
+C INPUT PARAMETERS
+define(`rp', `%rdi')
+define(`up', `%rsi')
+define(`n',  `%rdx')
+
+C There are three instructions for loading an aligned 128-bit quantity.  We use
+C movaps, since it has the shortest coding.
+define(`movdqa', ``movaps'')
+
+ifdef(`COM_SSE_THRESHOLD',`',`define(`COM_SSE_THRESHOLD', 7)')
+
+ASM_START()
+       TEXT
+       ALIGN(64)
+PROLOGUE(mpn_com)
+       FUNC_ENTRY(3)
+
+       cmp     $COM_SSE_THRESHOLD, n
+       jbe     L(bc)
+
+       pcmpeqb %xmm7, %xmm7            C set to 111...111
+
+       test    $8, R8(rp)              C is rp 16-byte aligned?
+       jz      L(rp_aligned)           C jump if rp aligned
+
+       mov     (up), %r8
+       lea     8(up), up
+       not     %r8
+       mov     %r8, (rp)
+       lea     8(rp), rp
+       dec     n
+
+L(rp_aligned):
+       test    $8, R8(up)
+       jnz     L(uent)
+
+ifelse(eval(COM_SSE_THRESHOLD >= 8),1,
+`      sub     $8, n',
+`      jmp     L(am)')
+
+       ALIGN(16)
+L(atop):movdqa 0(up), %xmm0
+       movdqa  16(up), %xmm1
+       movdqa  32(up), %xmm2
+       movdqa  48(up), %xmm3
+       lea     64(up), up
+       pxor    %xmm7, %xmm0
+       pxor    %xmm7, %xmm1
+       pxor    %xmm7, %xmm2
+       pxor    %xmm7, %xmm3
+       movdqa  %xmm0, (rp)
+       movdqa  %xmm1, 16(rp)
+       movdqa  %xmm2, 32(rp)
+       movdqa  %xmm3, 48(rp)
+       lea     64(rp), rp
+L(am): sub     $8, n
+       jnc     L(atop)
+
+       test    $4, R8(n)
+       jz      1f
+       movdqa  (up), %xmm0
+       movdqa  16(up), %xmm1
+       lea     32(up), up
+       pxor    %xmm7, %xmm0
+       pxor    %xmm7, %xmm1
+       movdqa  %xmm0, (rp)
+       movdqa  %xmm1, 16(rp)
+       lea     32(rp), rp
+
+1:     test    $2, R8(n)
+       jz      1f
+       movdqa  (up), %xmm0
+       lea     16(up), up
+       pxor    %xmm7, %xmm0
+       movdqa  %xmm0, (rp)
+       lea     16(rp), rp
+
+1:     test    $1, R8(n)
+       jz      1f
+       mov     (up), %r8
+       not     %r8
+       mov     %r8, (rp)
+
+1:     FUNC_EXIT()
+       ret
+
+L(uent):
+C Code handling up - rp = 8 (mod 16)
+
+C FIXME: The code below only handles overlap if it is close to complete, or
+C quite separate: up-rp < 5 or up-up > 15 limbs
+       lea     -40(up), %rax           C 40 = 5 * GMP_LIMB_BYTES
+       sub     rp, %rax
+       cmp     $80, %rax               C 80 = (15-5) * GMP_LIMB_BYTES
+       jbe     L(bc)                   C deflect to plain loop
+
+       sub     $16, n
+       jc      L(uend)
+
+       movdqa  120(up), %xmm3
+
+       sub     $16, n
+       jmp     L(um)
+
+       ALIGN(16)
+L(utop):movdqa 120(up), %xmm3
+       pxor    %xmm7, %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
+       movdqa  %xmm3, 112(rp)
+       palignr($8, %xmm1, %xmm2)
+       movdqa  72(up), %xmm0
+       pxor    %xmm7, %xmm2
+       movdqa  %xmm2, 96(rp)
+       palignr($8, %xmm0, %xmm1)
+       movdqa  56(up), %xmm3
+       pxor    %xmm7, %xmm1
+       movdqa  %xmm1, 80(rp)
+       palignr($8, %xmm3, %xmm0)
+       movdqa  40(up), %xmm2
+       pxor    %xmm7, %xmm0
+       movdqa  %xmm0, 64(rp)
+       palignr($8, %xmm2, %xmm3)
+       movdqa  24(up), %xmm1
+       pxor    %xmm7, %xmm3
+       movdqa  %xmm3, 48(rp)
+       palignr($8, %xmm1, %xmm2)
+       movdqa  8(up), %xmm0
+       pxor    %xmm7, %xmm2
+       movdqa  %xmm2, 32(rp)
+       palignr($8, %xmm0, %xmm1)
+       movdqa  -8(up), %xmm3
+       pxor    %xmm7, %xmm1
+       movdqa  %xmm1, 16(rp)
+       palignr($8, %xmm3, %xmm0)
+       lea     128(up), up
+       lea     128(rp), rp
+       jnc     L(utop)
+
+       pxor    %xmm7, %xmm0
+       movdqa  %xmm0, -128(rp)
+
+L(uend):test   $8, R8(n)
+       jz      1f
+       movdqa  56(up), %xmm3
+       movdqa  40(up), %xmm2
+       palignr($8, %xmm2, %xmm3)
+       movdqa  24(up), %xmm1
+       pxor    %xmm7, %xmm3
+       movdqa  %xmm3, 48(rp)
+       palignr($8, %xmm1, %xmm2)
+       movdqa  8(up), %xmm0
+       pxor    %xmm7, %xmm2
+       movdqa  %xmm2, 32(rp)
+       palignr($8, %xmm0, %xmm1)
+       movdqa  -8(up), %xmm3
+       pxor    %xmm7, %xmm1
+       movdqa  %xmm1, 16(rp)
+       palignr($8, %xmm3, %xmm0)
+       lea     64(up), up
+       pxor    %xmm7, %xmm0
+       movdqa  %xmm0, (rp)
+       lea     64(rp), rp
+
+1:     test    $4, R8(n)
+       jz      1f
+       movdqa  24(up), %xmm1
+       movdqa  8(up), %xmm0
+       palignr($8, %xmm0, %xmm1)
+       movdqa  -8(up), %xmm3
+       pxor    %xmm7, %xmm1
+       movdqa  %xmm1, 16(rp)
+       palignr($8, %xmm3, %xmm0)
+       lea     32(up), up
+       pxor    %xmm7, %xmm0
+       movdqa  %xmm0, (rp)
+       lea     32(rp), rp
+
+1:     test    $2, R8(n)
+       jz      1f
+       movdqa  8(up), %xmm0
+       movdqa  -8(up), %xmm3
+       palignr($8, %xmm3, %xmm0)
+       lea     16(up), up
+       pxor    %xmm7, %xmm0
+       movdqa  %xmm0, (rp)
+       lea     16(rp), rp
+
+1:     test    $1, R8(n)
+       jz      1f
+       mov     (up), %r8
+       not     %r8
+       mov     %r8, (rp)
+
+1:     FUNC_EXIT()
+       ret
+
+C Basecase code.  Needed for good small operands speed, not for
+C correctness as the above code is currently written.
+
+L(bc): lea     -8(rp), rp
+       sub     $4, R32(n)
+       jc      L(end)
+
+ifelse(eval(1 || COM_SSE_THRESHOLD >= 8),1,
+`      ALIGN(16)')
+L(top):        mov     (up), %r8
+       mov     8(up), %r9
+       lea     32(rp), rp
+       mov     16(up), %r10
+       mov     24(up), %r11
+       lea     32(up), up
+       not     %r8
+       not     %r9
+       not     %r10
+       not     %r11
+       mov     %r8, -24(rp)
+       mov     %r9, -16(rp)
+ifelse(eval(1 || COM_SSE_THRESHOLD >= 8),1,
+`      sub     $4, R32(n)')
+       mov     %r10, -8(rp)
+       mov     %r11, (rp)
+ifelse(eval(1 || COM_SSE_THRESHOLD >= 8),1,
+`      jnc     L(top)')
+
+L(end):        test    $1, R8(n)
+       jz      1f
+       mov     (up), %r8
+       not     %r8
+       mov     %r8, 8(rp)
+       lea     8(rp), rp
+       lea     8(up), up
+1:     test    $2, R8(n)
+       jz      1f
+       mov     (up), %r8
+       mov     8(up), %r9
+       not     %r8
+       not     %r9
+       mov     %r8, 8(rp)
+       mov     %r9, 16(rp)
+1:     FUNC_EXIT()
+       ret
+EPILOGUE()
index 775b1c98ed633dc92a1727f9d75fba84ac62bea2..4abb076d3f5816cdbb5117f1bb62048151633485 100644 (file)
@@ -5,19 +5,30 @@ dnl  Copyright 2003, 2005, 2007, 2011, 2012 Free Software Foundation, Inc.
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 0b058ad0b55afc5819fdbe10fd81e42cc371251b..7430cadc09ee633dd66b205ff59ca16e2db03173 100644 (file)
@@ -5,19 +5,30 @@ dnl  Copyright 2012 Free Software Foundation, Inc.
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -25,14 +36,19 @@ 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 bd1       1.39            1.40                           Y
-C AMD bobcat    1.97            8.35           1.5/1.5         N
+C AMD bull      0.70            0.70                           Y
+C AMD pile      0.68            0.68                           Y
+C AMD steam     ?               ?
+C AMD bobcat    1.97            8.24           1.5/1.5         N
+C AMD jaguar    ?               ?
 C Intel P4      2.26            illop                          Y/N
-C Intel core2   0.52           0.68-0.80       opt/0.68        Y
+C Intel core    0.52           0.68-0.80       opt/0.64        Y
 C Intel NHM     0.52            0.64           opt/opt         Y
-C Intel SBR     0.51            0.54           opt/0.51        Y
+C Intel SBR     0.51            0.51           opt/0.51        Y
+C Intel IBR     ?               ?                              Y
+C Intel HWL     0.51            0.51           0.25/0.25       N
 C Intel atom    1.16            1.66           opt/opt         Y
-C VIA nano      1.09            1.07           opt/opt         Y
+C VIA nano      1.08            1.06           opt/opt         Y
 
 C We use only 16-byte operations, except for unaligned top-most and bottom-most
 C limbs.  We use the SSSE3 palignr instruction when rp - up = 8 (mod 16).
@@ -63,8 +79,8 @@ PROLOGUE(mpn_copyd)
        cmp     $COPYD_SSE_THRESHOLD, n
        jbe     L(bc)
 
-       bt      $3, R32(rp)             C is rp 16-byte aligned?
-       j     L(rp_aligned)           C jump if rp aligned
+       test    $8, R8(rp)              C is rp 16-byte aligned?
+       jnz     L(rp_aligned)           C jump if rp aligned
 
        mov     (up), %rax              C copy one limb
        mov     %rax, (rp)
@@ -73,8 +89,8 @@ PROLOGUE(mpn_copyd)
        dec     n
 
 L(rp_aligned):
-       bt      $3, R32(up)
-       jnc     L(uent)
+       test    $8, R8(up)
+       j     L(uent)
 
 ifelse(eval(COPYD_SSE_THRESHOLD >= 8),1,
 `      sub     $8, n',
@@ -94,8 +110,8 @@ L(atop):movdqa       -8(up), %xmm0
 L(am): sub     $8, n
        jnc     L(atop)
 
-       bt      $2, R32(n)
-       jnc     1f
+       test    $4, R8(n)
+       j     1f
        movdqa  -8(up), %xmm0
        movdqa  -24(up), %xmm1
        lea     -32(up), up
@@ -103,15 +119,15 @@ L(am):    sub     $8, n
        movdqa  %xmm1, -24(rp)
        lea     -32(rp), rp
 
-1:     bt      $1, R32(n)
-       jnc     1f
+1:     test    $2, R8(n)
+       j     1f
        movdqa  -8(up), %xmm0
        lea     -16(up), up
        movdqa  %xmm0, -8(rp)
        lea     -16(rp), rp
 
-1:     bt      $0, n
-       jnc     1f
+1:     test    $1, R8(n)
+       j     1f
        mov     (up), %r8
        mov     %r8, (rp)
 
@@ -152,8 +168,8 @@ L(utop):sub $16, n
        lea     -128(rp), rp
        jnc     L(utop)
 
-L(uend):bt     $3, R32(n)
-       jnc     1f
+L(uend):test   $8, R8(n)
+       j     1f
        movdqa  -16(up), %xmm1
        palignr($8, %xmm1, %xmm0)
        movdqa  %xmm0, -8(rp)
@@ -169,8 +185,8 @@ L(uend):bt  $3, R32(n)
        lea     -64(up), up
        lea     -64(rp), rp
 
-1:     bt      $2, R32(n)
-       jnc     1f
+1:     test    $4, R8(n)
+       j     1f
        movdqa  -16(up), %xmm1
        palignr($8, %xmm1, %xmm0)
        movdqa  %xmm0, -8(rp)
@@ -180,16 +196,16 @@ L(uend):bt        $3, R32(n)
        lea     -32(up), up
        lea     -32(rp), rp
 
-1:     bt      $1, R32(n)
-       jnc     1f
+1:     test    $2, R8(n)
+       j     1f
        movdqa  -16(up), %xmm1
        palignr($8, %xmm1, %xmm0)
        movdqa  %xmm0, -8(rp)
        lea     -16(up), up
        lea     -16(rp), rp
 
-1:     bt      $0, n
-       jnc     1f
+1:     test    $1, R8(n)
+       j     1f
        mov     (up), %r8
        mov     %r8, (rp)
 
@@ -218,14 +234,14 @@ ifelse(eval(COPYD_SSE_THRESHOLD >= 8),1,
 ifelse(eval(COPYD_SSE_THRESHOLD >= 8),1,
 `      jnc     L(top)')
 
-L(end):        bt      $0, R32(n)
-       jnc     1f
+L(end):        test    $1, R8(n)
+       j     1f
        mov     (up), %r8
        mov     %r8, (rp)
        lea     -8(rp), rp
        lea     -8(up), up
-1:     bt      $1, R32(n)
-       jnc     1f
+1:     test    $2, R8(n)
+       j     1f
        mov     (up), %r8
        mov     -8(up), %r9
        mov     %r8, (rp)
index c5fd7b3068c83e469a51f37d7bc4ffc25fdbafd6..5c6094c7e2babde1abfa066d5720d333ae284e9a 100644 (file)
@@ -3,19 +3,30 @@ dnl  AMD64 mpn_copyd optimised for CPUs with fast SSE.
 dnl  Copyright 2003, 2005, 2007, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d968b5a26ba77bec540cd98624a5a7fb7ea24a7c..fda3c3500f6569356efb5851cc06efaaf1996288 100644 (file)
@@ -1,23 +1,34 @@
 dnl  AMD64 mpn_copyi optimised for CPUs with fast SSE copying and SSSE3.
 
-dnl  Copyright 2012 Free Software Foundation, Inc.
+dnl  Copyright 2012, 2013 Free Software Foundation, Inc.
 
-dnl  Contributed to the GNU project by Torbjorn Granlund.
+dnl  Contributed to the GNU project by Torbjörn Granlund.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -25,14 +36,19 @@ 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 bd1       1.39            ? 1.45                         Y/N
-C AMD bobcat    1.97            ? 8.17         1.5/1.5         N
+C AMD bull      0.70            0.66                           Y
+C AMD pile      0.68            0.66                           Y
+C AMD steam     ?               ?
+C AMD bobcat    1.97            8.16           1.5/1.5         N
+C AMD jaguar    ?               ?
 C Intel P4      2.26            illop                          Y/N
-C Intel core2   0.52            0.82           opt/0.74        Y
-C Intel NHM     0.52            0.65           opt/opt         Y
-C Intel SBR     0.51            0.55           opt/0.51        Y
-C Intel atom    1.16            1.70           opt/opt         Y
-C VIA nano      1.09            1.10           opt/opt         Y
+C Intel core    0.52            0.64           opt/opt         Y
+C Intel NHM     0.52            0.71           opt/opt         Y
+C Intel SBR     0.51            0.54           opt/0.51        Y
+C Intel IBR     ?               ?                              Y
+C Intel HWL     0.51            0.52           0.25/0.25       N
+C Intel atom    1.16            1.61           opt/opt         Y
+C VIA nano      1.09            1.08           opt/opt         Y
 
 C We use only 16-byte operations, except for unaligned top-most and bottom-most
 C limbs.  We use the SSSE3 palignr instruction when rp - up = 8 (mod 16).  That
@@ -49,7 +65,7 @@ define(`n',  `%rdx')
 
 C There are three instructions for loading an aligned 128-bit quantity.  We use
 C movaps, since it has the shortest coding.
-define(`movdqa', ``movaps'')
+dnl define(`movdqa', ``movaps'')
 
 ifdef(`COPYI_SSE_THRESHOLD',`',`define(`COPYI_SSE_THRESHOLD', 7)')
 
@@ -62,15 +78,15 @@ PROLOGUE(mpn_copyi)
        cmp     $COPYI_SSE_THRESHOLD, n
        jbe     L(bc)
 
-       bt      $3, R32(rp)             C is rp 16-byte aligned?
-       jnc     L(rp_aligned)           C jump if rp aligned
+       test    $8, R8(rp)              C is rp 16-byte aligned?
+       j     L(rp_aligned)           C jump if rp aligned
 
        movsq                           C copy one limb
        dec     n
 
 L(rp_aligned):
-       bt      $3, R32(up)
-       j     L(uent)
+       test    $8, R8(up)
+       jnz     L(uent)
 
 ifelse(eval(COPYI_SSE_THRESHOLD >= 8),1,
 `      sub     $8, n',
@@ -90,8 +106,8 @@ L(atop):movdqa       0(up), %xmm0
 L(am): sub     $8, n
        jnc     L(atop)
 
-       bt      $2, R32(n)
-       jnc     1f
+       test    $4, R8(n)
+       j     1f
        movdqa  (up), %xmm0
        movdqa  16(up), %xmm1
        lea     32(up), up
@@ -99,15 +115,15 @@ L(am):     sub     $8, n
        movdqa  %xmm1, 16(rp)
        lea     32(rp), rp
 
-1:     bt      $1, R32(n)
-       jnc     1f
+1:     test    $2, R8(n)
+       j     1f
        movdqa  (up), %xmm0
        lea     16(up), up
        movdqa  %xmm0, (rp)
        lea     16(rp), rp
 
-1:     bt      $0, n
-       jnc     1f
+1:     test    $1, R8(n)
+       j     1f
        mov     (up), %r8
        mov     %r8, (rp)
 
@@ -117,86 +133,113 @@ L(am):   sub     $8, n
 L(uent):
 C Code handling up - rp = 8 (mod 16)
 
-C FIXME: The code below only handles overlap if it is close to complete, or
-C quite separate: up-rp < 5 or up-up > 15 limbs
-       lea     -40(up), %rax           C 40 = 5 * GMP_LIMB_BYTES
-       sub     rp, %rax
-       cmp     $80, %rax               C 80 = (15-5) * GMP_LIMB_BYTES
-       jbe     L(bc)                   C deflect to plain loop
-
-       sub     $16, n
-       jc      L(uend)
+       cmp     $16, n
+       jc      L(ued0)
 
-       movdqa  120(up), %xmm3
+IFDOS(`        add     $-56, %rsp      ')
+IFDOS(`        movdqa  %xmm6, (%rsp)   ')
+IFDOS(`        movdqa  %xmm7, 16(%rsp) ')
+IFDOS(`        movdqa  %xmm8, 32(%rsp) ')
 
-       sub     $16, n
-       jmp     L(um)
+       movaps  120(up), %xmm7
+       movaps  104(up), %xmm6
+       movaps  88(up), %xmm5
+       movaps  72(up), %xmm4
+       movaps  56(up), %xmm3
+       movaps  40(up), %xmm2
+       lea     128(up), up
+       sub     $32, n
+       jc      L(ued1)
 
        ALIGN(16)
-L(utop):movdqa 120(up), %xmm3
-       movdqa  %xmm0, -128(rp)
+L(utop):movaps -104(up), %xmm1
        sub     $16, n
-L(um): movdqa  104(up), %xmm2
+       movaps  -120(up), %xmm0
+       palignr($8, %xmm6, %xmm7)
+       movaps  -136(up), %xmm8
+       movdqa  %xmm7, 112(rp)
+       palignr($8, %xmm5, %xmm6)
+       movaps  120(up), %xmm7
+       movdqa  %xmm6, 96(rp)
+       palignr($8, %xmm4, %xmm5)
+       movaps  104(up), %xmm6
+       movdqa  %xmm5, 80(rp)
+       palignr($8, %xmm3, %xmm4)
+       movaps  88(up), %xmm5
+       movdqa  %xmm4, 64(rp)
        palignr($8, %xmm2, %xmm3)
-       movdqa  88(up), %xmm1
-       movdqa  %xmm3, 112(rp)
-       palignr($8, %xmm1, %xmm2)
-       movdqa  72(up), %xmm0
-       movdqa  %xmm2, 96(rp)
-       palignr($8, %xmm0, %xmm1)
-       movdqa  56(up), %xmm3
-       movdqa  %xmm1, 80(rp)
-       palignr($8, %xmm3, %xmm0)
-       movdqa  40(up), %xmm2
-       movdqa  %xmm0, 64(rp)
-       palignr($8, %xmm2, %xmm3)
-       movdqa  24(up), %xmm1
+       movaps  72(up), %xmm4
        movdqa  %xmm3, 48(rp)
        palignr($8, %xmm1, %xmm2)
-       movdqa  8(up), %xmm0
+       movaps  56(up), %xmm3
        movdqa  %xmm2, 32(rp)
        palignr($8, %xmm0, %xmm1)
-       movdqa  -8(up), %xmm3
+       movaps  40(up), %xmm2
        movdqa  %xmm1, 16(rp)
-       palignr($8, %xmm3, %xmm0)
+       palignr($8, %xmm8, %xmm0)
        lea     128(up), up
+       movdqa  %xmm0, (rp)
        lea     128(rp), rp
        jnc     L(utop)
 
-       movdqa  %xmm0, -128(rp)
+L(ued1):movaps -104(up), %xmm1
+       movaps  -120(up), %xmm0
+       movaps  -136(up), %xmm8
+       palignr($8, %xmm6, %xmm7)
+       movdqa  %xmm7, 112(rp)
+       palignr($8, %xmm5, %xmm6)
+       movdqa  %xmm6, 96(rp)
+       palignr($8, %xmm4, %xmm5)
+       movdqa  %xmm5, 80(rp)
+       palignr($8, %xmm3, %xmm4)
+       movdqa  %xmm4, 64(rp)
+       palignr($8, %xmm2, %xmm3)
+       movdqa  %xmm3, 48(rp)
+       palignr($8, %xmm1, %xmm2)
+       movdqa  %xmm2, 32(rp)
+       palignr($8, %xmm0, %xmm1)
+       movdqa  %xmm1, 16(rp)
+       palignr($8, %xmm8, %xmm0)
+       movdqa  %xmm0, (rp)
+       lea     128(rp), rp
 
-L(uend):bt     $3, R32(n)
-       jnc     1f
-       movdqa  56(up), %xmm3
-       movdqa  40(up), %xmm2
+IFDOS(`        movdqa  (%rsp), %xmm6   ')
+IFDOS(`        movdqa  16(%rsp), %xmm7 ')
+IFDOS(`        movdqa  32(%rsp), %xmm8 ')
+IFDOS(`        add     $56, %rsp       ')
+
+L(ued0):test   $8, R8(n)
+       jz      1f
+       movaps  56(up), %xmm3
+       movaps  40(up), %xmm2
+       movaps  24(up), %xmm1
+       movaps  8(up), %xmm0
+       movaps  -8(up), %xmm4
        palignr($8, %xmm2, %xmm3)
-       movdqa  24(up), %xmm1
        movdqa  %xmm3, 48(rp)
        palignr($8, %xmm1, %xmm2)
-       movdqa  8(up), %xmm0
        movdqa  %xmm2, 32(rp)
        palignr($8, %xmm0, %xmm1)
-       movdqa  -8(up), %xmm3
        movdqa  %xmm1, 16(rp)
-       palignr($8, %xmm3, %xmm0)
+       palignr($8, %xmm4, %xmm0)
        lea     64(up), up
        movdqa  %xmm0, (rp)
        lea     64(rp), rp
 
-1:     bt      $2, R32(n)
-       jnc     1f
-       movdqa  24(up), %xmm1
-       movdqa  8(up), %xmm0
+1:     test    $4, R8(n)
+       j     1f
+       movaps  24(up), %xmm1
+       movaps  8(up), %xmm0
        palignr($8, %xmm0, %xmm1)
-       movdqa  -8(up), %xmm3
+       movaps  -8(up), %xmm3
        movdqa  %xmm1, 16(rp)
        palignr($8, %xmm3, %xmm0)
        lea     32(up), up
        movdqa  %xmm0, (rp)
        lea     32(rp), rp
 
-1:     bt      $1, R32(n)
-       jnc     1f
+1:     test    $2, R8(n)
+       j     1f
        movdqa  8(up), %xmm0
        movdqa  -8(up), %xmm3
        palignr($8, %xmm3, %xmm0)
@@ -204,8 +247,8 @@ L(uend):bt  $3, R32(n)
        movdqa  %xmm0, (rp)
        lea     16(rp), rp
 
-1:     bt      $0, n
-       jnc     1f
+1:     test    $1, R8(n)
+       j     1f
        mov     (up), %r8
        mov     %r8, (rp)
 
@@ -228,21 +271,21 @@ L(top):   mov     (up), %r8
        lea     32(up), up
        mov     %r8, -24(rp)
        mov     %r9, -16(rp)
-ifelse(eval(1 || COPYI_SSE_THRESHOLD >= 8),1,
+ifelse(eval(COPYI_SSE_THRESHOLD >= 8),1,
 `      sub     $4, R32(n)')
        mov     %r10, -8(rp)
        mov     %r11, (rp)
-ifelse(eval(1 || COPYI_SSE_THRESHOLD >= 8),1,
+ifelse(eval(COPYI_SSE_THRESHOLD >= 8),1,
 `      jnc     L(top)')
 
-L(end):        bt      $0, R32(n)
-       jnc     1f
+L(end):        test    $1, R8(n)
+       j     1f
        mov     (up), %r8
        mov     %r8, 8(rp)
        lea     8(rp), rp
        lea     8(up), up
-1:     bt      $1, R32(n)
-       jnc     1f
+1:     test    $2, R8(n)
+       j     1f
        mov     (up), %r8
        mov     8(up), %r9
        mov     %r8, 8(rp)
index 60c5f9ad25951098d6337e243edb292e8d28f7b3..a1a1c231dc0852cda5ef4eebf0cf8fca854925d0 100644 (file)
@@ -1,21 +1,34 @@
 dnl  AMD64 mpn_copyi optimised for CPUs with fast SSE.
 
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
 dnl  Copyright 2003, 2005, 2007, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -121,8 +134,8 @@ L(sma):     test    $8, R8(n)
        lea     16(rp), rp
        ALIGN(16)
 1:
-L(end):        bt      $0, n
-       jnc     1f
+L(end):        test    $1, R8(n)
+       j     1f
        mov     (up), %r8
        mov     %r8, (rp)
 1:
@@ -144,8 +157,8 @@ L(bc):      sub     $2, n
        sub     $2, n
        jnc     1b
 
-       bt      $0, n
-       jnc     L(ret)
+       test    $1, R8(n)
+       j     L(ret)
        mov     (up), %rax
        mov     %rax, (rp)
 L(ret):        FUNC_EXIT()
index ea34b394bda3d22ee3b695ee71dbb9f2dc147915..a05e850a1fc1d4b353b3b54f95d1b4203d459537 100644 (file)
@@ -2,22 +2,33 @@ dnl  AMD64 mpn_lshift optimised for CPUs with fast SSE including fast movdqu.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -70,8 +81,8 @@ PROLOGUE(mpn_lshift)
        jle     L(bc)
 
        lea     (rp,n,8), R32(%rcx)
-       bt      $3, R32(%rcx)
-       jnc     L(rp_aligned)
+       test    $8, R8(%rcx)
+       j     L(rp_aligned)
 
 C Do one initial limb in order to make rp aligned
        movq    -8(ap,n,8), %xmm0
@@ -130,8 +141,8 @@ L(i34):
        sub     $8, n
        jg      L(top)
 
-L(end):        bt      $0, R32(n)
-       j     L(end8)
+L(end):        test    $1, R8(n)
+       jnz     L(end8)
 
        movdqu  (ap), %xmm1
        pxor    %xmm0, %xmm0
index d76241ef7c2ccdf11fe3e0977e49ccc9a9f8779a..f76972a22f63e3f32eef43fd504984010dd8570c 100644 (file)
@@ -2,22 +2,33 @@ 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, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 7e816ac2ca1e850739291065e67c401802b731ee..8250910c52a60af1b30c3eda33889b28a5c84c63 100644 (file)
@@ -2,22 +2,33 @@ dnl  AMD64 mpn_lshiftc optimised for CPUs with fast SSE including fast movdqu.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -72,8 +83,8 @@ PROLOGUE(mpn_lshiftc)
        jle     L(bc)
 
        lea     (rp,n,8), R32(%rcx)
-       bt      $3, R32(%rcx)
-       jnc     L(rp_aligned)
+       test    $8, R8(%rcx)
+       j     L(rp_aligned)
 
 C Do one initial limb in order to make rp aligned
        movq    -8(ap,n,8), %xmm0
@@ -137,8 +148,8 @@ L(i34):
        sub     $8, n
        jg      L(top)
 
-L(end):        bt      $0, R32(n)
-       j     L(end8)
+L(end):        test    $1, R8(n)
+       jnz     L(end8)
 
        movdqu  (ap), %xmm1
        pxor    %xmm0, %xmm0
index 6d9ec7b28b6db46c87bcd84dd3152ee66bac8b2b..d2520690e223e4570520b962c0d76822c72226d8 100644 (file)
@@ -2,22 +2,33 @@ 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, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 158124e43c778374ca39ab1e7444b5551ec4517a..1e270b13c314112a5c9547081c5c614d8699e8d4 100644 (file)
@@ -2,22 +2,33 @@ dnl  AMD64 mpn_rshift optimised for CPUs with fast SSE including fast movdqu.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -69,8 +80,8 @@ PROLOGUE(mpn_rshift)
        cmp     $3, n
        jle     L(bc)
 
-       bt      $3, R32(rp)
-       jnc     L(rp_aligned)
+       test    $8, R8(rp)
+       j     L(rp_aligned)
 
 C Do one initial limb in order to make rp aligned
        movq    (ap), %xmm0
@@ -134,8 +145,8 @@ L(i34):
        add     $8, n
        jl      L(top)
 
-L(end):        bt      $0, R32(n)
-       j     L(e1)
+L(end):        test    $1, R8(n)
+       jnz     L(e1)
 
        movdqu  -16(ap), %xmm1
        movq    -8(ap), %xmm0
diff --git a/mpn/x86_64/fastsse/sec_tabselect.asm b/mpn/x86_64/fastsse/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..e3df110
--- /dev/null
@@ -0,0 +1,192 @@
+dnl  AMD64 SSE mpn_sec_tabselect.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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')
+
+
+C           cycles/limb     cycles/limb     cycles/limb
+C            ali,evn n      unal,evn n       other cases
+C AMD K8,K9     1.65           1.65             1.8
+C AMD K10       0.78           0.78             0.85
+C AMD bd1       0.80           0.91             1.25
+C AMD bobcat    2.15           2.15             2.37
+C Intel P4      2.5            2.5              2.95
+C Intel core2   1.17           1.25             1.25
+C Intel NHM     0.87           0.90             0.90
+C Intel SBR     0.63           0.79             0.77
+C Intel atom    4.3             4.3             4.3    slower than plain code
+C VIA nano      1.4             5.1             3.14   too alignment dependent
+
+C NOTES
+C  * We only honour the least significant 32 bits of the `which' and `nents'
+C    arguments to allow efficient code using just SSE2.  We would need to
+C    either use the SSE4_1 pcmpeqq, or find some other SSE2 sequence.
+C  * We use movd for copying between xmm and plain registers, since old gas
+C    rejects movq.  But gas assembles movd as movq when given a 64-bit greg.
+
+define(`rp',     `%rdi')
+define(`tp',     `%rsi')
+define(`n',      `%rdx')
+define(`nents',  `%rcx')
+define(`which',  `%r8')
+
+define(`i',      `%r10')
+define(`j',      `%r9')
+
+C rax  rbx  rcx  rdx  rdi  rsi  rbp   r8   r9  r10  r11  r12  r13  r14  r15
+C          nents  n   rp   tab       which j    i   temp  *    *    *    *
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_sec_tabselect)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8d  ')
+
+       movd    which, %xmm8
+       pshufd  $0, %xmm8, %xmm8        C 4 `which' copies
+       mov     $1, R32(%rax)
+       movd    %rax, %xmm9
+       pshufd  $0, %xmm9, %xmm9        C 4 copies of 1
+
+       mov     n, j
+       add     $-8, j
+       js      L(outer_end)
+
+L(outer_top):
+       mov     nents, i
+       mov     tp, %r11
+       pxor    %xmm13, %xmm13
+       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
+       movdqu  0(tp), %xmm2
+       movdqu  16(tp), %xmm3
+       pand    %xmm0, %xmm2
+       pand    %xmm0, %xmm3
+       por     %xmm2, %xmm4
+       por     %xmm3, %xmm5
+       movdqu  32(tp), %xmm2
+       movdqu  48(tp), %xmm3
+       pand    %xmm0, %xmm2
+       pand    %xmm0, %xmm3
+       por     %xmm2, %xmm6
+       por     %xmm3, %xmm7
+       lea     (tp,n,8), tp
+       add     $-1, i
+       jne     L(top)
+
+       movdqu  %xmm4, 0(rp)
+       movdqu  %xmm5, 16(rp)
+       movdqu  %xmm6, 32(rp)
+       movdqu  %xmm7, 48(rp)
+
+       lea     64(%r11), tp
+       lea     64(rp), rp
+       add     $-8, j
+       jns     L(outer_top)
+L(outer_end):
+
+       test    $4, R8(n)
+       je      L(b0xx)
+L(b1xx):mov    nents, i
+       mov     tp, %r11
+       pxor    %xmm13, %xmm13
+       pxor    %xmm4, %xmm4
+       pxor    %xmm5, %xmm5
+       ALIGN(16)
+L(tp4):        movdqa  %xmm8, %xmm0
+       pcmpeqd %xmm13, %xmm0
+       paddd   %xmm9, %xmm13
+       movdqu  0(tp), %xmm2
+       movdqu  16(tp), %xmm3
+       pand    %xmm0, %xmm2
+       pand    %xmm0, %xmm3
+       por     %xmm2, %xmm4
+       por     %xmm3, %xmm5
+       lea     (tp,n,8), tp
+       add     $-1, i
+       jne     L(tp4)
+       movdqu  %xmm4, 0(rp)
+       movdqu  %xmm5, 16(rp)
+       lea     32(%r11), tp
+       lea     32(rp), rp
+
+L(b0xx):test   $2, R8(n)
+       je      L(b00x)
+L(b01x):mov    nents, i
+       mov     tp, %r11
+       pxor    %xmm13, %xmm13
+       pxor    %xmm4, %xmm4
+       ALIGN(16)
+L(tp2):        movdqa  %xmm8, %xmm0
+       pcmpeqd %xmm13, %xmm0
+       paddd   %xmm9, %xmm13
+       movdqu  0(tp), %xmm2
+       pand    %xmm0, %xmm2
+       por     %xmm2, %xmm4
+       lea     (tp,n,8), tp
+       add     $-1, i
+       jne     L(tp2)
+       movdqu  %xmm4, 0(rp)
+       lea     16(%r11), tp
+       lea     16(rp), rp
+
+L(b00x):test   $1, R8(n)
+       je      L(b000)
+L(b001):mov    nents, i
+       mov     tp, %r11
+       pxor    %xmm13, %xmm13
+       pxor    %xmm4, %xmm4
+       ALIGN(16)
+L(tp1):        movdqa  %xmm8, %xmm0
+       pcmpeqd %xmm13, %xmm0
+       paddd   %xmm9, %xmm13
+       movq    0(tp), %xmm2
+       pand    %xmm0, %xmm2
+       por     %xmm2, %xmm4
+       lea     (tp,n,8), tp
+       add     $-1, i
+       jne     L(tp1)
+       movq    %xmm4, 0(rp)
+
+L(b000):FUNC_EXIT()
+       ret
+EPILOGUE()
index 1e268f1643928eccaae8fef41eb4c1beda9992a4..1b3f4e48be895ce8c6b6c216cc767920c53eca1f 100644 (file)
@@ -7,22 +7,33 @@
    THEY'RE ALMOST CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR
    COMPLETELY IN FUTURE GNU MP RELEASES.
 
-Copyright 2003, 2004, 2009, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2003, 2004, 2009, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 printf */
 #include <stdlib.h>   /* for getenv */
@@ -34,9 +45,6 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 /* Change this to "#define TRACE(x) x" for some traces. */
 #define TRACE(x)
 
-/* Change this to 1 to take the cpuid from GMP_CPU_TYPE env var. */
-#define WANT_FAKE_CPUID  0
-
 
 /* fat_entry.asm */
 long __gmpn_cpuid (char [12], int);
@@ -48,7 +56,6 @@ long __gmpn_cpuid (char [12], int);
    as per config.guess/config.sub.  */
 
 #define __gmpn_cpuid            fake_cpuid
-#define __gmpn_cpuid_available  fake_cpuid_available
 
 #define MAKE_FMS(family, model)                                                \
   ((((family) & 0xf) << 8) + (((family) & 0xff0) << 20)                        \
@@ -63,6 +70,7 @@ static struct {
   { "coreinhm",   "GenuineIntel", MAKE_FMS (6, 0x1a) },
   { "coreiwsm",   "GenuineIntel", MAKE_FMS (6, 0x25) },
   { "coreisbr",   "GenuineIntel", MAKE_FMS (6, 0x2a) },
+  { "coreihwl",   "GenuineIntel", MAKE_FMS (6, 0x3c) },
   { "atom",       "GenuineIntel", MAKE_FMS (6, 0x1c) },
   { "pentium4",   "GenuineIntel", MAKE_FMS (15, 3) },
 
@@ -70,6 +78,10 @@ static struct {
   { "k10",        "AuthenticAMD", MAKE_FMS (16, 0) },
   { "bobcat",     "AuthenticAMD", MAKE_FMS (20, 1) },
   { "bulldozer",  "AuthenticAMD", MAKE_FMS (21, 1) },
+  { "piledriver", "AuthenticAMD", MAKE_FMS (21, 2) },
+  { "steamroller","AuthenticAMD", MAKE_FMS (21, 0x30) },
+  { "excavator",  "AuthenticAMD", MAKE_FMS (21, 0x60) },
+  { "jaguar",     "AuthenticAMD", MAKE_FMS (22, 1) },
 
   { "nano",       "CentaurHauls", MAKE_FMS (6, 15) },
 };
@@ -95,14 +107,8 @@ fake_cpuid_lookup (void)
   abort ();
 }
 
-static int
-fake_cpuid_available (void)
-{
-  return fake_cpuid_table[fake_cpuid_lookup()].vendor[0] != '\0';
-}
-
 static long
-fake_cpuid (char dst[12], int id)
+fake_cpuid (char dst[12], unsigned int id)
 {
   int  i = fake_cpuid_lookup();
 
@@ -112,6 +118,13 @@ fake_cpuid (char dst[12], int id)
     return 0;
   case 1:
     return fake_cpuid_table[i].fms;
+  case 7:
+    dst[0] = 0xff;                             /* BMI1, AVX2, etc */
+    dst[1] = 0xff;                             /* BMI2, etc */
+    return 0;
+  case 0x80000001:
+    dst[4 + 29 / 8] = (1 << (29 % 8));         /* "long" mode */
+    return 0;
   default:
     printf ("fake_cpuid(): oops, unknown id %d\n", id);
     abort ();
@@ -130,6 +143,8 @@ struct cpuvec_t __gmpn_cpuvec = {
   __MPN(addmul_1_init),
   __MPN(addmul_2_init),
   __MPN(bdiv_dbm1c_init),
+  __MPN(cnd_add_n_init),
+  __MPN(cnd_sub_n_init),
   __MPN(com_init),
   __MPN(copyd_init),
   __MPN(copyi_init),
@@ -257,6 +272,8 @@ __gmpn_cpuvec_init (void)
            case 0x2c:          /* WSM Gulftown */
            case 0x2e:          /* NHM Beckton */
            case 0x2f:          /* WSM Eagleton */
+           case 0x37:          /* Atom Silvermont */
+           case 0x4d:          /* Atom Silvermont/Avoton */
              CPUVEC_SETUP_core2;
              CPUVEC_SETUP_coreinhm;
              break;
@@ -264,10 +281,26 @@ __gmpn_cpuvec_init (void)
            case 0x2a:          /* SB */
            case 0x2d:          /* SBC-EP */
            case 0x3a:          /* IBR */
-           case 0x3c:          /* Haswell */
+           case 0x3e:          /* IBR Ivytown */
+             CPUVEC_SETUP_core2;
+             CPUVEC_SETUP_coreinhm;
+             CPUVEC_SETUP_coreisbr;
+             break;
+           case 0x3c:          /* Haswell client */
+           case 0x3d:          /* Broadwell */
+           case 0x3f:          /* Haswell server */
+           case 0x45:          /* Haswell ULT */
+           case 0x46:          /* Crystal Well */
+           case 0x4f:          /* Broadwell server */
+           case 0x56:          /* Broadwell microserver */
              CPUVEC_SETUP_core2;
              CPUVEC_SETUP_coreinhm;
              CPUVEC_SETUP_coreisbr;
+             /* Some Haswells lack BMI2.  Let them appear as Sandybridges for
+                now.  */
+             __gmpn_cpuid (dummy_string, 7);
+             if ((dummy_string[0 + 8 / 8] & (1 << (8 % 8))) != 0)
+               CPUVEC_SETUP_coreihwl;
              break;
            }
          break;
@@ -284,7 +317,6 @@ __gmpn_cpuvec_init (void)
        case 0x0f:              /* k8 */
        case 0x11:              /* "fam 11h", mix of k8 and k10 */
        case 0x13:
-       case 0x16:
        case 0x17:
          CPUVEC_SETUP_k8;
          break;
@@ -296,12 +328,13 @@ __gmpn_cpuvec_init (void)
          break;
 
        case 0x14:              /* bobcat */
+       case 0x16:              /* jaguar */
          CPUVEC_SETUP_k8;
          CPUVEC_SETUP_k10;
          CPUVEC_SETUP_bobcat;
          break;
 
-       case 0x15:              /* bulldozer */
+       case 0x15:          /* bulldozer, piledriver, steamroller, excavator */
          CPUVEC_SETUP_k8;
          CPUVEC_SETUP_k10;
          CPUVEC_SETUP_bd1;
index 82849de53cc27cb79a1cf5dadca63ad338c73ff9..764e3d82f2bbce22dc481279fef5d9f1b8169fbc 100644 (file)
@@ -3,22 +3,33 @@ dnl  x86 fat binary entrypoints.
 dnl  Contributed to the GNU project by Kevin Ryde (original x86_32 code) and
 dnl  Torbjorn Granlund (port to x86_64)
 
-dnl  Copyright 2003, 2009, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2003, 2009, 2011-2014 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
-
-dnl  The GNU MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl
+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')
 
@@ -33,15 +44,16 @@ dnl  "instrument" profiling scheme anyway.
 define(`WANT_PROFILING',no)
 
 
-dnl  We define PIC_OR_DARWIN as a helper symbol, the use it for suppressing
-dnl  normal, fast call code, since that triggers problems on darwin.
-dnl
-dnl  FIXME: There might be a more elegant solution, adding less overhead.
+dnl  We define PRETEND_PIC as a helper symbol, the use it for suppressing
+dnl  normal, fast call code, since that triggers problems on Darwin and
+dnl  OpenBSD.
 
 ifdef(`DARWIN',
-`define(`PIC_OR_DARWIN')')
+`define(`PRETEND_PIC')')
+ifdef(`OPENBSD',
+`define(`PRETEND_PIC')')
 ifdef(`PIC',
-`define(`PIC_OR_DARWIN')')
+`define(`PRETEND_PIC')')
 
 ABI_SUPPORT(DOS64)
 ABI_SUPPORT(STD64)
@@ -81,7 +93,7 @@ EPILOGUE()
 ',
 `      ALIGN(ifdef(`PIC',16,8))
 `'PROLOGUE($1)
-ifdef(`PIC_OR_DARWIN',
+ifdef(`PRETEND_PIC',
 `      LEA(    GSYM_PREFIX`'__gmpn_cpuvec, %rax)
        jmp     *$2(%rax)
 ',`dnl non-PIC
@@ -160,7 +172,7 @@ IFSTD(`     push    %rsi    ')
        pop     %rdx
 IFSTD(`        pop     %rsi    ')
 IFSTD(`        pop     %rdi    ')
-ifdef(`PIC_OR_DARWIN',`
+ifdef(`PRETEND_PIC',`
        LEA(    GSYM_PREFIX`'__gmpn_cpuvec, %r10)
        jmp     *(%r10,%rax,8)
 ',`dnl non-PIC
@@ -171,7 +183,8 @@ ifdef(`PIC_OR_DARWIN',`
 C long __gmpn_cpuid (char dst[12], int id);
 C
 C This is called only 3 times, so just something simple and compact is fine.
-
+C
+C The rcx/ecx zeroing here is needed for the BMI2 check.
 
 define(`rp',  `%rdi')
 define(`idx', `%rsi')
@@ -180,6 +193,7 @@ PROLOGUE(__gmpn_cpuid)
        FUNC_ENTRY(2)
        mov     %rbx, %r8
        mov     R32(idx), R32(%rax)
+       xor     %ecx, %ecx
        cpuid
        mov     %ebx, (rp)
        mov     %edx, 4(rp)
index c71614d4a884531a18673ff3e4b10811006a25fe..005c893635f390451cad791ac56a4d4927dd8be5 100644 (file)
@@ -1,25 +1,36 @@
 /* Fat binary x86_64 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2009, 2011 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2003, 2009, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 
 /* mpn_divexact_1 is faster than mpn_divrem_1 at all sizes.  The only time
index a79359d11381fed5d31b8631be5e7a00445b6feb..4f149cc353cc5e8386bce725495aa530cf5cce08 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2003, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "mpn/generic/mod_1.c"
diff --git a/mpn/x86_64/fat/mul_basecase.c b/mpn/x86_64/fat/mul_basecase.c
new file mode 100644 (file)
index 0000000..d9eb471
--- /dev/null
@@ -0,0 +1,32 @@
+/* Fat binary fallback mpn_mul_basecase.
+
+Copyright 2012 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 "mpn/generic/mul_basecase.c"
diff --git a/mpn/x86_64/fat/mullo_basecase.c b/mpn/x86_64/fat/mullo_basecase.c
new file mode 100644 (file)
index 0000000..7f86be6
--- /dev/null
@@ -0,0 +1,32 @@
+/* Fat binary fallback mpn_mullo_basecase.
+
+Copyright 2012 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 "mpn/generic/mullo_basecase.c"
diff --git a/mpn/x86_64/fat/redc_1.c b/mpn/x86_64/fat/redc_1.c
new file mode 100644 (file)
index 0000000..0025403
--- /dev/null
@@ -0,0 +1,32 @@
+/* Fat binary fallback mpn_redc_1.
+
+Copyright 2012 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 "mpn/generic/redc_1.c"
index f29d65842ce900f265a895479cd174da83b88563..1932d583231f5709916775276b7e207298538be9 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "mpn/generic/redc_2.c"
diff --git a/mpn/x86_64/fat/sqr_basecase.c b/mpn/x86_64/fat/sqr_basecase.c
new file mode 100644 (file)
index 0000000..d1c5dcd
--- /dev/null
@@ -0,0 +1,32 @@
+/* Fat binary fallback mpn_sqr_basecase.
+
+Copyright 2012 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 "mpn/generic/sqr_basecase.c"
index a1fc3d93a551779cb05cc6abc85f736a7e2872e0..252d4174ebfdd9a05d387207d374bf97bf2ca28c 100644 (file)
@@ -3,23 +3,33 @@ 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, 2001, 2002, 2005, 2009, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 8171c04d3a6e9d5aa9d7047a44fa7c156384502d..0dea8c94cda96fd93009cbe1969e3945f49d3c99 100644 (file)
@@ -1,25 +1,35 @@
 /* AMD K8-K10 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 
 #define MOD_1_NORM_THRESHOLD                 0  /* always */
index 60b861a933184b37572b162ae419775066ee1615..cc79b89a2b35016ca41cb77bd32ad429f7955e36 100644 (file)
@@ -1,24 +1,34 @@
 dnl  AMD64 mpn_invert_limb -- Invert a normalized limb.
 
-dnl  Contributed to the GNU project by Torbjorn Granlund and Niels Möller.
+dnl  Contributed to the GNU project by Torbjorn Granlund and Niels Möller.
 
-dnl  Copyright 2004, 2007, 2008, 2009, 2011, 2012 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 2004, 2007-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index f3f8573f8d1f728e79a77e120ba60d9e8eee5d77..739d59e46cdc31088771ebbfbda9738cb90d0647 100644 (file)
@@ -2,23 +2,33 @@ dnl  Table used for mpn_invert_limb
 
 dnl  Contributed to the GNU project by Torbjorn Granlund and Niels Möller.
 
-dnl  Copyright 2004, 2007, 2008, 2009, 2011, 2012 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 2004, 2007-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -34,36 +44,7 @@ C Table entry X contains floor (0x7fd00 / (0x100 + X))
        ALIGN(2)
        GLOBL mpn_invert_limb_table
 mpn_invert_limb_table:
-       .value  0x7fd,0x7f5,0x7ed,0x7e5,0x7dd,0x7d5,0x7ce,0x7c6
-       .value  0x7bf,0x7b7,0x7b0,0x7a8,0x7a1,0x79a,0x792,0x78b
-       .value  0x784,0x77d,0x776,0x76f,0x768,0x761,0x75b,0x754
-       .value  0x74d,0x747,0x740,0x739,0x733,0x72c,0x726,0x720
-       .value  0x719,0x713,0x70d,0x707,0x700,0x6fa,0x6f4,0x6ee
-       .value  0x6e8,0x6e2,0x6dc,0x6d6,0x6d1,0x6cb,0x6c5,0x6bf
-       .value  0x6ba,0x6b4,0x6ae,0x6a9,0x6a3,0x69e,0x698,0x693
-       .value  0x68d,0x688,0x683,0x67d,0x678,0x673,0x66e,0x669
-       .value  0x664,0x65e,0x659,0x654,0x64f,0x64a,0x645,0x640
-       .value  0x63c,0x637,0x632,0x62d,0x628,0x624,0x61f,0x61a
-       .value  0x616,0x611,0x60c,0x608,0x603,0x5ff,0x5fa,0x5f6
-       .value  0x5f1,0x5ed,0x5e9,0x5e4,0x5e0,0x5dc,0x5d7,0x5d3
-       .value  0x5cf,0x5cb,0x5c6,0x5c2,0x5be,0x5ba,0x5b6,0x5b2
-       .value  0x5ae,0x5aa,0x5a6,0x5a2,0x59e,0x59a,0x596,0x592
-       .value  0x58e,0x58a,0x586,0x583,0x57f,0x57b,0x577,0x574
-       .value  0x570,0x56c,0x568,0x565,0x561,0x55e,0x55a,0x556
-       .value  0x553,0x54f,0x54c,0x548,0x545,0x541,0x53e,0x53a
-       .value  0x537,0x534,0x530,0x52d,0x52a,0x526,0x523,0x520
-       .value  0x51c,0x519,0x516,0x513,0x50f,0x50c,0x509,0x506
-       .value  0x503,0x500,0x4fc,0x4f9,0x4f6,0x4f3,0x4f0,0x4ed
-       .value  0x4ea,0x4e7,0x4e4,0x4e1,0x4de,0x4db,0x4d8,0x4d5
-       .value  0x4d2,0x4cf,0x4cc,0x4ca,0x4c7,0x4c4,0x4c1,0x4be
-       .value  0x4bb,0x4b9,0x4b6,0x4b3,0x4b0,0x4ad,0x4ab,0x4a8
-       .value  0x4a5,0x4a3,0x4a0,0x49d,0x49b,0x498,0x495,0x493
-       .value  0x490,0x48d,0x48b,0x488,0x486,0x483,0x481,0x47e
-       .value  0x47c,0x479,0x477,0x474,0x472,0x46f,0x46d,0x46a
-       .value  0x468,0x465,0x463,0x461,0x45e,0x45c,0x459,0x457
-       .value  0x455,0x452,0x450,0x44e,0x44b,0x449,0x447,0x444
-       .value  0x442,0x440,0x43e,0x43b,0x439,0x437,0x435,0x432
-       .value  0x430,0x42e,0x42c,0x42a,0x428,0x425,0x423,0x421
-       .value  0x41f,0x41d,0x41b,0x419,0x417,0x414,0x412,0x410
-       .value  0x40e,0x40c,0x40a,0x408,0x406,0x404,0x402,0x400
+forloop(i,256,512-1,dnl
+`      .value  eval(0x7fd00/i)
+')dnl
 ASM_END()
index bbbdbcd8248887cc1caf6129e5c2540a70b705d4..3d8e5c7ab12a17367073df93486bdf5fa1abd105 100644 (file)
@@ -3,19 +3,30 @@ dnl  AMD64 mpn_gcd_1.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d75cd255751d99465ef2cb15ea94b4ccb7dd498a..5881306a4018783602217efffab4c1eb45e6d7dc 100644 (file)
@@ -1,25 +1,35 @@
 /* AMD K10 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2012, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 #if 0
 #undef mpn_sublsh_n
@@ -28,6 +38,10 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
    : MPN(mpn_sublsh_n)(rp,up,vp,n,c))
 #endif
 
+/* 3200 MHz K10 Thuban */
+/* FFT tuning limit = 100000000 */
+/* Generated by tuneup.c, 2014-03-12, gcc 4.2 */
+
 #define MOD_1_NORM_THRESHOLD                 0  /* always */
 #define MOD_1_UNNORM_THRESHOLD               0  /* always */
 #define MOD_1N_TO_MOD_1_1_THRESHOLD          3
@@ -36,6 +50,8 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #define MOD_1_2_TO_MOD_1_4_THRESHOLD        28
 #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 DIVEXACT_1_THRESHOLD                 0  /* always (native) */
 #define BMOD_1_TO_MOD_1_THRESHOLD           15
@@ -43,172 +59,164 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #define MUL_TOOM22_THRESHOLD                28
 #define MUL_TOOM33_THRESHOLD                81
 #define MUL_TOOM44_THRESHOLD               242
-#define MUL_TOOM6H_THRESHOLD               418
+#define MUL_TOOM6H_THRESHOLD               369
 #define MUL_TOOM8H_THRESHOLD               478
 
 #define MUL_TOOM32_TO_TOOM43_THRESHOLD      97
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     155
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD     149
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD     154
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD     145
 #define MUL_TOOM42_TO_TOOM63_THRESHOLD     163
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD     226
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     142
 
 #define SQR_BASECASE_THRESHOLD               0  /* always (native) */
 #define SQR_TOOM2_THRESHOLD                 34
-#define SQR_TOOM3_THRESHOLD                113
-#define SQR_TOOM4_THRESHOLD                336
-#define SQR_TOOM6_THRESHOLD                557
-#define SQR_TOOM8_THRESHOLD                  0  /* always */
+#define SQR_TOOM3_THRESHOLD                114
+#define SQR_TOOM4_THRESHOLD                390
+#define SQR_TOOM6_THRESHOLD                446
+#define SQR_TOOM8_THRESHOLD                547
 
 #define MULMID_TOOM42_THRESHOLD             36
 
-#define MULMOD_BNM1_THRESHOLD               15
-#define SQRMOD_BNM1_THRESHOLD               18
+#define MULMOD_BNM1_THRESHOLD               17
+#define SQRMOD_BNM1_THRESHOLD               17
 
-#define MUL_FFT_MODF_THRESHOLD             525  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             570  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    570, 5}, {     21, 6}, {     11, 5}, {     23, 6}, \
-    {     25, 7}, {     13, 6}, {     27, 7}, {     15, 6}, \
-    {     31, 7}, {     25, 8}, {     13, 7}, {     29, 8}, \
-    {     15, 7}, {     31, 8}, {     17, 7}, {     35, 8}, \
+  { {    570, 5}, {     25, 6}, {     13, 5}, {     27, 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}, \
     {     23, 7}, {     47, 8}, {     25, 7}, {     51, 8}, \
-    {     29, 9}, {     15, 8}, {     37, 9}, {     19, 8}, \
+    {     29, 9}, {     15, 8}, {     35, 9}, {     19, 8}, \
     {     43, 9}, {     23, 8}, {     51, 9}, {     27, 8}, \
-    {     55,10}, {     15, 9}, {     43,10}, {     23, 9}, \
-    {     55,10}, {     31, 9}, {     63, 5}, {   1023, 4}, \
-    {   2431, 5}, {   1279, 6}, {    671, 7}, {    367, 8}, \
-    {    189, 9}, {     95, 8}, {    195, 9}, {    111,11}, \
-    {     31, 9}, {    131,10}, {     71, 9}, {    155,10}, \
-    {     79, 9}, {    159,10}, {     87,11}, {     47,10}, \
-    {    111,11}, {     63,10}, {    135,11}, {     79,10}, \
-    {    167,11}, {     95,10}, {    191,11}, {    111,12}, \
-    {     63,11}, {    143,10}, {    287,11}, {    159,10}, \
-    {    319,11}, {    175,12}, {     95,11}, {    207,13}, \
-    {     63,12}, {    127,11}, {    255,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,13}, {    127,12}, {    255,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,14}, \
-    {    127,13}, {    255,12}, {    543,11}, {   1087,12}, \
-    {    607,11}, {   1215,13}, {    319,12}, {    671,11}, \
-    {   1343,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}, {   1087,13}, {    575,12}, \
+    {     55,10}, {     15, 9}, {     31, 8}, {     63, 9}, \
+    {     43,10}, {     23, 9}, {     55,10}, {     31, 9}, \
+    {     67,10}, {     39, 9}, {     83,10}, {     47, 9}, \
+    {     95,10}, {     55,11}, {     31,10}, {     87,11}, \
+    {     47,10}, {    111,12}, {     31,11}, {     63,10}, \
+    {    135,11}, {     79,10}, {    167, 8}, {    671,11}, \
+    {    111,12}, {     63,11}, {    159,12}, {     95,11}, \
+    {    207,10}, {    415,13}, {     63,12}, {    127,11}, \
+    {    255,10}, {    511,11}, {    271,12}, {    159,11}, \
+    {    319,10}, {    639,11}, {    335,10}, {    671,11}, \
+    {    367,12}, {    191,11}, {    415,12}, {    223,13}, \
+    {    127,12}, {    255,11}, {    543,12}, {    287,11}, \
+    {    575,10}, {   1151,11}, {    607,10}, {   1215,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,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,15}, {    255,14}, {    511,13}, {   1087,12}, \
     {   2175,13}, {   1215,14}, {    639,13}, {   1471,14}, \
-    {    767,13}, {   1663,14}, {    895,13}, {   1855,15}, \
+    {    767,13}, {   1727,14}, {    895,13}, {   1855,15}, \
     {    511,14}, {   1023,13}, {   2175,14}, {   1151,13}, \
-    {   2431,14}, {   1279,13}, {   2687,14}, {   1407,15}, \
+    {   2431,14}, {   1279,13}, {   2559,14}, {   1407,15}, \
     {    767,14}, {   1535,13}, {   3071,14}, {   1791,16}, \
     {    511,15}, {   1023,14}, {   2431,15}, {   1279,14}, \
     {   2815,15}, {   1535,14}, {   3199,15}, {   1791,14}, \
-    {   3583,16}, {  65536,17}, { 131072,18}, { 262144,19}, \
+    {   3583,16}, {   1023,15}, {   2047,14}, {   4223,15}, \
+    {   2303,14}, {   4863,15}, {   2559,14}, {   5247,15}, \
+    {   2815,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                 7552
+#define MUL_FFT_TABLE3_SIZE 169
+#define MUL_FFT_THRESHOLD                 7808
 
-#define SQR_FFT_MODF_THRESHOLD             444  /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD             448  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    460, 5}, {     21, 6}, {     11, 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}, \
-    {     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}, \
-    {     55,11}, {     15,10}, {     31, 9}, {     71,10}, \
-    {     39, 9}, {     83,10}, {     47, 6}, {    767, 4}, \
-    {   3263, 5}, {   1727, 4}, {   3455, 5}, {   1791, 6}, \
-    {    927, 7}, {    479, 6}, {    959, 7}, {    511, 8}, \
-    {    271, 9}, {    147,10}, {     87,11}, {     47,10}, \
-    {     95,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,10}, {    303,11}, \
-    {    159,12}, {     95,11}, {    191,10}, {    383, 9}, \
+  { {    448, 5}, {     21, 6}, {     11, 5}, {     23, 6}, \
+    {     12, 5}, {     25, 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}, {     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}, {     65, 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}, \
+    {     95,10}, {    191,11}, {    111,12}, {     63,11}, \
+    {    127,10}, {    255,11}, {    143, 9}, {    575,10}, \
+    {    303, 9}, {    607,12}, {     95,11}, {    191, 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,12}, {    191,11}, {    383,10}, \
-    {    767,11}, {    415,10}, {    831,11}, {    447,13}, \
-    {    127,12}, {    255,11}, {    511,10}, {   1023,11}, \
-    {    543,12}, {    287,11}, {    575,10}, {   1151,11}, \
-    {    607,10}, {   1215,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}, \
-    {    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}, {    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}, {   1791,13}, {    959,15}, \
-    {    255,14}, {    511,13}, {   1087,12}, {   2175,13}, \
-    {   1215,14}, {    639,13}, {   1471,14}, {    767,13}, \
-    {   1663,14}, {    895,13}, {   1855,15}, {    511,14}, \
-    {   1023,13}, {   2175,14}, {   1151,13}, {   2303,14}, \
-    {   1279,13}, {   2559,14}, {   1407,15}, {    767,14}, \
-    {   1535,13}, {   3071,14}, {   1791,16}, {    511,15}, \
-    {   1023,14}, {   2303,15}, {   1279,14}, {   2687,15}, \
-    {   1535,14}, {   3199,15}, {   1791,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                 5248
+    {    127,11}, {    255,10}, {    543, 9}, {   1087,10}, \
+    {    575,12}, {    159,11}, {    319,10}, {    639,11}, \
+    {    335,10}, {    671,11}, {    351,10}, {    703, 9}, \
+    {   1407,12}, {    191,11}, {    415,10}, {    831,12}, \
+    {    223,11}, {    447,13}, {    127,12}, {    255,11}, \
+    {    543,10}, {   1087,12}, {    287,11}, {    607,12}, \
+    {    319,11}, {    671,12}, {    351,11}, {    703,13}, \
+    {    191,12}, {    383,11}, {    767,10}, {   1535,12}, \
+    {    415,11}, {    863,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}, {    799,11}, {   1599,12}, {    863,13}, \
+    {    447,12}, {    927,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}, {   1727,13}, \
+    {    895,12}, {   1791,13}, {    959,15}, {    255,14}, \
+    {    511,13}, {   1087,12}, {   2175,13}, {   1215,14}, \
+    {    639,13}, {   1471,14}, {    767,13}, {   1663,14}, \
+    {    895,13}, {   1791,15}, {    511,14}, {   1023,13}, \
+    {   2175,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,14}, \
+    {   5247,16}, {  65536,17}, { 131072,18}, { 262144,19}, \
+    { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
+    {8388608,24} }
+#define SQR_FFT_TABLE3_SIZE 185
+#define SQR_FFT_THRESHOLD                 5568
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
 #define MULLO_DC_THRESHOLD                  61
-#define MULLO_MUL_N_THRESHOLD            15150
+#define MULLO_MUL_N_THRESHOLD            15604
 
 #define DC_DIV_QR_THRESHOLD                 56
-#define DC_DIVAPPR_Q_THRESHOLD             220
+#define DC_DIVAPPR_Q_THRESHOLD             218
 #define DC_BDIV_QR_THRESHOLD                52
-#define DC_BDIV_Q_THRESHOLD                 44
+#define DC_BDIV_Q_THRESHOLD                 42
 
-#define INV_MULMOD_BNM1_THRESHOLD           54
-#define INV_NEWTON_THRESHOLD               222
-#define INV_APPR_THRESHOLD                 214
+#define INV_MULMOD_BNM1_THRESHOLD           62
+#define INV_NEWTON_THRESHOLD               226
+#define INV_APPR_THRESHOLD                 220
 
-#define BINV_NEWTON_THRESHOLD              324
-#define REDC_1_TO_REDC_2_THRESHOLD          19
-#define REDC_2_TO_REDC_N_THRESHOLD          71
+#define BINV_NEWTON_THRESHOLD              327
+#define REDC_1_TO_REDC_2_THRESHOLD          51
+#define REDC_2_TO_REDC_N_THRESHOLD          66
 
-#define MU_DIV_QR_THRESHOLD               1718
-#define MU_DIVAPPR_Q_THRESHOLD            1652
+#define MU_DIV_QR_THRESHOLD               1752
+#define MU_DIVAPPR_Q_THRESHOLD            1718
 #define MUPI_DIV_QR_THRESHOLD              102
 #define MU_BDIV_QR_THRESHOLD              1528
-#define MU_BDIV_Q_THRESHOLD               1589
+#define MU_BDIV_Q_THRESHOLD               1718
 
-#define POWM_SEC_TABLE  2,23,322,2080
+#define POWM_SEC_TABLE  1,22,110,624,1985
 
 #define MATRIX22_STRASSEN_THRESHOLD         17
-#define HGCD_THRESHOLD                     144
-#define HGCD_APPR_THRESHOLD                175
-#define HGCD_REDUCE_THRESHOLD             3389
-#define GCD_DC_THRESHOLD                   501
-#define GCDEXT_DC_THRESHOLD                465
+#define HGCD_THRESHOLD                     147
+#define HGCD_APPR_THRESHOLD                181
+#define HGCD_REDUCE_THRESHOLD             3524
+#define GCD_DC_THRESHOLD                   622
+#define GCDEXT_DC_THRESHOLD                487
 #define JACOBI_BASE_METHOD                   4
 
 #define GET_STR_DC_THRESHOLD                14
 #define GET_STR_PRECOMPUTE_THRESHOLD        29
-#define SET_STR_DC_THRESHOLD               248
-#define SET_STR_PRECOMPUTE_THRESHOLD      1648
+#define SET_STR_DC_THRESHOLD               268
+#define SET_STR_PRECOMPUTE_THRESHOLD      1718
 
-#define FAC_DSC_THRESHOLD                 1105
-#define FAC_ODD_THRESHOLD                   30
+#define FAC_DSC_THRESHOLD                 1075
+#define FAC_ODD_THRESHOLD                   23
index ebfa70a56a3d7eaf30a50920dbfe8737da9d3c99..44b67b5e4e6619556ec3954ab5557bdb99a5b440 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD64 mpn_hamdist -- hamming distance.
 
-dnl  Copyright 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 72f02e4de09bd786e62792f0b0495fd22cdfde6d..a1cbc31f61bdc04fd688f05365431227cbc8d95f 100644 (file)
@@ -3,19 +3,30 @@ dnl  X86-64 mpn_lshift optimised for Intel Sandy Bridge.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 7e96f49eb6ac6aaa489938010dabcb56474ab804..ac90edb76b0538dc0b1d18d509e84563277e99d9 100644 (file)
@@ -3,19 +3,30 @@ dnl  X86-64 mpn_lshiftc optimised for Intel Sandy Bridge.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d266bd7bbc4d1a0e58df868c1d92640c33a7dab2..3814aeabf49cc0a2b224f15568083e0d8d269eee 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD64 mpn_popcount -- population count.
 
-dnl  Copyright 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 5d16361c0c8c0affcd32953b95808340e05bdfc3..4c1c0d4cde0869fb6efcc4a2708abd410eceaef5 100644 (file)
@@ -3,19 +3,30 @@ dnl  X86-64 mpn_rshift optimised for Intel Sandy Bridge.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/k10/sec_tabselect.asm b/mpn/x86_64/k10/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..e436034
--- /dev/null
@@ -0,0 +1,37 @@
+dnl  X86-64 mpn_sec_tabselect.
+
+dnl  Copyright 2012, 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')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_sec_tabselect)
+include_mpn(`x86_64/fastsse/sec_tabselect.asm')
index 395f699e845c1de7d894c3ac8b7568e1507e27da..ff3a1842fd058f70c630bba75618e0edc9752c3a 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD64 mpn_addlsh_n and mpn_rsblsh_n.  R = V2^k +- U.
 
-dnl  Copyright 2006, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2006, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/k8/div_qr_1n_pi1.asm b/mpn/x86_64/k8/div_qr_1n_pi1.asm
new file mode 100644 (file)
index 0000000..861402b
--- /dev/null
@@ -0,0 +1,249 @@
+dnl  x86-64 mpn_div_qr_1n_pi1
+dnl  -- Divide an mpn number by a normalized single-limb number,
+dnl     using a single-limb inverse.
+
+dnl  Contributed to the GNU project by Niels Möller
+
+dnl  Copyright 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              c/l
+C AMD K8,K9    11
+C AMD K10      11
+C AMD bull     16
+C AMD pile     14.25
+C AMD steam     ?
+C AMD bobcat   16
+C AMD jaguar    ?
+C Intel P4     47.5    poor
+C Intel core   28.5    very poor
+C Intel NHM    29      very poor
+C Intel SBR    16      poor
+C Intel IBR    13.5
+C Intel HWL    12
+C Intel BWL     ?
+C Intel atom   53      very poor
+C VIA nano     19
+
+
+C INPUT Parameters
+define(`QP', `%rdi')
+define(`UP', `%rsi')
+define(`UN_INPUT', `%rdx')
+define(`U1', `%rcx')   C Also in %rax
+define(`D', `%r8')
+define(`DINV', `%r9')
+
+C Invariants
+define(`B2', `%rbp')
+define(`B2md', `%rbx')
+
+C Variables
+define(`UN', `%r8')    C Overlaps D input
+define(`T', `%r10')
+define(`U0', `%r11')
+define(`U2', `%r12')
+define(`Q0', `%r13')
+define(`Q1', `%r14')
+define(`Q2', `%r15')
+
+ABI_SUPPORT(STD64)
+
+       ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_div_qr_1n_pi1)
+       FUNC_ENTRY(6)
+IFDOS(`        mov     56(%rsp), %r8   ')
+IFDOS(`        mov     64(%rsp), %r9   ')
+       dec     UN_INPUT
+       jnz     L(first)
+
+       C Just a single 2/1 division.
+       C T, U0 are allocated in scratch registers
+       lea     1(U1), T
+       mov     U1, %rax
+       mul     DINV
+       mov     (UP), U0
+       add     U0, %rax
+       adc     T, %rdx
+       mov     %rdx, T
+       imul    D, %rdx
+       sub     %rdx, U0
+       cmp     U0, %rax
+       lea     (U0, D), %rax
+       cmovnc  U0, %rax
+       sbb     $0, T
+       cmp     D, %rax
+       jc      L(single_div_done)
+       sub     D, %rax
+       add     $1, T
+L(single_div_done):
+       mov     T, (QP)
+       FUNC_EXIT
+       ret
+L(first):
+       C FIXME: Could delay some of these until we enter the loop.
+       push    %r15
+       push    %r14
+       push    %r13
+       push    %r12
+       push    %rbx
+       push    %rbp
+
+       mov     D, B2
+       imul    DINV, B2
+       neg     B2
+       mov     B2, B2md
+       sub     D, B2md
+
+       C D not needed until final reduction
+       push    D
+       mov     UN_INPUT, UN    C Clobbers D
+
+       mov     DINV, %rax
+       mul     U1
+       mov     %rax, Q0
+       add     U1, %rdx
+       mov     %rdx, T
+
+       mov     B2, %rax
+       mul     U1
+       mov     -8(UP, UN, 8), U0
+       mov     (UP, UN, 8), U1
+       mov     T, (QP, UN, 8)
+       add     %rax, U0
+       adc     %rdx, U1
+       sbb     U2, U2
+       dec     UN
+       mov     U1, %rax
+       jz      L(final)
+       mov     $0, R32(Q1)
+
+       ALIGN(16)
+
+       C Loop is 28 instructions, 30 K8/K10 decoder slots, should run
+       C in 10 cycles. At entry, %rax holds an extra copy of U1, Q1
+       C is zero, and carry holds an extra copy of U2.
+L(loop):
+       C {Q2, Q1, Q0} <-- DINV * U1 + B (Q0 + U2 DINV) + B^2 U2
+       C Remains to add in B (U1 + c)
+       cmovc   DINV, Q1
+       mov     U2, Q2
+       neg     Q2
+       mul     DINV
+       add     %rdx, Q1
+       adc     $0, Q2
+       add     Q0, Q1
+       mov     %rax, Q0
+       mov     B2, %rax
+       lea     (B2md, U0), T
+       adc     $0, Q2
+
+       C {U2, U1, U0} <-- (U0 + U2 B2 -c U) B + U1 B2 + u
+       mul     U1
+       and     B2, U2
+       add     U2, U0
+       cmovnc  U0, T
+
+       C {QP+UN, ...} <-- {QP+UN, ...} + {Q2, Q1} + U1 + c
+       adc     U1, Q1
+       mov     -8(UP, UN, 8), U0
+       adc     Q2, 8(QP, UN, 8)
+       jc      L(q_incr)
+L(q_incr_done):
+       add     %rax, U0
+       mov     T, %rax
+       adc     %rdx, %rax
+       mov     Q1, (QP, UN, 8)
+       mov     $0, R32(Q1)
+       sbb     U2, U2
+       dec     UN
+       mov     %rax, U1
+       jnz     L(loop)
+
+L(final):
+       pop     D
+
+       mov     U2, Q1
+       and     D, U2
+       sub     U2, %rax
+       neg     Q1
+
+       mov     %rax, U1
+       sub     D, %rax
+       cmovc   U1, %rax
+       sbb     $-1, Q1
+
+       lea     1(%rax), T
+       mul     DINV
+       add     U0, %rax
+       adc     T, %rdx
+       mov     %rdx, T
+       imul    D, %rdx
+       sub     %rdx, U0
+       cmp     U0, %rax
+       lea     (U0, D), %rax
+       cmovnc  U0, %rax
+       sbb     $0, T
+       cmp     D, %rax
+       jc      L(div_done)
+       sub     D, %rax
+       add     $1, T
+L(div_done):
+       add     T, Q0
+       mov     Q0, (QP)
+       adc     Q1, 8(QP)
+       jnc     L(done)
+L(final_q_incr):
+       addq    $1, 16(QP)
+       lea     8(QP), QP
+       jc      L(final_q_incr)
+
+L(done):
+       pop     %rbp
+       pop     %rbx
+       pop     %r12
+       pop     %r13
+       pop     %r14
+       pop     %r15
+       FUNC_EXIT
+       ret
+
+L(q_incr):
+       C U1 is not live, so use it for indexing
+       lea     16(QP, UN, 8), U1
+L(q_incr_loop):
+       addq    $1, (U1)
+       jnc     L(q_incr_done)
+       lea     8(U1), U1
+       jmp     L(q_incr_loop)
+EPILOGUE()
index fb157059d09dd0ec4c8545e7d7516e0affb6e1e0..df78c389234871b407778a521c456d3c150eab4b 100644 (file)
 /* AMD K8 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2012, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#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))
 
+/* 2500 MHz K8 Brisbane */
+/* 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          4
-#define MOD_1U_TO_MOD_1_1_THRESHOLD          2
+#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        35
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD      7
+#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           17
+#define BMOD_1_TO_MOD_1_THRESHOLD           16
 
-#define MUL_TOOM22_THRESHOLD                27
+#define MUL_TOOM22_THRESHOLD                28
 #define MUL_TOOM33_THRESHOLD                81
 #define MUL_TOOM44_THRESHOLD               242
-#define MUL_TOOM6H_THRESHOLD               369
+#define MUL_TOOM6H_THRESHOLD               345
 #define MUL_TOOM8H_THRESHOLD               482
 
 #define MUL_TOOM32_TO_TOOM43_THRESHOLD      97
 #define MUL_TOOM32_TO_TOOM53_THRESHOLD     153
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD     113
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD     187
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD     161
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD     175
 #define MUL_TOOM43_TO_TOOM54_THRESHOLD     166
 
 #define SQR_BASECASE_THRESHOLD               0  /* always (native) */
 #define SQR_TOOM2_THRESHOLD                 34
-#define SQR_TOOM3_THRESHOLD                115
+#define SQR_TOOM3_THRESHOLD                129
 #define SQR_TOOM4_THRESHOLD                527
-#define SQR_TOOM6_THRESHOLD                587
+#define SQR_TOOM6_THRESHOLD                562
 #define SQR_TOOM8_THRESHOLD                  0  /* always */
 
 #define MULMID_TOOM42_THRESHOLD             36
 
 #define MULMOD_BNM1_THRESHOLD               18
-#define SQRMOD_BNM1_THRESHOLD               19
+#define SQRMOD_BNM1_THRESHOLD               22
 
-#define MUL_FFT_MODF_THRESHOLD             642  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             654  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    570, 5}, {     21, 6}, {     11, 5}, {     23, 6}, \
-    {     25, 7}, {     13, 6}, {     27, 7}, {     15, 6}, \
-    {     31, 7}, {     25, 8}, {     13, 7}, {     29, 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}, {     37, 9}, {     19, 8}, \
-    {     43, 9}, {     23, 8}, {     51, 9}, {     27, 8}, \
-    {     55,10}, {     15, 9}, {     43,10}, {     23, 9}, \
-    {     55,10}, {     31, 9}, {     63, 5}, {   1023, 4}, \
-    {   2431, 5}, {   1279, 6}, {    671, 7}, {    367, 8}, \
-    {    189, 9}, {     95, 8}, {    195, 9}, {    111,11}, \
-    {     31, 9}, {    131,10}, {     71, 9}, {    155,10}, \
-    {     79, 9}, {    159,10}, {     87,11}, {     47,10}, \
-    {    111,11}, {     63,10}, {    135,11}, {     79,10}, \
-    {    167,11}, {     95,10}, {    191,11}, {    111,12}, \
-    {     63,11}, {    143,10}, {    287,11}, {    159,10}, \
-    {    319,11}, {    175,12}, {     95,11}, {    207,13}, \
-    {     63,12}, {    127,11}, {    255,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,13}, {    127,12}, {    255,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,14}, \
-    {    127,13}, {    255,12}, {    543,11}, {   1087,12}, \
-    {    607,11}, {   1215,13}, {    319,12}, {    671,11}, \
-    {   1343,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}, {   1087,13}, {    575,12}, \
+  { {    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}, \
+    {     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}, \
-    {   1407,14}, {    383,13}, {    767,12}, {   1599,13}, \
+    {   1471,14}, {    383,13}, {    767,12}, {   1599,13}, \
     {    831,12}, {   1663,13}, {    895,12}, {   1791,13}, \
-    {    959,15}, {    255,14}, {    511,13}, {   1087,12}, \
+    {    959,12}, {   1919,14}, {    511,13}, {   1087,12}, \
     {   2175,13}, {   1215,14}, {    639,13}, {   1471,14}, \
-    {    767,13}, {   1663,14}, {    895,13}, {   1855,15}, \
+    {    767,13}, {   1663,14}, {    895,13}, {   1919,15}, \
     {    511,14}, {   1023,13}, {   2175,14}, {   1151,13}, \
-    {   2431,14}, {   1279,13}, {   2687,14}, {   1407,15}, \
-    {    767,14}, {   1535,13}, {   3071,14}, {   1791,16}, \
-    {    511,15}, {   1023,14}, {   2431,15}, {   1279,14}, \
-    {   2815,15}, {   1535,14}, {   3199,15}, {   1791,14}, \
-    {   3583,16}, {  65536,17}, { 131072,18}, { 262144,19}, \
+    {   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 185
+#define MUL_FFT_TABLE3_SIZE 205
 #define MUL_FFT_THRESHOLD                11520
 
-#define SQR_FFT_MODF_THRESHOLD             565  /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD             570  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    460, 5}, {     21, 6}, {     11, 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}, \
+  { {    570, 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}, \
+    {     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}, \
-    {     55,11}, {     15,10}, {     31, 9}, {     71,10}, \
-    {     39, 9}, {     83,10}, {     47, 6}, {    767, 4}, \
-    {   3263, 5}, {   1727, 4}, {   3455, 5}, {   1791, 6}, \
-    {    927, 7}, {    479, 6}, {    959, 7}, {    511, 8}, \
-    {    271, 9}, {    147,10}, {     87,11}, {     47,10}, \
-    {     95,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,10}, {    303,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,12}, {    191,11}, {    383,10}, \
-    {    767,11}, {    415,10}, {    831,11}, {    447,13}, \
-    {    127,12}, {    255,11}, {    511,10}, {   1023,11}, \
-    {    543,12}, {    287,11}, {    575,10}, {   1151,11}, \
-    {    607,10}, {   1215,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}, \
-    {    511,11}, {   1023,12}, {    543,11}, {   1087,12}, \
-    {    575,11}, {   1151,12}, {    607,13}, {    319,12}, \
+    {     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}, \
+    {     31,11}, {     63,10}, {    143,11}, {     79,10}, \
+    {    167,11}, {     95,10}, {    199,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}, \
+    {    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}, \
+    {   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}, \
-    {    767,11}, {   1535,12}, {    799,11}, {   1599,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}, {   1599,13}, {    831,12}, \
-    {   1663,13}, {    895,12}, {   1791,13}, {    959,15}, \
-    {    255,14}, {    511,13}, {   1087,12}, {   2175,13}, \
+    {    799,11}, {   1599,12}, {    863,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}, \
+    {    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}, {   2175,14}, {   1151,13}, {   2303,14}, \
-    {   1279,13}, {   2559,14}, {   1407,15}, {    767,14}, \
-    {   1535,13}, {   3071,14}, {   1791,16}, {    511,15}, \
-    {   1023,14}, {   2303,15}, {   1279,14}, {   2687,15}, \
-    {   1535,14}, {   3199,15}, {   1791,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                 5568
+    {   1023,13}, {   2111,14}, {   1151,13}, {   2303,14}, \
+    {   1407,15}, {  32768,16}, {  65536,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 MULLO_BASECASE_THRESHOLD             0  /* always */
-#define MULLO_DC_THRESHOLD                  63
-#define MULLO_MUL_N_THRESHOLD            22239
+#define MULLO_DC_THRESHOLD                  61
+#define MULLO_MUL_N_THRESHOLD            22906
 
-#define DC_DIV_QR_THRESHOLD                 40
-#define DC_DIVAPPR_Q_THRESHOLD             252
+#define DC_DIV_QR_THRESHOLD                 51
+#define DC_DIVAPPR_Q_THRESHOLD             264
 #define DC_BDIV_QR_THRESHOLD                38
-#define DC_BDIV_Q_THRESHOLD                168
+#define DC_BDIV_Q_THRESHOLD                170
 
 #define INV_MULMOD_BNM1_THRESHOLD           67
 #define INV_NEWTON_THRESHOLD               246
-#define INV_APPR_THRESHOLD                 236
+#define INV_APPR_THRESHOLD                 244
 
 #define BINV_NEWTON_THRESHOLD              252
-#define REDC_1_TO_REDC_2_THRESHOLD          11
+#define REDC_1_TO_REDC_2_THRESHOLD          35
 #define REDC_2_TO_REDC_N_THRESHOLD          84
 
-#define MU_DIV_QR_THRESHOLD               1932
-#define MU_DIVAPPR_Q_THRESHOLD            1895
-#define MUPI_DIV_QR_THRESHOLD               99
-#define MU_BDIV_QR_THRESHOLD              1528
-#define MU_BDIV_Q_THRESHOLD               1787
+#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_BDIV_Q_THRESHOLD               1895
 
-#define POWM_SEC_TABLE  3,35,322,1926
+#define POWM_SEC_TABLE  2,16,194,904,2177
 
 #define MATRIX22_STRASSEN_THRESHOLD         21
-#define HGCD_THRESHOLD                     140
-#define HGCD_APPR_THRESHOLD                190
+#define HGCD_THRESHOLD                     148
+#define HGCD_APPR_THRESHOLD                185
 #define HGCD_REDUCE_THRESHOLD             4120
-#define GCD_DC_THRESHOLD                   606
-#define GCDEXT_DC_THRESHOLD                492
+#define GCD_DC_THRESHOLD                   562
+#define GCDEXT_DC_THRESHOLD                501
 #define JACOBI_BASE_METHOD                   4
 
-#define GET_STR_DC_THRESHOLD                18
-#define GET_STR_PRECOMPUTE_THRESHOLD        32
-#define SET_STR_DC_THRESHOLD               266
-#define SET_STR_PRECOMPUTE_THRESHOLD      2105
+#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 FAC_DSC_THRESHOLD                 1474
-#define FAC_ODD_THRESHOLD                   24
+#define FAC_DSC_THRESHOLD                 1240
+#define FAC_ODD_THRESHOLD                    0  /* always */
diff --git a/mpn/x86_64/k8/mul_basecase.asm b/mpn/x86_64/k8/mul_basecase.asm
new file mode 100644 (file)
index 0000000..ca2efb9
--- /dev/null
@@ -0,0 +1,469 @@
+dnl  AMD64 mpn_mul_basecase.
+
+dnl  Contributed to the GNU project by Torbjorn Granlund and David Harvey.
+
+dnl  Copyright 2008, 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/limb
+C AMD K8,K9     2.375
+C AMD K10       2.375
+C Intel P4     15-16
+C Intel core2   4.45
+C Intel corei   4.35
+C Intel atom    ?
+C VIA nano      4.5
+
+C The inner loops of this code are the result of running a code generation and
+C optimization tool suite written by David Harvey and Torbjorn Granlund.
+
+C TODO
+C  * Use fewer registers.  (how??? I can't see it -- david)
+C  * Avoid some "mov $0,r" and instead use "xor r,r".
+C  * Can the top of each L(addmul_outer_n) prologue be folded into the
+C    mul_1/mul_2 prologues, saving a LEA (%rip)? It would slow down the
+C    case where vn = 1 or 2; is it worth it?
+
+C INPUT PARAMETERS
+define(`rp',      `%rdi')
+define(`up',      `%rsi')
+define(`un_param',`%rdx')
+define(`vp',      `%rcx')
+define(`vn',      `%r8')
+
+define(`v0', `%r12')
+define(`v1', `%r9')
+
+define(`w0', `%rbx')
+define(`w1', `%r15')
+define(`w2', `%rbp')
+define(`w3', `%r10')
+
+define(`n',  `%r11')
+define(`outer_addr', `%r14')
+define(`un',  `%r13')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_mul_basecase)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8d  ')
+       push    %rbx
+       push    %rbp
+       push    %r12
+       push    %r13
+       push    %r14
+       push    %r15
+
+       xor     R32(un), R32(un)
+       mov     (up), %rax
+       mov     (vp), v0
+
+       sub     un_param, un            C rdx used by mul
+       mov     un, n
+       mov     R32(un_param), R32(w0)
+
+       lea     (rp,un_param,8), rp
+       lea     (up,un_param,8), up
+
+       mul     v0
+
+       test    $1, R8(vn)
+       jz      L(mul_2)
+
+C ===========================================================
+C     mul_1 for vp[0] if vn is odd
+
+L(mul_1):
+       and     $3, R32(w0)
+       jz      L(mul_1_prologue_0)
+       cmp     $2, R32(w0)
+       jc      L(mul_1_prologue_1)
+       jz      L(mul_1_prologue_2)
+
+L(mul_1_prologue_3):
+       add     $-1, n
+       lea     L(addmul_outer_3)(%rip), outer_addr
+       mov     %rax, w3
+       mov     %rdx, w0
+       jmp     L(mul_1_entry_3)
+
+L(mul_1_prologue_0):
+       mov     %rax, w2
+       mov     %rdx, w3                C note: already w0 == 0
+       lea     L(addmul_outer_0)(%rip), outer_addr
+       jmp     L(mul_1_entry_0)
+
+L(mul_1_prologue_1):
+       cmp     $-1, un
+       jne     2f
+       mov     %rax, -8(rp)
+       mov     %rdx, (rp)
+       jmp     L(ret)
+2:     add     $1, n
+       lea     L(addmul_outer_1)(%rip), outer_addr
+       mov     %rax, w1
+       mov     %rdx, w2
+       xor     R32(w3), R32(w3)
+       mov     (up,n,8), %rax
+       jmp     L(mul_1_entry_1)
+
+L(mul_1_prologue_2):
+       add     $-2, n
+       lea     L(addmul_outer_2)(%rip), outer_addr
+       mov     %rax, w0
+       mov     %rdx, w1
+       mov     24(up,n,8), %rax
+       xor     R32(w2), R32(w2)
+       xor     R32(w3), R32(w3)
+       jmp     L(mul_1_entry_2)
+
+
+       C this loop is 10 c/loop = 2.5 c/l on K8, for all up/rp alignments
+
+       ALIGN(16)
+L(mul_1_top):
+       mov     w0, -16(rp,n,8)
+       add     %rax, w1
+       mov     (up,n,8), %rax
+       adc     %rdx, w2
+L(mul_1_entry_1):
+       xor     R32(w0), R32(w0)
+       mul     v0
+       mov     w1, -8(rp,n,8)
+       add     %rax, w2
+       adc     %rdx, w3
+L(mul_1_entry_0):
+       mov     8(up,n,8), %rax
+       mul     v0
+       mov     w2, (rp,n,8)
+       add     %rax, w3
+       adc     %rdx, w0
+L(mul_1_entry_3):
+       mov     16(up,n,8), %rax
+       mul     v0
+       mov     w3, 8(rp,n,8)
+       xor     R32(w2), R32(w2)        C zero
+       mov     w2, w3                  C zero
+       add     %rax, w0
+       mov     24(up,n,8), %rax
+       mov     w2, w1                  C zero
+       adc     %rdx, w1
+L(mul_1_entry_2):
+       mul     v0
+       add     $4, n
+       js      L(mul_1_top)
+
+       mov     w0, -16(rp)
+       add     %rax, w1
+       mov     w1, -8(rp)
+       adc     %rdx, w2
+       mov     w2, (rp)
+
+       add     $-1, vn                 C vn -= 1
+       jz      L(ret)
+
+       mov     8(vp), v0
+       mov     16(vp), v1
+
+       lea     8(vp), vp               C vp += 1
+       lea     8(rp), rp               C rp += 1
+
+       jmp     *outer_addr
+
+C ===========================================================
+C     mul_2 for vp[0], vp[1] if vn is even
+
+       ALIGN(16)
+L(mul_2):
+       mov     8(vp), v1
+
+       and     $3, R32(w0)
+       jz      L(mul_2_prologue_0)
+       cmp     $2, R32(w0)
+       jz      L(mul_2_prologue_2)
+       jc      L(mul_2_prologue_1)
+
+L(mul_2_prologue_3):
+       lea     L(addmul_outer_3)(%rip), outer_addr
+       add     $2, n
+       mov     %rax, -16(rp,n,8)
+       mov     %rdx, w2
+       xor     R32(w3), R32(w3)
+       xor     R32(w0), R32(w0)
+       mov     -16(up,n,8), %rax
+       jmp     L(mul_2_entry_3)
+
+       ALIGN(16)
+L(mul_2_prologue_0):
+       add     $3, n
+       mov     %rax, w0
+       mov     %rdx, w1
+       xor     R32(w2), R32(w2)
+       mov     -24(up,n,8), %rax
+       lea     L(addmul_outer_0)(%rip), outer_addr
+       jmp     L(mul_2_entry_0)
+
+       ALIGN(16)
+L(mul_2_prologue_1):
+       mov     %rax, w3
+       mov     %rdx, w0
+       xor     R32(w1), R32(w1)
+       lea     L(addmul_outer_1)(%rip), outer_addr
+       jmp     L(mul_2_entry_1)
+
+       ALIGN(16)
+L(mul_2_prologue_2):
+       add     $1, n
+       lea     L(addmul_outer_2)(%rip), outer_addr
+       mov     $0, R32(w0)
+       mov     $0, R32(w1)
+       mov     %rax, w2
+       mov     -8(up,n,8), %rax
+       mov     %rdx, w3
+       jmp     L(mul_2_entry_2)
+
+       C this loop is 18 c/loop = 2.25 c/l on K8, for all up/rp alignments
+
+       ALIGN(16)
+L(mul_2_top):
+       mov     -32(up,n,8), %rax
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     -24(up,n,8), %rax
+       xor     R32(w2), R32(w2)
+       mul     v0
+       add     %rax, w0
+       mov     -24(up,n,8), %rax
+       adc     %rdx, w1
+       adc     $0, R32(w2)
+L(mul_2_entry_0):
+       mul     v1
+       add     %rax, w1
+       mov     w0, -24(rp,n,8)
+       adc     %rdx, w2
+       mov     -16(up,n,8), %rax
+       mul     v0
+       mov     $0, R32(w3)
+       add     %rax, w1
+       adc     %rdx, w2
+       mov     -16(up,n,8), %rax
+       adc     $0, R32(w3)
+       mov     $0, R32(w0)
+       mov     w1, -16(rp,n,8)
+L(mul_2_entry_3):
+       mul     v1
+       add     %rax, w2
+       mov     -8(up,n,8), %rax
+       adc     %rdx, w3
+       mov     $0, R32(w1)
+       mul     v0
+       add     %rax, w2
+       mov     -8(up,n,8), %rax
+       adc     %rdx, w3
+       adc     R32(w1), R32(w0)        C adc $0, w0
+L(mul_2_entry_2):
+       mul     v1
+       add     %rax, w3
+       mov     w2, -8(rp,n,8)
+       adc     %rdx, w0
+       mov     (up,n,8), %rax
+       mul     v0
+       add     %rax, w3
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+L(mul_2_entry_1):
+       add     $4, n
+       mov     w3, -32(rp,n,8)
+       js      L(mul_2_top)
+
+       mov     -32(up,n,8), %rax       C FIXME: n is constant
+       mul     v1
+       add     %rax, w0
+       mov     w0, (rp)
+       adc     %rdx, w1
+       mov     w1, 8(rp)
+
+       add     $-2, vn                 C vn -= 2
+       jz      L(ret)
+
+       mov     16(vp), v0
+       mov     24(vp), v1
+
+       lea     16(vp), vp              C vp += 2
+       lea     16(rp), rp              C rp += 2
+
+       jmp     *outer_addr
+
+
+C ===========================================================
+C     addmul_2 for remaining vp's
+
+       C in the following prologues, we reuse un to store the
+       C adjusted value of n that is reloaded on each iteration
+
+L(addmul_outer_0):
+       add     $3, un
+       lea     0(%rip), outer_addr
+
+       mov     un, n
+       mov     -24(up,un,8), %rax
+       mul     v0
+       mov     %rax, w0
+       mov     -24(up,un,8), %rax
+       mov     %rdx, w1
+       xor     R32(w2), R32(w2)
+       jmp     L(addmul_entry_0)
+
+L(addmul_outer_1):
+       mov     un, n
+       mov     (up,un,8), %rax
+       mul     v0
+       mov     %rax, w3
+       mov     (up,un,8), %rax
+       mov     %rdx, w0
+       xor     R32(w1), R32(w1)
+       jmp     L(addmul_entry_1)
+
+L(addmul_outer_2):
+       add     $1, un
+       lea     0(%rip), outer_addr
+
+       mov     un, n
+       mov     -8(up,un,8), %rax
+       mul     v0
+       xor     R32(w0), R32(w0)
+       mov     %rax, w2
+       xor     R32(w1), R32(w1)
+       mov     %rdx, w3
+       mov     -8(up,un,8), %rax
+       jmp     L(addmul_entry_2)
+
+L(addmul_outer_3):
+       add     $2, un
+       lea     0(%rip), outer_addr
+
+       mov     un, n
+       mov     -16(up,un,8), %rax
+       xor     R32(w3), R32(w3)
+       mul     v0
+       mov     %rax, w1
+       mov     -16(up,un,8), %rax
+       mov     %rdx, w2
+       jmp     L(addmul_entry_3)
+
+       C this loop is 19 c/loop = 2.375 c/l on K8, for all up/rp alignments
+
+       ALIGN(16)
+L(addmul_top):
+       add     w3, -32(rp,n,8)
+       adc     %rax, w0
+       mov     -24(up,n,8), %rax
+       adc     %rdx, w1
+       xor     R32(w2), R32(w2)
+       mul     v0
+       add     %rax, w0
+       mov     -24(up,n,8), %rax
+       adc     %rdx, w1
+       adc     R32(w2), R32(w2)        C adc $0, w2
+L(addmul_entry_0):
+       mul     v1
+       xor     R32(w3), R32(w3)
+       add     w0, -24(rp,n,8)
+       adc     %rax, w1
+       mov     -16(up,n,8), %rax
+       adc     %rdx, w2
+       mul     v0
+       add     %rax, w1
+       mov     -16(up,n,8), %rax
+       adc     %rdx, w2
+       adc     $0, R32(w3)
+L(addmul_entry_3):
+       mul     v1
+       add     w1, -16(rp,n,8)
+       adc     %rax, w2
+       mov     -8(up,n,8), %rax
+       adc     %rdx, w3
+       mul     v0
+       xor     R32(w0), R32(w0)
+       add     %rax, w2
+       adc     %rdx, w3
+       mov     $0, R32(w1)
+       mov     -8(up,n,8), %rax
+       adc     R32(w1), R32(w0)        C adc $0, w0
+L(addmul_entry_2):
+       mul     v1
+       add     w2, -8(rp,n,8)
+       adc     %rax, w3
+       adc     %rdx, w0
+       mov     (up,n,8), %rax
+       mul     v0
+       add     %rax, w3
+       mov     (up,n,8), %rax
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+L(addmul_entry_1):
+       mul     v1
+       add     $4, n
+       js      L(addmul_top)
+
+       add     w3, -8(rp)
+       adc     %rax, w0
+       mov     w0, (rp)
+       adc     %rdx, w1
+       mov     w1, 8(rp)
+
+       add     $-2, vn                 C vn -= 2
+       jz      L(ret)
+
+       lea     16(rp), rp              C rp += 2
+       lea     16(vp), vp              C vp += 2
+
+       mov     (vp), v0
+       mov     8(vp), v1
+
+       jmp     *outer_addr
+
+       ALIGN(16)
+L(ret):        pop     %r15
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+
+EPILOGUE()
diff --git a/mpn/x86_64/k8/mullo_basecase.asm b/mpn/x86_64/k8/mullo_basecase.asm
new file mode 100644 (file)
index 0000000..fa00f42
--- /dev/null
@@ -0,0 +1,436 @@
+dnl  AMD64 mpn_mullo_basecase.
+
+dnl  Contributed to the GNU project by Torbjorn Granlund.
+
+dnl  Copyright 2008, 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 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.
+
+C NOTES
+C   * There is a major stupidity in that we call mpn_mul_1 initially, for a
+C     large trip count.  Instead, we should start with mul_2 for any operand
+C     size congruence class.
+C   * Stop iterating addmul_2 earlier, falling into straight-line triangle code
+C     for the last 2-3 iterations.
+C   * Perhaps implement n=4 special code.
+C   * The reload of the outer loop jump address hurts branch prediction.
+C   * The addmul_2 loop ends with an MUL whose high part is not used upon loop
+C     exit.
+
+C INPUT PARAMETERS
+define(`rp',      `%rdi')
+define(`up',      `%rsi')
+define(`vp_param', `%rdx')
+define(`n',       `%rcx')
+
+define(`vp',   `%r11')
+define(`outer_addr', `%r8')
+define(`j',    `%r9')
+define(`v0',   `%r13')
+define(`v1',   `%r14')
+define(`w0',   `%rbx')
+define(`w1',   `%r15')
+define(`w2',   `%rbp')
+define(`w3',   `%r10')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_mullo_basecase)
+       FUNC_ENTRY(4)
+       cmp     $4, n
+       jge     L(gen)
+       mov     (up), %rax              C u0
+       mov     (vp_param), %r8         C v0
+
+       lea     L(tab)(%rip), %r9
+ifdef(`PIC',
+`      movslq  (%r9,%rcx,4), %r10
+       add     %r10, %r9
+       jmp     *%r9
+',`
+       jmp     *(%r9,n,8)
+')
+       JUMPTABSECT
+       ALIGN(8)
+L(tab):        JMPENT( L(tab), L(tab))                 C not allowed
+       JMPENT( L(1), L(tab))                   C 1
+       JMPENT( L(2), L(tab))                   C 2
+       JMPENT( L(3), L(tab))                   C 3
+dnl    JMPENT( L(0m4), L(tab))                 C 4
+dnl    JMPENT( L(1m4), L(tab))                 C 5
+dnl    JMPENT( L(2m4), L(tab))                 C 6
+dnl    JMPENT( L(3m4), L(tab))                 C 7
+dnl    JMPENT( L(0m4), L(tab))                 C 8
+dnl    JMPENT( L(1m4), L(tab))                 C 9
+dnl    JMPENT( L(2m4), L(tab))                 C 10
+dnl    JMPENT( L(3m4), L(tab))                 C 11
+       TEXT
+
+L(1):  imul    %r8, %rax
+       mov     %rax, (rp)
+       FUNC_EXIT()
+       ret
+
+L(2):  mov     8(vp_param), %r11
+       imul    %rax, %r11              C u0 x v1
+       mul     %r8                     C u0 x v0
+       mov     %rax, (rp)
+       imul    8(up), %r8              C u1 x v0
+       lea     (%r11, %rdx), %rax
+       add     %r8, %rax
+       mov     %rax, 8(rp)
+       FUNC_EXIT()
+       ret
+
+L(3):  mov     8(vp_param), %r9        C v1
+       mov     16(vp_param), %r11
+       mul     %r8                     C u0 x v0 -> <r1,r0>
+       mov     %rax, (rp)              C r0
+       mov     (up), %rax              C u0
+       mov     %rdx, %rcx              C r1
+       mul     %r9                     C u0 x v1 -> <r2,r1>
+       imul    8(up), %r9              C u1 x v1 -> r2
+       mov     16(up), %r10
+       imul    %r8, %r10               C u2 x v0 -> r2
+       add     %rax, %rcx
+       adc     %rdx, %r9
+       add     %r10, %r9
+       mov     8(up), %rax             C u1
+       mul     %r8                     C u1 x v0 -> <r2,r1>
+       add     %rax, %rcx
+       adc     %rdx, %r9
+       mov     %r11, %rax
+       imul    (up), %rax              C u0 x v2 -> r2
+       add     %rax, %r9
+       mov     %rcx, 8(rp)
+       mov     %r9, 16(rp)
+       FUNC_EXIT()
+       ret
+
+L(0m4):
+L(1m4):
+L(2m4):
+L(3m4):
+L(gen):        push    %rbx
+       push    %rbp
+       push    %r13
+       push    %r14
+       push    %r15
+
+       mov     (up), %rax
+       mov     (vp_param), v0
+       mov     vp_param, vp
+
+       lea     (rp,n,8), rp
+       lea     (up,n,8), up
+       neg     n
+
+       mul     v0
+
+       test    $1, R8(n)
+       jz      L(mul_2)
+
+L(mul_1):
+       lea     -8(rp), rp
+       lea     -8(up), up
+       test    $2, R8(n)
+       jnz     L(mul_1_prologue_3)
+
+L(mul_1_prologue_2):           C n = 7, 11, 15, ...
+       lea     -1(n), j
+       lea     L(addmul_outer_1)(%rip), outer_addr
+       mov     %rax, w0
+       mov     %rdx, w1
+       xor     R32(w2), R32(w2)
+       xor     R32(w3), R32(w3)
+       mov     16(up,n,8), %rax
+       jmp     L(mul_1_entry_2)
+
+L(mul_1_prologue_3):           C n = 5, 9, 13, ...
+       lea     1(n), j
+       lea     L(addmul_outer_3)(%rip), outer_addr
+       mov     %rax, w2
+       mov     %rdx, w3
+       xor     R32(w0), R32(w0)
+       jmp     L(mul_1_entry_0)
+
+       ALIGN(16)
+L(mul_1_top):
+       mov     w0, -16(rp,j,8)
+       add     %rax, w1
+       mov     (up,j,8), %rax
+       adc     %rdx, w2
+       xor     R32(w0), R32(w0)
+       mul     v0
+       mov     w1, -8(rp,j,8)
+       add     %rax, w2
+       adc     %rdx, w3
+L(mul_1_entry_0):
+       mov     8(up,j,8), %rax
+       mul     v0
+       mov     w2, (rp,j,8)
+       add     %rax, w3
+       adc     %rdx, w0
+       mov     16(up,j,8), %rax
+       mul     v0
+       mov     w3, 8(rp,j,8)
+       xor     R32(w2), R32(w2)        C zero
+       mov     w2, w3                  C zero
+       add     %rax, w0
+       mov     24(up,j,8), %rax
+       mov     w2, w1                  C zero
+       adc     %rdx, w1
+L(mul_1_entry_2):
+       mul     v0
+       add     $4, j
+       js      L(mul_1_top)
+
+       mov     w0, -16(rp)
+       add     %rax, w1
+       mov     w1, -8(rp)
+       adc     %rdx, w2
+
+       imul    (up), v0
+       add     v0, w2
+       mov     w2, (rp)
+
+       add     $1, n
+       jz      L(ret)
+
+       mov     8(vp), v0
+       mov     16(vp), v1
+
+       lea     16(up), up
+       lea     8(vp), vp
+       lea     24(rp), rp
+
+       jmp     *outer_addr
+
+
+L(mul_2):
+       mov     8(vp), v1
+       test    $2, R8(n)
+       jz      L(mul_2_prologue_3)
+
+       ALIGN(16)
+L(mul_2_prologue_1):
+       lea     0(n), j
+       mov     %rax, w3
+       mov     %rdx, w0
+       xor     R32(w1), R32(w1)
+       mov     (up,n,8), %rax
+       lea     L(addmul_outer_3)(%rip), outer_addr
+       jmp     L(mul_2_entry_1)
+
+       ALIGN(16)
+L(mul_2_prologue_3):
+       lea     2(n), j
+       mov     $0, R32(w3)
+       mov     %rax, w1
+       mov     (up,n,8), %rax
+       mov     %rdx, w2
+       lea     L(addmul_outer_1)(%rip), outer_addr
+       jmp     L(mul_2_entry_3)
+
+       ALIGN(16)
+L(mul_2_top):
+       mov     -32(up,j,8), %rax
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     -24(up,j,8), %rax
+       xor     R32(w2), R32(w2)
+       mul     v0
+       add     %rax, w0
+       mov     -24(up,j,8), %rax
+       adc     %rdx, w1
+       adc     $0, R32(w2)
+       mul     v1
+       add     %rax, w1
+       mov     w0, -24(rp,j,8)
+       adc     %rdx, w2
+       mov     -16(up,j,8), %rax
+       mul     v0
+       mov     $0, R32(w3)
+       add     %rax, w1
+       adc     %rdx, w2
+       mov     -16(up,j,8), %rax
+       adc     $0, R32(w3)
+L(mul_2_entry_3):
+       mov     $0, R32(w0)
+       mov     w1, -16(rp,j,8)
+       mul     v1
+       add     %rax, w2
+       mov     -8(up,j,8), %rax
+       adc     %rdx, w3
+       mov     $0, R32(w1)
+       mul     v0
+       add     %rax, w2
+       mov     -8(up,j,8), %rax
+       adc     %rdx, w3
+       adc     R32(w1), R32(w0)
+       mul     v1
+       add     %rax, w3
+       mov     w2, -8(rp,j,8)
+       adc     %rdx, w0
+       mov     (up,j,8), %rax
+       mul     v0
+       add     %rax, w3
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+L(mul_2_entry_1):
+       add     $4, j
+       mov     w3, -32(rp,j,8)
+       js      L(mul_2_top)
+
+       imul    -16(up), v1
+       add     v1, w0
+       imul    -8(up), v0
+       add     v0, w0
+       mov     w0, -8(rp)
+
+       add     $2, n
+       jz      L(ret)
+
+       mov     16(vp), v0
+       mov     24(vp), v1
+
+       lea     16(vp), vp
+       lea     16(rp), rp
+
+       jmp     *outer_addr
+
+
+L(addmul_outer_1):
+       lea     -2(n), j
+       mov     -16(up,n,8), %rax
+       mul     v0
+       mov     %rax, w3
+       mov     -16(up,n,8), %rax
+       mov     %rdx, w0
+       xor     R32(w1), R32(w1)
+       lea     L(addmul_outer_3)(%rip), outer_addr
+       jmp     L(addmul_entry_1)
+
+L(addmul_outer_3):
+       lea     0(n), j
+       mov     -16(up,n,8), %rax
+       xor     R32(w3), R32(w3)
+       mul     v0
+       mov     %rax, w1
+       mov     -16(up,n,8), %rax
+       mov     %rdx, w2
+       lea     L(addmul_outer_1)(%rip), outer_addr
+       jmp     L(addmul_entry_3)
+
+       ALIGN(16)
+L(addmul_top):
+       add     w3, -32(rp,j,8)
+       adc     %rax, w0
+       mov     -24(up,j,8), %rax
+       adc     %rdx, w1
+       xor     R32(w2), R32(w2)
+       mul     v0
+       add     %rax, w0
+       mov     -24(up,j,8), %rax
+       adc     %rdx, w1
+       adc     R32(w2), R32(w2)
+       mul     v1
+       xor     R32(w3), R32(w3)
+       add     w0, -24(rp,j,8)
+       adc     %rax, w1
+       mov     -16(up,j,8), %rax
+       adc     %rdx, w2
+       mul     v0
+       add     %rax, w1
+       mov     -16(up,j,8), %rax
+       adc     %rdx, w2
+       adc     $0, R32(w3)
+L(addmul_entry_3):
+       mul     v1
+       add     w1, -16(rp,j,8)
+       adc     %rax, w2
+       mov     -8(up,j,8), %rax
+       adc     %rdx, w3
+       mul     v0
+       xor     R32(w0), R32(w0)
+       add     %rax, w2
+       adc     %rdx, w3
+       mov     $0, R32(w1)
+       mov     -8(up,j,8), %rax
+       adc     R32(w1), R32(w0)
+       mul     v1
+       add     w2, -8(rp,j,8)
+       adc     %rax, w3
+       adc     %rdx, w0
+       mov     (up,j,8), %rax
+       mul     v0
+       add     %rax, w3
+       mov     (up,j,8), %rax
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+L(addmul_entry_1):
+       mul     v1
+       add     $4, j
+       js      L(addmul_top)
+
+       add     w3, -32(rp)
+       adc     %rax, w0
+
+       imul    -24(up), v0
+       add     v0, w0
+       add     w0, -24(rp)
+
+       add     $2, n
+       jns     L(ret)
+
+       lea     16(vp), vp
+
+       mov     (vp), v0
+       mov     8(vp), v1
+
+       lea     -16(up), up
+
+       jmp     *outer_addr
+
+L(ret):        pop     %r15
+       pop     %r14
+       pop     %r13
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
diff --git a/mpn/x86_64/k8/mulmid_basecase.asm b/mpn/x86_64/k8/mulmid_basecase.asm
new file mode 100644 (file)
index 0000000..86f1414
--- /dev/null
@@ -0,0 +1,559 @@
+dnl  AMD64 mpn_mulmid_basecase
+
+dnl  Contributed by David Harvey.
+
+dnl  Copyright 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/limb
+C K8,K9:        2.375  (2.5 when un - vn is "small")
+C K10:          ?
+C P4:           ?
+C P6-15:        ?
+
+C INPUT PARAMETERS
+define(`rp',      `%rdi')
+define(`up',      `%rsi')
+define(`un_param',`%rdx')
+define(`vp_param',`%rcx')
+define(`vn',      `%r8')
+
+define(`v0', `%r12')
+define(`v1', `%r9')
+
+define(`w0', `%rbx')
+define(`w1', `%rcx')
+define(`w2', `%rbp')
+define(`w3', `%r10')
+
+define(`n',  `%r11')
+define(`outer_addr', `%r14')
+define(`un',  `%r13')
+define(`vp',  `%r15')
+
+define(`vp_inner', `%r10')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_mulmid_basecase)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8d  ')
+       push    %rbx
+       push    %rbp
+       push    %r12
+       push    %r13
+       push    %r14
+       push    %r15
+
+       mov     vp_param, vp
+
+       C use un for row length (= un_param - vn + 1)
+       lea     1(un_param), un
+       sub     vn, un
+
+       lea     (rp,un,8), rp
+
+       cmp     $4, un          C TODO: needs tuning
+       jc      L(diagonal)
+
+       lea     (up,un_param,8), up
+
+       test    $1, vn
+       jz      L(mul_2)
+
+C ===========================================================
+C     mul_1 for vp[0] if vn is odd
+
+L(mul_1):
+       mov     R32(un), R32(w0)
+
+       neg     un
+       mov     (up,un,8), %rax
+       mov     (vp), v0
+       mul     v0
+
+       and     $-4, un         C round down to multiple of 4
+       mov     un, n
+
+       and     $3, R32(w0)
+       jz      L(mul_1_prologue_0)
+       cmp     $2, R32(w0)
+       jc      L(mul_1_prologue_1)
+       jz      L(mul_1_prologue_2)
+
+L(mul_1_prologue_3):
+       mov     %rax, w3
+       mov     %rdx, w0
+       lea     L(addmul_prologue_3)(%rip), outer_addr
+       jmp     L(mul_1_entry_3)
+
+       ALIGN(16)
+L(mul_1_prologue_0):
+       mov     %rax, w2
+       mov     %rdx, w3                C note already w0 == 0
+       lea     L(addmul_prologue_0)(%rip), outer_addr
+       jmp     L(mul_1_entry_0)
+
+       ALIGN(16)
+L(mul_1_prologue_1):
+       add     $4, n
+       mov     %rax, w1
+       mov     %rdx, w2
+       mov     $0, R32(w3)
+       mov     (up,n,8), %rax
+       lea     L(addmul_prologue_1)(%rip), outer_addr
+       jmp     L(mul_1_entry_1)
+
+       ALIGN(16)
+L(mul_1_prologue_2):
+       mov     %rax, w0
+       mov     %rdx, w1
+       mov     24(up,n,8), %rax
+       mov     $0, R32(w2)
+       mov     $0, R32(w3)
+       lea     L(addmul_prologue_2)(%rip), outer_addr
+       jmp     L(mul_1_entry_2)
+
+
+       C this loop is 10 c/loop = 2.5 c/l on K8
+
+       ALIGN(16)
+L(mul_1_top):
+       mov     w0, -16(rp,n,8)
+       add     %rax, w1
+       mov     (up,n,8), %rax
+       adc     %rdx, w2
+L(mul_1_entry_1):
+       mov     $0, R32(w0)
+       mul     v0
+       mov     w1, -8(rp,n,8)
+       add     %rax, w2
+       adc     %rdx, w3
+L(mul_1_entry_0):
+       mov     8(up,n,8), %rax
+       mul     v0
+       mov     w2, (rp,n,8)
+       add     %rax, w3
+       adc     %rdx, w0
+L(mul_1_entry_3):
+       mov     16(up,n,8), %rax
+       mul     v0
+       mov     w3, 8(rp,n,8)
+       mov     $0, R32(w2)             C zero
+       mov     w2, w3                  C zero
+       add     %rax, w0
+       mov     24(up,n,8), %rax
+       mov     w2, w1                  C zero
+       adc     %rdx, w1
+L(mul_1_entry_2):
+       mul     v0
+       add     $4, n
+       js      L(mul_1_top)
+
+       mov     w0, -16(rp)
+       add     %rax, w1
+       mov     w1, -8(rp)
+       mov     w2, 8(rp)               C zero last limb of output
+       adc     %rdx, w2
+       mov     w2, (rp)
+
+       dec     vn
+       jz      L(ret)
+
+       lea     -8(up), up
+       lea     8(vp), vp
+
+       mov     un, n
+       mov     (vp), v0
+       mov     8(vp), v1
+
+       jmp     *outer_addr
+
+C ===========================================================
+C     mul_2 for vp[0], vp[1] if vn is even
+
+       ALIGN(16)
+L(mul_2):
+       mov     R32(un), R32(w0)
+
+       neg     un
+       mov     -8(up,un,8), %rax
+       mov     (vp), v0
+       mov     8(vp), v1
+       mul     v1
+
+       and     $-4, un         C round down to multiple of 4
+       mov     un, n
+
+       and     $3, R32(w0)
+       jz      L(mul_2_prologue_0)
+       cmp     $2, R32(w0)
+       jc      L(mul_2_prologue_1)
+       jz      L(mul_2_prologue_2)
+
+L(mul_2_prologue_3):
+       mov     %rax, w1
+       mov     %rdx, w2
+       lea     L(addmul_prologue_3)(%rip), outer_addr
+       jmp     L(mul_2_entry_3)
+
+       ALIGN(16)
+L(mul_2_prologue_0):
+       mov     %rax, w0
+       mov     %rdx, w1
+       lea     L(addmul_prologue_0)(%rip), outer_addr
+       jmp     L(mul_2_entry_0)
+
+       ALIGN(16)
+L(mul_2_prologue_1):
+       mov     %rax, w3
+       mov     %rdx, w0
+       mov     $0, R32(w1)
+       lea     L(addmul_prologue_1)(%rip), outer_addr
+       jmp     L(mul_2_entry_1)
+
+       ALIGN(16)
+L(mul_2_prologue_2):
+       mov     %rax, w2
+       mov     %rdx, w3
+       mov     $0, R32(w0)
+       mov     16(up,n,8), %rax
+       lea     L(addmul_prologue_2)(%rip), outer_addr
+       jmp     L(mul_2_entry_2)
+
+
+       C this loop is 18 c/loop = 2.25 c/l on K8
+
+       ALIGN(16)
+L(mul_2_top):
+       mov     -8(up,n,8), %rax
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+L(mul_2_entry_0):
+       mov     $0, R32(w2)
+       mov     (up,n,8), %rax
+       mul     v0
+       add     %rax, w0
+       mov     (up,n,8), %rax
+       adc     %rdx, w1
+       adc     $0, R32(w2)
+       mul     v1
+       add     %rax, w1
+       mov     w0, (rp,n,8)
+       adc     %rdx, w2
+L(mul_2_entry_3):
+       mov     8(up,n,8), %rax
+       mul     v0
+       mov     $0, R32(w3)
+       add     %rax, w1
+       adc     %rdx, w2
+       mov     $0, R32(w0)
+       adc     $0, R32(w3)
+       mov     8(up,n,8), %rax
+       mov     w1, 8(rp,n,8)
+       mul     v1
+       add     %rax, w2
+       mov     16(up,n,8), %rax
+       adc     %rdx, w3
+L(mul_2_entry_2):
+       mov     $0, R32(w1)
+       mul     v0
+       add     %rax, w2
+       mov     16(up,n,8), %rax
+       adc     %rdx, w3
+       adc     $0, R32(w0)
+       mul     v1
+       add     %rax, w3
+       mov     w2, 16(rp,n,8)
+       adc     %rdx, w0
+L(mul_2_entry_1):
+       mov     24(up,n,8), %rax
+       mul     v0
+       add     %rax, w3
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+       add     $4, n
+       mov     w3, -8(rp,n,8)
+       jnz     L(mul_2_top)
+
+       mov     w0, (rp)
+       mov     w1, 8(rp)
+
+       sub     $2, vn
+       jz      L(ret)
+
+       lea     16(vp), vp
+       lea     -16(up), up
+
+       mov     un, n
+       mov     (vp), v0
+       mov     8(vp), v1
+
+       jmp     *outer_addr
+
+C ===========================================================
+C     addmul_2 for remaining vp's
+
+       ALIGN(16)
+L(addmul_prologue_0):
+       mov     -8(up,n,8), %rax
+       mul     v1
+       mov     %rax, w1
+       mov     %rdx, w2
+       mov     $0, R32(w3)
+       jmp     L(addmul_entry_0)
+
+       ALIGN(16)
+L(addmul_prologue_1):
+       mov     16(up,n,8), %rax
+       mul     v1
+       mov     %rax, w0
+       mov     %rdx, w1
+       mov     $0, R32(w2)
+       mov     24(up,n,8), %rax
+       jmp     L(addmul_entry_1)
+
+       ALIGN(16)
+L(addmul_prologue_2):
+       mov     8(up,n,8), %rax
+       mul     v1
+       mov     %rax, w3
+       mov     %rdx, w0
+       mov     $0, R32(w1)
+       jmp     L(addmul_entry_2)
+
+       ALIGN(16)
+L(addmul_prologue_3):
+       mov     (up,n,8), %rax
+       mul     v1
+       mov     %rax, w2
+       mov     %rdx, w3
+       mov     $0, R32(w0)
+       mov     $0, R32(w1)
+       jmp     L(addmul_entry_3)
+
+       C this loop is 19 c/loop = 2.375 c/l on K8
+
+       ALIGN(16)
+L(addmul_top):
+       mov     $0, R32(w3)
+       add     %rax, w0
+       mov     -8(up,n,8), %rax
+       adc     %rdx, w1
+       adc     $0, R32(w2)
+       mul     v1
+       add     w0, -8(rp,n,8)
+       adc     %rax, w1
+       adc     %rdx, w2
+L(addmul_entry_0):
+       mov     (up,n,8), %rax
+       mul     v0
+       add     %rax, w1
+       mov     (up,n,8), %rax
+       adc     %rdx, w2
+       adc     $0, R32(w3)
+       mul     v1
+       add     w1, (rp,n,8)
+       mov     $0, R32(w1)
+       adc     %rax, w2
+       mov     $0, R32(w0)
+       adc     %rdx, w3
+L(addmul_entry_3):
+       mov     8(up,n,8), %rax
+       mul     v0
+       add     %rax, w2
+       mov     8(up,n,8), %rax
+       adc     %rdx, w3
+       adc     $0, R32(w0)
+       mul     v1
+       add     w2, 8(rp,n,8)
+       adc     %rax, w3
+       adc     %rdx, w0
+L(addmul_entry_2):
+       mov     16(up,n,8), %rax
+       mul     v0
+       add     %rax, w3
+       mov     16(up,n,8), %rax
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+       mul     v1
+       add     w3, 16(rp,n,8)
+       nop                     C don't ask...
+       adc     %rax, w0
+       mov     $0, R32(w2)
+       mov     24(up,n,8), %rax
+       adc     %rdx, w1
+L(addmul_entry_1):
+       mul     v0
+       add     $4, n
+       jnz     L(addmul_top)
+
+       add     %rax, w0
+       adc     %rdx, w1
+       adc     $0, R32(w2)
+
+       add     w0, -8(rp)
+       adc     w1, (rp)
+       adc     w2, 8(rp)
+
+       sub     $2, vn
+       jz      L(ret)
+
+       lea     16(vp), vp
+       lea     -16(up), up
+
+       mov     un, n
+       mov     (vp), v0
+       mov     8(vp), v1
+
+       jmp     *outer_addr
+
+C ===========================================================
+C     accumulate along diagonals if un - vn is small
+
+       ALIGN(16)
+L(diagonal):
+       xor     R32(w0), R32(w0)
+       xor     R32(w1), R32(w1)
+       xor     R32(w2), R32(w2)
+
+       neg     un
+
+       mov     R32(vn), %eax
+       and     $3, %eax
+       jz      L(diag_prologue_0)
+       cmp     $2, %eax
+       jc      L(diag_prologue_1)
+       jz      L(diag_prologue_2)
+
+L(diag_prologue_3):
+       lea     -8(vp), vp
+       mov     vp, vp_inner
+       add     $1, vn
+       mov     vn, n
+       lea     L(diag_entry_3)(%rip), outer_addr
+       jmp     L(diag_entry_3)
+
+L(diag_prologue_0):
+       mov     vp, vp_inner
+       mov     vn, n
+       lea     0(%rip), outer_addr
+       mov     -8(up,n,8), %rax
+       jmp     L(diag_entry_0)
+
+L(diag_prologue_1):
+       lea     8(vp), vp
+       mov     vp, vp_inner
+       add     $3, vn
+       mov     vn, n
+       lea     0(%rip), outer_addr
+       mov     -8(vp_inner), %rax
+       jmp     L(diag_entry_1)
+
+L(diag_prologue_2):
+       lea     -16(vp), vp
+       mov     vp, vp_inner
+       add     $2, vn
+       mov     vn, n
+       lea     0(%rip), outer_addr
+       mov     16(vp_inner), %rax
+       jmp     L(diag_entry_2)
+
+
+       C this loop is 10 c/loop = 2.5 c/l on K8
+
+       ALIGN(16)
+L(diag_top):
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     -8(up,n,8), %rax
+       adc     $0, w2
+L(diag_entry_0):
+       mulq    (vp_inner)
+       add     %rax, w0
+       adc     %rdx, w1
+       adc     $0, w2
+L(diag_entry_3):
+       mov     -16(up,n,8), %rax
+       mulq    8(vp_inner)
+       add     %rax, w0
+       mov     16(vp_inner), %rax
+       adc     %rdx, w1
+       adc     $0, w2
+L(diag_entry_2):
+       mulq    -24(up,n,8)
+       add     %rax, w0
+       mov     24(vp_inner), %rax
+       adc     %rdx, w1
+       lea     32(vp_inner), vp_inner
+       adc     $0, w2
+L(diag_entry_1):
+       mulq    -32(up,n,8)
+       sub     $4, n
+       jnz     L(diag_top)
+
+       add     %rax, w0
+       adc     %rdx, w1
+       adc     $0, w2
+
+       mov     w0, (rp,un,8)
+
+       inc     un
+       jz      L(diag_end)
+
+       mov     vn, n
+       mov     vp, vp_inner
+
+       lea     8(up), up
+       mov     w1, w0
+       mov     w2, w1
+       xor     R32(w2), R32(w2)
+
+       jmp     *outer_addr
+
+L(diag_end):
+       mov     w1, (rp)
+       mov     w2, 8(rp)
+
+L(ret):        pop     %r15
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
diff --git a/mpn/x86_64/k8/redc_1.asm b/mpn/x86_64/k8/redc_1.asm
new file mode 100644 (file)
index 0000000..7453898
--- /dev/null
@@ -0,0 +1,590 @@
+dnl  X86-64 mpn_redc_1 optimised for AMD K8-K10.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2004, 2008, 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     ?
+C AMD K10       ?
+C AMD bull      ?
+C AMD pile      ?
+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 VIA nano      ?
+
+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 Torbjörn Granlund.
+
+C TODO
+C  * Micro-optimise, none performed thus far.
+C  * This looks different from other current redc_1.asm variants.  Consider
+C    adapting this to the mainstream style.
+C  * Is this code really faster than more approaches which compute q0 later?
+C    Is the use of a jump jump table faster?  Or is the edge of this due to the
+C    inlined add_n code?
+C  * Put initial m[0] x q0 computation in header.
+C  * Put basecases at the file's end, single them out before the pushes.
+
+define(`rp',          `%rdi')   C rcx
+define(`up',          `%rsi')   C rdx
+define(`mp_param',    `%rdx')   C r8
+define(`n',           `%rcx')   C r9
+define(`u0inv',       `%r8')    C stack
+
+define(`i',           `%r11')
+define(`nneg',        `%r12')
+define(`mp',          `%r13')
+define(`q0',          `%rbp')
+define(`vp',          `%rdx')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_redc_1)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8   ')
+       push    %rbp
+       mov     (up), q0                C up[0]
+       push    %rbx
+       imul    u0inv, q0               C first q0, for all execution paths
+       push    %r12
+       push    %r13
+       push    %r14
+       push    %r15
+
+       mov     n, nneg
+       neg     nneg
+       lea     (mp_param,n,8), mp      C mp += n
+       lea     -16(up,n,8), up         C up += n
+
+       mov     R32(n), R32(%rax)
+       and     $3, R32(%rax)
+       lea     4(%rax), %r9
+       cmp     $4, R32(n)
+       cmovg   %r9, %rax
+       lea     L(tab)(%rip), %r9
+ifdef(`PIC',`
+       movslq  (%r9,%rax,4), %rax
+       add     %r9, %rax
+       jmp     *%rax
+',`
+       jmp     *(%r9,%rax,8)
+')
+
+       JUMPTABSECT
+       ALIGN(8)
+L(tab):        JMPENT( L(0m4), L(tab))
+       JMPENT( L(1), L(tab))
+       JMPENT( L(2), L(tab))
+       JMPENT( L(3), L(tab))
+       JMPENT( L(0m4), L(tab))
+       JMPENT( L(1m4), L(tab))
+       JMPENT( L(2m4), L(tab))
+       JMPENT( L(3m4), L(tab))
+       TEXT
+
+       ALIGN(16)
+L(1):  mov     (mp_param), %rax
+       mul     q0
+       add     8(up), %rax
+       adc     16(up), %rdx
+       mov     %rdx, (rp)
+       mov     $0, R32(%rax)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+
+
+       ALIGN(16)
+L(2):  mov     (mp_param), %rax
+       mul     q0
+       xor     R32(%r14), R32(%r14)
+       mov     %rax, %r10
+       mov     -8(mp), %rax
+       mov     %rdx, %r9
+       mul     q0
+       add     (up), %r10
+       adc     %rax, %r9
+       adc     %rdx, %r14
+       add     8(up), %r9
+       adc     $0, %r14
+       mov     %r9, q0
+       imul    u0inv, q0
+       mov     -16(mp), %rax
+       mul     q0
+       xor     R32(%rbx), R32(%rbx)
+       mov     %rax, %r10
+       mov     -8(mp), %rax
+       mov     %rdx, %r11
+       mul     q0
+       add     %r9, %r10
+       adc     %rax, %r11
+       adc     %rdx, %rbx
+       add     16(up), %r11
+       adc     $0, %rbx
+       xor     R32(%rax), R32(%rax)
+       add     %r11, %r14
+       adc     24(up), %rbx
+       mov     %r14, (rp)
+       mov     %rbx, 8(rp)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+
+
+L(3):  mov     (mp_param), %rax
+       mul     q0
+       mov     %rax, %rbx
+       mov     %rdx, %r10
+       mov     -16(mp), %rax
+       mul     q0
+       xor     R32(%r9), R32(%r9)
+       xor     R32(%r14), R32(%r14)
+       add     -8(up), %rbx
+       adc     %rax, %r10
+       mov     -8(mp), %rax
+       adc     %rdx, %r9
+       mul     q0
+       add     (up), %r10
+       mov     %r10, (up)
+       adc     %rax, %r9
+       adc     %rdx, %r14
+       mov     %r10, q0
+       imul    u0inv, q0
+       add     %r9, 8(up)
+       adc     $0, %r14
+       mov     %r14, -8(up)
+
+       mov     -24(mp), %rax
+       mul     q0
+       mov     %rax, %rbx
+       mov     %rdx, %r10
+       mov     -16(mp), %rax
+       mul     q0
+       xor     R32(%r9), R32(%r9)
+       xor     R32(%r14), R32(%r14)
+       add     (up), %rbx
+       adc     %rax, %r10
+       mov     -8(mp), %rax
+       adc     %rdx, %r9
+       mul     q0
+       add     8(up), %r10
+       mov     %r10, 8(up)
+       adc     %rax, %r9
+       adc     %rdx, %r14
+       mov     %r10, q0
+       imul    u0inv, q0
+       add     %r9, 16(up)
+       adc     $0, %r14
+       mov     %r14, (up)
+
+       mov     -24(mp), %rax
+       mul     q0
+       mov     %rax, %rbx
+       mov     %rdx, %r10
+       mov     -16(mp), %rax
+       mul     q0
+       xor     R32(%r9), R32(%r9)
+       xor     R32(%r14), R32(%r14)
+       add     8(up), %rbx
+       adc     %rax, %r10
+       mov     -8(mp), %rax
+       adc     %rdx, %r9
+       mul     q0
+       add     16(up), %r10
+       adc     %rax, %r9
+       adc     %rdx, %r14
+       add     24(up), %r9
+       adc     $0, %r14
+
+       xor     R32(%rax), R32(%rax)
+       add     -8(up), %r10
+       adc     (up), %r9
+       adc     32(up), %r14
+       mov     %r10, (rp)
+       mov     %r9, 8(rp)
+       mov     %r14, 16(rp)
+       adc     R32(%rax), R32(%rax)
+       jmp     L(ret)
+
+
+       ALIGN(16)
+L(2m4):
+L(lo2):        mov     (mp,nneg,8), %rax
+       mul     q0
+       xor     R32(%r14), R32(%r14)
+       xor     R32(%rbx), R32(%rbx)
+       mov     %rax, %r10
+       mov     8(mp,nneg,8), %rax
+       mov     24(up,nneg,8), %r15
+       mov     %rdx, %r9
+       mul     q0
+       add     16(up,nneg,8), %r10
+       adc     %rax, %r9
+       mov     16(mp,nneg,8), %rax
+       adc     %rdx, %r14
+       mul     q0
+       mov     $0, R32(%r10)           C xor?
+       lea     2(nneg), i
+       add     %r9, %r15
+       imul    u0inv, %r15
+       jmp      L(e2)
+
+       ALIGN(16)
+L(li2):        add     %r10, (up,i,8)
+       adc     %rax, %r9
+       mov     (mp,i,8), %rax
+       adc     %rdx, %r14
+       xor     R32(%r10), R32(%r10)
+       mul     q0
+L(e2): add     %r9, 8(up,i,8)
+       adc     %rax, %r14
+       adc     %rdx, %rbx
+       mov     8(mp,i,8), %rax
+       mul     q0
+       add     %r14, 16(up,i,8)
+       adc     %rax, %rbx
+       adc     %rdx, %r10
+       mov     16(mp,i,8), %rax
+       mul     q0
+       add     %rbx, 24(up,i,8)
+       mov     $0, R32(%r14)           C zero
+       mov     %r14, %rbx              C zero
+       adc     %rax, %r10
+       mov     24(mp,i,8), %rax
+       mov     %r14, %r9               C zero
+       adc     %rdx, %r9
+       mul     q0
+       add     $4, i
+       js       L(li2)
+
+L(le2):        add     %r10, (up)
+       adc     %rax, %r9
+       adc     %r14, %rdx
+       add     %r9, 8(up)
+       adc     $0, %rdx
+       mov     %rdx, 16(up,nneg,8)     C up[0]
+       add     $8, up
+       mov     %r15, q0
+       dec     n
+       jnz     L(lo2)
+
+       mov     nneg, n
+       sar     $2, n
+       lea     32(up,nneg,8), up
+       lea     (up,nneg,8), vp
+
+       mov     -16(up), %r8
+       mov     -8(up), %r9
+       add     -16(vp), %r8
+       adc     -8(vp), %r9
+       mov     %r8, (rp)
+       mov     %r9, 8(rp)
+       lea     16(rp), rp
+       jmp     L(addx)
+
+
+       ALIGN(16)
+L(1m4):
+L(lo1):        mov     (mp,nneg,8), %rax
+       xor     %r9, %r9
+       xor     R32(%rbx), R32(%rbx)
+       mul     q0
+       mov     %rax, %r9
+       mov     8(mp,nneg,8), %rax
+       mov     24(up,nneg,8), %r15
+       mov     %rdx, %r14
+       mov     $0, R32(%r10)           C xor?
+       mul     q0
+       add     16(up,nneg,8), %r9
+       adc     %rax, %r14
+       adc     %rdx, %rbx
+       mov     16(mp,nneg,8), %rax
+       mul     q0
+       lea     1(nneg), i
+       add     %r14, %r15
+       imul    u0inv, %r15
+       jmp      L(e1)
+
+       ALIGN(16)
+L(li1):        add     %r10, (up,i,8)
+       adc     %rax, %r9
+       mov     (mp,i,8), %rax
+       adc     %rdx, %r14
+       xor     R32(%r10), R32(%r10)
+       mul     q0
+       add     %r9, 8(up,i,8)
+       adc     %rax, %r14
+       adc     %rdx, %rbx
+       mov     8(mp,i,8), %rax
+       mul     q0
+L(e1): add     %r14, 16(up,i,8)
+       adc     %rax, %rbx
+       adc     %rdx, %r10
+       mov     16(mp,i,8), %rax
+       mul     q0
+       add     %rbx, 24(up,i,8)
+       mov     $0, R32(%r14)           C zero
+       mov     %r14, %rbx              C zero
+       adc     %rax, %r10
+       mov     24(mp,i,8), %rax
+       mov     %r14, %r9               C zero
+       adc     %rdx, %r9
+       mul     q0
+       add     $4, i
+       js       L(li1)
+
+L(le1):        add     %r10, (up)
+       adc     %rax, %r9
+       adc     %r14, %rdx
+       add     %r9, 8(up)
+       adc     $0, %rdx
+       mov     %rdx, 16(up,nneg,8)     C up[0]
+       add     $8, up
+       mov     %r15, q0
+       dec     n
+       jnz     L(lo1)
+
+       mov     nneg, n
+       sar     $2, n
+       lea     24(up,nneg,8), up
+       lea     (up,nneg,8), vp
+
+       mov     -8(up), %r8
+       add     -8(vp), %r8
+       mov     %r8, (rp)
+       lea     8(rp), rp
+       jmp     L(addx)
+
+
+       ALIGN(16)
+L(0m4):
+L(lo0):        mov     (mp,nneg,8), %rax
+       mov     nneg, i
+       mul     q0
+       xor     R32(%r10), R32(%r10)
+       mov     %rax, %r14
+       mov     %rdx, %rbx
+       mov     8(mp,nneg,8), %rax
+       mov     24(up,nneg,8), %r15
+       mul     q0
+       add     16(up,nneg,8), %r14
+       adc     %rax, %rbx
+       adc     %rdx, %r10
+       add     %rbx, %r15
+       imul    u0inv, %r15
+       jmp     L(e0)
+
+       ALIGN(16)
+L(li0):        add     %r10, (up,i,8)
+       adc     %rax, %r9
+       mov     (mp,i,8), %rax
+       adc     %rdx, %r14
+       xor     R32(%r10), R32(%r10)
+       mul     q0
+       add     %r9, 8(up,i,8)
+       adc     %rax, %r14
+       adc     %rdx, %rbx
+       mov     8(mp,i,8), %rax
+       mul     q0
+       add     %r14, 16(up,i,8)
+       adc     %rax, %rbx
+       adc     %rdx, %r10
+L(e0): mov     16(mp,i,8), %rax
+       mul     q0
+       add     %rbx, 24(up,i,8)
+       mov     $0, R32(%r14)           C zero
+       mov     %r14, %rbx              C zero
+       adc     %rax, %r10
+       mov     24(mp,i,8), %rax
+       mov     %r14, %r9               C zero
+       adc     %rdx, %r9
+       mul     q0
+       add     $4, i
+       js       L(li0)
+
+L(le0):        add     %r10, (up)
+       adc     %rax, %r9
+       adc     %r14, %rdx
+       add     %r9, 8(up)
+       adc     $0, %rdx
+       mov     %rdx, 16(up,nneg,8)     C up[0]
+       add     $8, up
+       mov     %r15, q0
+       dec     n
+       jnz     L(lo0)
+
+       mov     nneg, n
+       sar     $2, n
+       clc
+       lea     16(up,nneg,8), up
+       lea     (up,nneg,8), vp
+       jmp     L(addy)
+
+
+       ALIGN(16)
+L(3m4):
+L(lo3):        mov     (mp,nneg,8), %rax
+       mul     q0
+       mov     %rax, %rbx
+       mov     %rdx, %r10
+       mov     8(mp,nneg,8), %rax
+       mov     24(up,nneg,8), %r15
+       mul     q0
+       add     16(up,nneg,8), %rbx     C result is zero, might carry
+       mov     $0, R32(%rbx)           C zero
+       mov     %rbx, %r14              C zero
+       adc     %rax, %r10
+       mov     16(mp,nneg,8), %rax
+       mov     %r14, %r9               C zero
+       adc     %rdx, %r9
+       add     %r10, %r15
+       mul     q0
+       lea     3(nneg), i
+       imul    u0inv, %r15
+C      jmp     L(li3)
+
+       ALIGN(16)
+L(li3):        add     %r10, (up,i,8)
+       adc     %rax, %r9
+       mov     (mp,i,8), %rax
+       adc     %rdx, %r14
+       xor     R32(%r10), R32(%r10)
+       mul     q0
+       add     %r9, 8(up,i,8)
+       adc     %rax, %r14
+       adc     %rdx, %rbx
+       mov     8(mp,i,8), %rax
+       mul     q0
+       add     %r14, 16(up,i,8)
+       adc     %rax, %rbx
+       adc     %rdx, %r10
+       mov     16(mp,i,8), %rax
+       mul     q0
+       add     %rbx, 24(up,i,8)
+       mov     $0, R32(%r14)           C zero
+       mov     %r14, %rbx              C zero
+       adc     %rax, %r10
+       mov     24(mp,i,8), %rax
+       mov     %r14, %r9               C zero
+       adc     %rdx, %r9
+       mul     q0
+       add     $4, i
+       js       L(li3)
+
+L(le3):        add     %r10, (up)
+       adc     %rax, %r9
+       adc     %r14, %rdx
+       add     %r9, 8(up)
+       adc     $0, %rdx
+       mov     %rdx, 16(up,nneg,8)     C up[0]
+       mov     %r15, q0
+       lea     8(up), up
+       dec     n
+       jnz     L(lo3)
+
+
+C ==== Addition code ====
+       mov     nneg, n
+       sar     $2, n
+       lea     40(up,nneg,8), up
+       lea     (up,nneg,8), vp
+
+       mov     -24(up), %r8
+       mov     -16(up), %r9
+       mov     -8(up), %r10
+       add     -24(vp), %r8
+       adc     -16(vp), %r9
+       adc     -8(vp), %r10
+       mov     %r8, (rp)
+       mov     %r9, 8(rp)
+       mov     %r10, 16(rp)
+       lea     24(rp), rp
+
+L(addx):inc    n
+       jz      L(ad3)
+
+L(addy):mov    (up), %r8
+       mov     8(up), %r9
+       inc     n
+       jmp     L(mid)
+
+C      ALIGN(16)
+L(al3):        adc     (vp), %r8
+       adc     8(vp), %r9
+       adc     16(vp), %r10
+       adc     24(vp), %r11
+       mov     %r8, (rp)
+       lea     32(up), up
+       mov     %r9, 8(rp)
+       mov     %r10, 16(rp)
+       inc     n
+       mov     %r11, 24(rp)
+       lea     32(vp), vp
+       mov     (up), %r8
+       mov     8(up), %r9
+       lea     32(rp), rp
+L(mid):        mov     16(up), %r10
+       mov     24(up), %r11
+       jnz     L(al3)
+
+L(ae3):        adc     (vp), %r8
+       adc     8(vp), %r9
+       adc     16(vp), %r10
+       adc     24(vp), %r11
+       mov     %r8, (rp)
+       mov     %r9, 8(rp)
+       mov     %r10, 16(rp)
+       mov     %r11, 24(rp)
+
+L(ad3):        mov     R32(n), R32(%rax)       C zero
+       adc     R32(%rax), R32(%rax)
+
+L(ret):        pop     %r15
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbx
+       pop     %rbp
+       FUNC_EXIT()
+       ret
+EPILOGUE()
diff --git a/mpn/x86_64/k8/sqr_basecase.asm b/mpn/x86_64/k8/sqr_basecase.asm
new file mode 100644 (file)
index 0000000..60cf945
--- /dev/null
@@ -0,0 +1,807 @@
+dnl  AMD64 mpn_sqr_basecase.
+
+dnl  Contributed to the GNU project by Torbjorn Granlund.
+
+dnl  Copyright 2008, 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 The inner loops of this code are the result of running a code generation and
+C optimization tool suite written by David Harvey and Torbjorn Granlund.
+
+C NOTES
+C   * There is a major stupidity in that we call mpn_mul_1 initially, for a
+C     large trip count.  Instead, we should follow the generic/sqr_basecase.c
+C     code which uses addmul_2s from the start, conditionally leaving a 1x1
+C     multiply to the end.  (In assembly code, one would stop invoking
+C     addmul_2s loops when perhaps 3x2s respectively a 2x2s remains.)
+C   * Another stupidity is in the sqr_diag_addlsh1 code.  It does not need to
+C     save/restore carry, instead it can propagate into the high product word.
+C   * Align more labels, should shave off a few cycles.
+C   * We can safely use 32-bit size operations, since operands with (2^32)
+C     limbs will lead to non-termination in practice.
+C   * The jump table could probably be optimized, at least for non-pic.
+C   * The special code for n <= 4 was quickly written.  It is probably too
+C     large and unnecessarily slow.
+C   * Consider combining small cases code so that the n=k-1 code jumps into the
+C     middle of the n=k code.
+C   * Avoid saving registers for small cases code.
+C   * Needed variables:
+C    n   r11  input size
+C    i   r8   work left, initially n
+C    j   r9   inner loop count
+C        r15  unused
+C    v0  r13
+C    v1  r14
+C    rp  rdi
+C    up  rsi
+C    w0  rbx
+C    w1  rcx
+C    w2  rbp
+C    w3  r10
+C    tp  r12
+C    lo  rax
+C    hi  rdx
+C        rsp
+
+C INPUT PARAMETERS
+define(`rp',     `%rdi')
+define(`up',     `%rsi')
+define(`n_param', `%rdx')
+
+define(`n',    `%r11')
+define(`tp',   `%r12')
+define(`i',    `%r8')
+define(`j',    `%r9')
+define(`v0',   `%r13')
+define(`v1',   `%r14')
+define(`w0',   `%rbx')
+define(`w1',   `%rcx')
+define(`w2',   `%rbp')
+define(`w3',   `%r10')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_sqr_basecase)
+       FUNC_ENTRY(3)
+       mov     R32(n_param), R32(%rcx)
+       mov     R32(n_param), R32(n)            C free original n register (rdx)
+
+       add     $-40, %rsp
+
+       and     $3, R32(%rcx)
+       cmp     $4, R32(n_param)
+       lea     4(%rcx), %r8
+
+       mov     %rbx, 32(%rsp)
+       mov     %rbp, 24(%rsp)
+       mov     %r12, 16(%rsp)
+       mov     %r13, 8(%rsp)
+       mov     %r14, (%rsp)
+
+       cmovg   %r8, %rcx
+
+       lea     L(tab)(%rip), %rax
+ifdef(`PIC',
+`      movslq  (%rax,%rcx,4), %r10
+       add     %r10, %rax
+       jmp     *%rax
+',`
+       jmp     *(%rax,%rcx,8)
+')
+       JUMPTABSECT
+       ALIGN(8)
+L(tab):        JMPENT( L(4), L(tab))
+       JMPENT( L(1), L(tab))
+       JMPENT( L(2), L(tab))
+       JMPENT( L(3), L(tab))
+       JMPENT( L(0m4), L(tab))
+       JMPENT( L(1m4), L(tab))
+       JMPENT( L(2m4), L(tab))
+       JMPENT( L(3m4), L(tab))
+       TEXT
+
+L(1):  mov     (up), %rax
+       mul     %rax
+       add     $40, %rsp
+       mov     %rax, (rp)
+       mov     %rdx, 8(rp)
+       FUNC_EXIT()
+       ret
+
+L(2):  mov     (up), %rax
+       mov     %rax, %r8
+       mul     %rax
+       mov     8(up), %r11
+       mov     %rax, (rp)
+       mov     %r11, %rax
+       mov     %rdx, %r9
+       mul     %rax
+       add     $40, %rsp
+       mov     %rax, %r10
+       mov     %r11, %rax
+       mov     %rdx, %r11
+       mul     %r8
+       xor     %r8, %r8
+       add     %rax, %r9
+       adc     %rdx, %r10
+       adc     %r8, %r11
+       add     %rax, %r9
+       mov     %r9, 8(rp)
+       adc     %rdx, %r10
+       mov     %r10, 16(rp)
+       adc     %r8, %r11
+       mov     %r11, 24(rp)
+       FUNC_EXIT()
+       ret
+
+L(3):  mov     (up), %rax
+       mov     %rax, %r10
+       mul     %rax
+       mov     8(up), %r11
+       mov     %rax, (rp)
+       mov     %r11, %rax
+       mov     %rdx, 8(rp)
+       mul     %rax
+       mov     16(up), %rcx
+       mov     %rax, 16(rp)
+       mov     %rcx, %rax
+       mov     %rdx, 24(rp)
+       mul     %rax
+       mov     %rax, 32(rp)
+       mov     %rdx, 40(rp)
+
+       mov     %r11, %rax
+       mul     %r10
+       mov     %rax, %r8
+       mov     %rcx, %rax
+       mov     %rdx, %r9
+       mul     %r10
+       xor     %r10, %r10
+       add     %rax, %r9
+       mov     %r11, %rax
+       mov     %r10, %r11
+       adc     %rdx, %r10
+
+       mul     %rcx
+       add     $40, %rsp
+       add     %rax, %r10
+       adc     %r11, %rdx
+       add     %r8, %r8
+       adc     %r9, %r9
+       adc     %r10, %r10
+       adc     %rdx, %rdx
+       adc     %r11, %r11
+       add     %r8, 8(rp)
+       adc     %r9, 16(rp)
+       adc     %r10, 24(rp)
+       adc     %rdx, 32(rp)
+       adc     %r11, 40(rp)
+       FUNC_EXIT()
+       ret
+
+L(4):  mov     (up), %rax
+       mov     %rax, %r11
+       mul     %rax
+       mov     8(up), %rbx
+       mov     %rax, (rp)
+       mov     %rbx, %rax
+       mov     %rdx, 8(rp)
+       mul     %rax
+       mov     %rax, 16(rp)
+       mov     %rdx, 24(rp)
+       mov     16(up), %rax
+       mul     %rax
+       mov     %rax, 32(rp)
+       mov     %rdx, 40(rp)
+       mov     24(up), %rax
+       mul     %rax
+       mov     %rax, 48(rp)
+       mov     %rbx, %rax
+       mov     %rdx, 56(rp)
+
+       mul     %r11
+       add     $32, %rsp
+       mov     %rax, %r8
+       mov     %rdx, %r9
+       mov     16(up), %rax
+       mul     %r11
+       xor     %r10, %r10
+       add     %rax, %r9
+       adc     %rdx, %r10
+       mov     24(up), %rax
+       mul     %r11
+       xor     %r11, %r11
+       add     %rax, %r10
+       adc     %rdx, %r11
+       mov     16(up), %rax
+       mul     %rbx
+       xor     %rcx, %rcx
+       add     %rax, %r10
+       adc     %rdx, %r11
+       adc     $0, %rcx
+       mov     24(up), %rax
+       mul     %rbx
+       pop     %rbx
+       add     %rax, %r11
+       adc     %rdx, %rcx
+       mov     16(up), %rdx
+       mov     24(up), %rax
+       mul     %rdx
+       add     %rax, %rcx
+       adc     $0, %rdx
+
+       add     %r8, %r8
+       adc     %r9, %r9
+       adc     %r10, %r10
+       adc     %r11, %r11
+       adc     %rcx, %rcx
+       mov     $0, R32(%rax)
+       adc     %rdx, %rdx
+
+       adc     %rax, %rax
+       add     %r8, 8(rp)
+       adc     %r9, 16(rp)
+       adc     %r10, 24(rp)
+       adc     %r11, 32(rp)
+       adc     %rcx, 40(rp)
+       adc     %rdx, 48(rp)
+       adc     %rax, 56(rp)
+       FUNC_EXIT()
+       ret
+
+
+L(0m4):
+       lea     -16(rp,n,8), tp         C point tp in middle of result operand
+       mov     (up), v0
+       mov     8(up), %rax
+       lea     (up,n,8), up            C point up at end of input operand
+
+       lea     -4(n), i
+C Function mpn_mul_1_m3(tp, up - i, i, up[-i - 1])
+       xor     R32(j), R32(j)
+       sub     n, j
+
+       mul     v0
+       xor     R32(w2), R32(w2)
+       mov     %rax, w0
+       mov     16(up,j,8), %rax
+       mov     %rdx, w3
+       jmp     L(L3)
+
+       ALIGN(16)
+L(mul_1_m3_top):
+       add     %rax, w2
+       mov     w3, (tp,j,8)
+       mov     (up,j,8), %rax
+       adc     %rdx, w1
+       xor     R32(w0), R32(w0)
+       mul     v0
+       xor     R32(w3), R32(w3)
+       mov     w2, 8(tp,j,8)
+       add     %rax, w1
+       adc     %rdx, w0
+       mov     8(up,j,8), %rax
+       mov     w1, 16(tp,j,8)
+       xor     R32(w2), R32(w2)
+       mul     v0
+       add     %rax, w0
+       mov     16(up,j,8), %rax
+       adc     %rdx, w3
+L(L3): xor     R32(w1), R32(w1)
+       mul     v0
+       add     %rax, w3
+       mov     24(up,j,8), %rax
+       adc     %rdx, w2
+       mov     w0, 24(tp,j,8)
+       mul     v0
+       add     $4, j
+       js      L(mul_1_m3_top)
+
+       add     %rax, w2
+       mov     w3, (tp)
+       adc     %rdx, w1
+       mov     w2, 8(tp)
+       mov     w1, 16(tp)
+
+       lea     eval(2*8)(tp), tp       C tp += 2
+       lea     -8(up), up
+       jmp     L(dowhile)
+
+
+L(1m4):
+       lea     8(rp,n,8), tp           C point tp in middle of result operand
+       mov     (up), v0                C u0
+       mov     8(up), %rax             C u1
+       lea     8(up,n,8), up           C point up at end of input operand
+
+       lea     -3(n), i
+C Function mpn_mul_2s_m0(tp, up - i, i, up - i - 1)
+       lea     -3(n), j
+       neg     j
+
+       mov     %rax, v1                C u1
+       mul     v0                      C u0 * u1
+       mov     %rdx, w1
+       xor     R32(w2), R32(w2)
+       mov     %rax, 8(rp)
+       jmp     L(m0)
+
+       ALIGN(16)
+L(mul_2_m0_top):
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     -24(up,j,8), %rax
+       mov     $0, R32(w2)
+       mul     v0
+       add     %rax, w0
+       mov     -24(up,j,8), %rax
+       adc     %rdx, w1
+       adc     $0, R32(w2)
+       mul     v1                      C v1 * u0
+       add     %rax, w1
+       mov     w0, -24(tp,j,8)
+       adc     %rdx, w2
+L(m0): mov     -16(up,j,8), %rax       C u2, u6 ...
+       mul     v0                      C u0 * u2
+       mov     $0, R32(w3)
+       add     %rax, w1
+       adc     %rdx, w2
+       mov     -16(up,j,8), %rax
+       adc     $0, R32(w3)
+       mov     $0, R32(w0)
+       mov     w1, -16(tp,j,8)
+       mul     v1
+       add     %rax, w2
+       mov     -8(up,j,8), %rax
+       adc     %rdx, w3
+       mov     $0, R32(w1)
+       mul     v0
+       add     %rax, w2
+       mov     -8(up,j,8), %rax
+       adc     %rdx, w3
+       adc     $0, R32(w0)
+       mul     v1
+       add     %rax, w3
+       mov     w2, -8(tp,j,8)
+       adc     %rdx, w0
+L(m2x):        mov     (up,j,8), %rax
+       mul     v0
+       add     %rax, w3
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+       add     $4, j
+       mov     -32(up,j,8), %rax
+       mov     w3, -32(tp,j,8)
+       js      L(mul_2_m0_top)
+
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     w0, -8(tp)
+       mov     w1, (tp)
+
+       lea     -16(up), up
+       lea     eval(3*8-24)(tp), tp    C tp += 3
+       jmp     L(dowhile_end)
+
+
+L(2m4):
+       lea     -16(rp,n,8), tp         C point tp in middle of result operand
+       mov     (up), v0
+       mov     8(up), %rax
+       lea     (up,n,8), up            C point up at end of input operand
+
+       lea     -4(n), i
+C Function mpn_mul_1_m1(tp, up - (i - 1), i - 1, up[-i])
+       lea     -2(n), j
+       neg     j
+
+       mul     v0
+       mov     %rax, w2
+       mov     (up,j,8), %rax
+       mov     %rdx, w1
+       jmp     L(L1)
+
+       ALIGN(16)
+L(mul_1_m1_top):
+       add     %rax, w2
+       mov     w3, (tp,j,8)
+       mov     (up,j,8), %rax
+       adc     %rdx, w1
+L(L1): xor     R32(w0), R32(w0)
+       mul     v0
+       xor     R32(w3), R32(w3)
+       mov     w2, 8(tp,j,8)
+       add     %rax, w1
+       adc     %rdx, w0
+       mov     8(up,j,8), %rax
+       mov     w1, 16(tp,j,8)
+       xor     R32(w2), R32(w2)
+       mul     v0
+       add     %rax, w0
+       mov     16(up,j,8), %rax
+       adc     %rdx, w3
+       xor     R32(w1), R32(w1)
+       mul     v0
+       add     %rax, w3
+       mov     24(up,j,8), %rax
+       adc     %rdx, w2
+       mov     w0, 24(tp,j,8)
+       mul     v0
+       add     $4, j
+       js      L(mul_1_m1_top)
+
+       add     %rax, w2
+       mov     w3, (tp)
+       adc     %rdx, w1
+       mov     w2, 8(tp)
+       mov     w1, 16(tp)
+
+       lea     eval(2*8)(tp), tp       C tp += 2
+       lea     -8(up), up
+       jmp     L(dowhile_mid)
+
+
+L(3m4):
+       lea     8(rp,n,8), tp           C point tp in middle of result operand
+       mov     (up), v0                C u0
+       mov     8(up), %rax             C u1
+       lea     8(up,n,8), up           C point up at end of input operand
+
+       lea     -5(n), i
+C Function mpn_mul_2s_m2(tp, up - i + 1, i - 1, up - i)
+       lea     -1(n), j
+       neg     j
+
+       mov     %rax, v1                C u1
+       mul     v0                      C u0 * u1
+       mov     %rdx, w3
+       xor     R32(w0), R32(w0)
+       xor     R32(w1), R32(w1)
+       mov     %rax, 8(rp)
+       jmp     L(m2)
+
+       ALIGN(16)
+L(mul_2_m2_top):
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     -24(up,j,8), %rax
+       mov     $0, R32(w2)
+       mul     v0
+       add     %rax, w0
+       mov     -24(up,j,8), %rax
+       adc     %rdx, w1
+       adc     $0, R32(w2)
+       mul     v1                      C v1 * u0
+       add     %rax, w1
+       mov     w0, -24(tp,j,8)
+       adc     %rdx, w2
+       mov     -16(up,j,8), %rax
+       mul     v0
+       mov     $0, R32(w3)
+       add     %rax, w1
+       adc     %rdx, w2
+       mov     -16(up,j,8), %rax
+       adc     $0, R32(w3)
+       mov     $0, R32(w0)
+       mov     w1, -16(tp,j,8)
+       mul     v1
+       add     %rax, w2
+       mov     -8(up,j,8), %rax
+       adc     %rdx, w3
+       mov     $0, R32(w1)
+       mul     v0
+       add     %rax, w2
+       mov     -8(up,j,8), %rax
+       adc     %rdx, w3
+       adc     $0, R32(w0)
+       mul     v1
+       add     %rax, w3
+       mov     w2, -8(tp,j,8)
+       adc     %rdx, w0
+L(m2): mov     (up,j,8), %rax
+       mul     v0
+       add     %rax, w3
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+       add     $4, j
+       mov     -32(up,j,8), %rax
+       mov     w3, -32(tp,j,8)
+       js      L(mul_2_m2_top)
+
+       mul     v1
+       add     %rax, w0
+       adc     %rdx, w1
+       mov     w0, -8(tp)
+       mov     w1, (tp)
+
+       lea     -16(up), up
+       jmp     L(dowhile_mid)
+
+L(dowhile):
+C Function mpn_addmul_2s_m2(tp, up - (i - 1), i - 1, up - i)
+       lea     4(i), j
+       neg     j
+
+       mov     16(up,j,8), v0
+       mov     24(up,j,8), v1
+       mov     24(up,j,8), %rax
+       mul     v0
+       xor     R32(w3), R32(w3)
+       add     %rax, 24(tp,j,8)
+       adc     %rdx, w3
+       xor     R32(w0), R32(w0)
+       xor     R32(w1), R32(w1)
+       jmp     L(am2)
+
+       ALIGN(16)
+L(addmul_2_m2_top):
+       add     w3, (tp,j,8)
+       adc     %rax, w0
+       mov     8(up,j,8), %rax
+       adc     %rdx, w1
+       mov     $0, R32(w2)
+       mul     v0
+       add     %rax, w0
+       mov     8(up,j,8), %rax
+       adc     %rdx, w1
+       adc     $0, R32(w2)
+       mul     v1                              C v1 * u0
+       add     w0, 8(tp,j,8)
+       adc     %rax, w1
+       adc     %rdx, w2
+       mov     16(up,j,8), %rax
+       mov     $0, R32(w3)
+       mul     v0                              C v0 * u1
+       add     %rax, w1
+       mov     16(up,j,8), %rax
+       adc     %rdx, w2
+       adc     $0, R32(w3)
+       mul     v1                              C v1 * u1
+       add     w1, 16(tp,j,8)
+       adc     %rax, w2
+       mov     24(up,j,8), %rax
+       adc     %rdx, w3
+       mul     v0
+       mov     $0, R32(w0)
+       add     %rax, w2
+       adc     %rdx, w3
+       mov     $0, R32(w1)
+       mov     24(up,j,8), %rax
+       adc     $0, R32(w0)
+       mul     v1
+       add     w2, 24(tp,j,8)
+       adc     %rax, w3
+       adc     %rdx, w0
+L(am2):        mov     32(up,j,8), %rax
+       mul     v0
+       add     %rax, w3
+       mov     32(up,j,8), %rax
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+       mul     v1
+       add     $4, j
+       js      L(addmul_2_m2_top)
+
+       add     w3, (tp)
+       adc     %rax, w0
+       adc     %rdx, w1
+       mov     w0, 8(tp)
+       mov     w1, 16(tp)
+
+       lea     eval(2*8)(tp), tp       C tp += 2
+
+       add     $-2, R32(i)             C i -= 2
+
+L(dowhile_mid):
+C Function mpn_addmul_2s_m0(tp, up - (i - 1), i - 1, up - i)
+       lea     2(i), j
+       neg     j
+
+       mov     (up,j,8), v0
+       mov     8(up,j,8), v1
+       mov     8(up,j,8), %rax
+       mul     v0
+       xor     R32(w1), R32(w1)
+       add     %rax, 8(tp,j,8)
+       adc     %rdx, w1
+       xor     R32(w2), R32(w2)
+       jmp     L(20)
+
+       ALIGN(16)
+L(addmul_2_m0_top):
+       add     w3, (tp,j,8)
+       adc     %rax, w0
+       mov     8(up,j,8), %rax
+       adc     %rdx, w1
+       mov     $0, R32(w2)
+       mul     v0
+       add     %rax, w0
+       mov     8(up,j,8), %rax
+       adc     %rdx, w1
+       adc     $0, R32(w2)
+       mul     v1                              C v1 * u0
+       add     w0, 8(tp,j,8)
+       adc     %rax, w1
+       adc     %rdx, w2
+L(20): mov     16(up,j,8), %rax
+       mov     $0, R32(w3)
+       mul     v0                              C v0 * u1
+       add     %rax, w1
+       mov     16(up,j,8), %rax
+       adc     %rdx, w2
+       adc     $0, R32(w3)
+       mul     v1                              C v1 * u1
+       add     w1, 16(tp,j,8)
+       adc     %rax, w2
+       mov     24(up,j,8), %rax
+       adc     %rdx, w3
+       mul     v0
+       mov     $0, R32(w0)
+       add     %rax, w2
+       adc     %rdx, w3
+       mov     $0, R32(w1)
+       mov     24(up,j,8), %rax
+       adc     $0, R32(w0)
+       mul     v1
+       add     w2, 24(tp,j,8)
+       adc     %rax, w3
+       adc     %rdx, w0
+       mov     32(up,j,8), %rax
+       mul     v0
+       add     %rax, w3
+       mov     32(up,j,8), %rax
+       adc     %rdx, w0
+       adc     $0, R32(w1)
+       mul     v1
+       add     $4, j
+       js      L(addmul_2_m0_top)
+
+       add     w3, (tp)
+       adc     %rax, w0
+       adc     %rdx, w1
+       mov     w0, 8(tp)
+       mov     w1, 16(tp)
+
+       lea     eval(2*8)(tp), tp       C tp += 2
+L(dowhile_end):
+
+       add     $-2, R32(i)             C i -= 2
+       jne     L(dowhile)
+
+C Function mpn_addmul_2s_2
+       mov     -16(up), v0
+       mov     -8(up), v1
+       mov     -8(up), %rax
+       mul     v0
+       xor     R32(w3), R32(w3)
+       add     %rax, -8(tp)
+       adc     %rdx, w3
+       xor     R32(w0), R32(w0)
+       xor     R32(w1), R32(w1)
+       mov     (up), %rax
+       mul     v0
+       add     %rax, w3
+       mov     (up), %rax
+       adc     %rdx, w0
+       mul     v1
+       add     w3, (tp)
+       adc     %rax, w0
+       adc     %rdx, w1
+       mov     w0, 8(tp)
+       mov     w1, 16(tp)
+
+C Function mpn_sqr_diag_addlsh1
+       lea     -4(n,n), j
+
+       mov     8(rp), %r11
+       lea     -8(up), up
+       lea     (rp,j,8), rp
+       neg     j
+       mov     (up,j,4), %rax
+       mul     %rax
+       test    $2, R8(j)
+       jnz     L(odd)
+
+L(evn):        add     %r11, %r11
+       sbb     R32(%rbx), R32(%rbx)            C save CF
+       add     %rdx, %r11
+       mov     %rax, (rp,j,8)
+       jmp     L(d0)
+
+L(odd):        add     %r11, %r11
+       sbb     R32(%rbp), R32(%rbp)            C save CF
+       add     %rdx, %r11
+       mov     %rax, (rp,j,8)
+       lea     -2(j), j
+       jmp     L(d1)
+
+       ALIGN(16)
+L(top):        mov     (up,j,4), %rax
+       mul     %rax
+       add     R32(%rbp), R32(%rbp)            C restore carry
+       adc     %rax, %r10
+       adc     %rdx, %r11
+       mov     %r10, (rp,j,8)
+L(d0): mov     %r11, 8(rp,j,8)
+       mov     16(rp,j,8), %r10
+       adc     %r10, %r10
+       mov     24(rp,j,8), %r11
+       adc     %r11, %r11
+       nop
+       sbb     R32(%rbp), R32(%rbp)            C save CF
+       mov     8(up,j,4), %rax
+       mul     %rax
+       add     R32(%rbx), R32(%rbx)            C restore carry
+       adc     %rax, %r10
+       adc     %rdx, %r11
+       mov     %r10, 16(rp,j,8)
+L(d1): mov     %r11, 24(rp,j,8)
+       mov     32(rp,j,8), %r10
+       adc     %r10, %r10
+       mov     40(rp,j,8), %r11
+       adc     %r11, %r11
+       sbb     R32(%rbx), R32(%rbx)            C save CF
+       add     $4, j
+       js      L(top)
+
+       mov     (up), %rax
+       mul     %rax
+       add     R32(%rbp), R32(%rbp)            C restore carry
+       adc     %rax, %r10
+       adc     %rdx, %r11
+       mov     %r10, (rp)
+       mov     %r11, 8(rp)
+       mov     16(rp), %r10
+       adc     %r10, %r10
+       sbb     R32(%rbp), R32(%rbp)            C save CF
+       neg     R32(%rbp)
+       mov     8(up), %rax
+       mul     %rax
+       add     R32(%rbx), R32(%rbx)            C restore carry
+       adc     %rax, %r10
+       adc     %rbp, %rdx
+       mov     %r10, 16(rp)
+       mov     %rdx, 24(rp)
+
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
index c6a7b1cba09966e40cbd8fa02a13e21bd9266b14..b277f58962441c2661fa0d3bf630072eccdb25aa 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD64 logops.
 
-dnl  Copyright 2004, 2005, 2006, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2004-2006, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d4c40a6073cfbc76e7c53203fed245f988225095..f368944b85d9d74a997e4f5525f95b9d48ebd76c 100644 (file)
@@ -2,21 +2,32 @@ dnl  AMD64 mpn_lshift -- mpn left shift.
 
 dnl  Copyright 2003, 2005, 2007, 2009, 2011, 2012 Free Software Foundation,
 dnl  Inc.
-dnl
-dnl  This file is part of the GNU MP Library.
 
+dnl  This file is part of the GNU MP Library.
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 03ae40a27b88d354a481cf19d2486b6d1bee0e07..c4ba04a173849cdcaa5ea98384573a1651895c4a 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD64 mpn_lshiftc -- mpn left shift with complement.
 
 dnl  Copyright 2003, 2005, 2006, 2009, 2011, 2012 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 2938b913a43d0b797f8c662468c8e2c05d932668..4d428c0bd25f298665d899bdfc23be8a18121761 100644 (file)
@@ -3,19 +3,30 @@ dnl  AMD64 mpn_lshsub_n.  R = 2^k(U - V).
 dnl  Copyright 2006, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/missing-call.m4 b/mpn/x86_64/missing-call.m4
new file mode 100644 (file)
index 0000000..c024f0e
--- /dev/null
@@ -0,0 +1,53 @@
+dnl  AMD64 MULX/ADX simulation support, function call version.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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/.
+
+
+define(`adox',`
+       push    $1
+       push    $2
+       call    __gmp_adox
+       pop     $2
+')
+
+define(`adcx',`
+       push    $1
+       push    $2
+       call    __gmp_adcx
+       pop     $2
+')
+
+define(`mulx',`
+       push    $1
+       call    __gmp_mulx
+       pop     $2
+       pop     $3
+')
diff --git a/mpn/x86_64/missing-inline.m4 b/mpn/x86_64/missing-inline.m4
new file mode 100644 (file)
index 0000000..bd1df13
--- /dev/null
@@ -0,0 +1,100 @@
+dnl  AMD64 MULX/ADX simulation support, inline version.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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/.
+
+
+define(`adox',`
+       push    $2
+       push    %rcx
+       push    %rbx
+       push    %rax
+       mov     $1, %rcx
+       pushfq
+       pushfq
+C copy 0(%rsp):11 to 0(%rsp):0
+       mov     (%rsp), %rbx
+       shr     %rbx
+       bt      $`'10, %rbx
+       adc     %rbx, %rbx
+       mov     %rbx, (%rsp)
+C put manipulated flags into eflags, execute a plain adc
+       popfq
+       adc     %rcx, 32(%rsp)
+C copy CF to 0(%rsp):11
+       mov     (%rsp), %rbx
+       sbb     R32(%rax), R32(%rax)
+       and     $`'0x800, R32(%rax)
+       and     $`'0xfffffffffffff7ff, %rbx
+       or      %rax, %rbx
+       mov     %rbx, (%rsp)
+C put manipulated flags into eflags
+       popfq
+       pop     %rax
+       pop     %rbx
+       pop     %rcx
+       pop     $2
+')
+
+define(`adcx',`
+       push    $2
+       push    %rcx
+       push    %rbx
+       push    %rax
+       mov     $1, %rcx
+       pushfq
+       adc     %rcx, 32(%rsp)
+       mov     (%rsp), %rbx
+       sbb     R32(%rax), R32(%rax)
+       and     $`'0xfffffffffffffffe, %rbx
+       sub     %rax, %rbx
+       mov     %rbx, (%rsp)
+       popfq
+       pop     %rax
+       pop     %rbx
+       pop     %rcx
+       pop     $2
+')
+
+define(`mulx',`
+       lea     -16(%rsp), %rsp
+       push    %rax
+       push    %rdx
+       pushfq                  C preserve all flags
+       mov     $1, %rax
+       mul     %rdx
+       mov     %rax, 24(%rsp)
+       mov     %rdx, 32(%rsp)
+       popfq                   C restore eflags
+       pop     %rdx
+       pop     %rax
+       pop     $2
+       pop     $3
+')
diff --git a/mpn/x86_64/missing.asm b/mpn/x86_64/missing.asm
new file mode 100644 (file)
index 0000000..9b65c89
--- /dev/null
@@ -0,0 +1,130 @@
+
+       dnl  AMD64 MULX/ADX simulation support.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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')
+
+ASM_START()
+
+C Fake the MULX instruction
+C
+C Accept the single explicit parameter on the stack, return the two result
+C words on the stack.  This calling convention means that we need to move the
+C return address up.
+C
+PROLOGUE(__gmp_mulx)
+       lea     -8(%rsp), %rsp
+       push    %rax
+       push    %rdx
+       pushfq                          C preserve all flags
+       mov     32(%rsp), %rax          C move retaddr...
+       mov     %rax, 24(%rsp)          C ...up the stack
+       mov     40(%rsp), %rax          C input parameter
+       mul     %rdx
+       mov     %rax, 32(%rsp)
+       mov     %rdx, 40(%rsp)
+       popfq                           C restore eflags
+       pop     %rdx
+       pop     %rax
+       ret
+EPILOGUE()
+PROTECT(__gmp_mulx)
+
+
+C Fake the ADOX instruction
+C
+C Accept the two parameters on the stack, return the result word on the stack.
+C This calling convention means that we need to move the return address down.
+C
+PROLOGUE(__gmp_adox)
+       push    %rcx
+       push    %rbx
+       push    %rax
+       mov     32(%rsp), %rcx          C src2
+       mov     24(%rsp), %rax          C move retaddr...
+       mov     %rax, 32(%rsp)          C ...down the stack
+       pushfq
+C copy 0(%rsp):11 to 0(%rsp):0
+       mov     (%rsp), %rbx
+       shr     %rbx
+       bt      $10, %rbx
+       adc     %rbx, %rbx
+       push    %rbx
+C put manipulated flags into eflags, execute a plain adc
+       popfq
+       adc     %rcx, 48(%rsp)
+C copy CF to 0(%rsp):11
+       pop     %rbx
+       sbb     R32(%rax), R32(%rax)
+       and     $0x800, R32(%rax)
+       and     $0xfffffffffffff7ff, %rbx
+       or      %rax, %rbx
+       push    %rbx
+C put manipulated flags into eflags
+       popfq
+       pop     %rax
+       pop     %rbx
+       pop     %rcx
+       lea     8(%rsp), %rsp
+       ret
+EPILOGUE()
+PROTECT(__gmp_adox)
+
+
+C Fake the ADCX instruction
+C
+C Accept the two parameters on the stack, return the result word on the stack.
+C This calling convention means that we need to move the return address down.
+C
+PROLOGUE(__gmp_adcx)
+       push    %rcx
+       push    %rbx
+       push    %rax
+       mov     32(%rsp), %rcx          C src2
+       mov     24(%rsp), %rax          C move retaddr...
+       mov     %rax, 32(%rsp)          C ...down the stack
+       pushfq
+       adc     %rcx, 48(%rsp)
+       pop     %rbx
+       sbb     R32(%rax), R32(%rax)
+       and     $`'0xfffffffffffffffe, %rbx
+       sub     %rax, %rbx
+       push    %rbx
+       popfq
+       pop     %rax
+       pop     %rbx
+       pop     %rcx
+       lea     8(%rsp), %rsp
+       ret
+EPILOGUE()
+PROTECT(__gmp_adcx)
index 42a8c4c4bd37cad02a83d87fb87a5e2e3ae73c1b..4a7c45a58b46daffb5ddf864ac6ebebd353244e3 100644 (file)
@@ -1,23 +1,34 @@
 dnl  AMD64 mpn_mod_1_1p
 
-dnl  Contributed to the GNU project by Torbjörn Granlund and Niels Möller.
+dnl  Contributed to the GNU project by Torbjörn Granlund and Niels Möller.
 
-dnl  Copyright 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2009-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 6310e45498c42984c261f0ed9f0647066cdb53eb..02dd917791986311b39dec23a5766cfb7436a5d6 100644 (file)
@@ -2,22 +2,33 @@ dnl  AMD64 mpn_mod_1s_2p
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2009-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 91a372c89e708f6067664662925c70bab6969ce2..3ce83dc42ed615ddecba3abd92bd12e648be6838 100644 (file)
@@ -2,22 +2,33 @@ dnl  AMD64 mpn_mod_1s_4p
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2009-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d088381bbaa1c762d9534cdb19647bcd1f7486bd..62bdcfac690ebbbfde5ca07f1b994d247601f576 100644 (file)
@@ -1,22 +1,33 @@
 dnl  AMD64 mpn_mod_34lsub1 -- remainder modulo 2^48-1.
 
-dnl  Copyright 2000, 2001, 2002, 2004, 2005, 2007, 2009, 2010, 2011, 2012 Free
-dnl  Software Foundation, Inc.
+dnl  Copyright 2000-2002, 2004, 2005, 2007, 2009-2012 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 0d95bec5f65d5ecd016a21dfe37a43b8fcc8270c..2cd2b088481f2ae30988a70efb538b248a3df671 100644 (file)
@@ -1,22 +1,32 @@
 dnl  AMD64 mpn_modexact_1_odd -- Hensel norm remainder.
 
-dnl  Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2011, 2012 Free
-dnl  Software Foundation, Inc.
+dnl  Copyright 2000-2006, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index ee435db9c683b0134b89f2a44cdafddc1f67f1c2..b032afc9ddb7a5931436bbb6166d3dab0e6d99a6 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD64 mpn_mul_1.
 
-dnl  Copyright 2003, 2004, 2005, 2007, 2008, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2003-2005, 2007, 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
@@ -69,7 +80,6 @@ IFDOS(`       mov     64(%rsp), %r10')        C 40 + 3*8  (3 push insns)
 EPILOGUE()
 
 PROLOGUE(mpn_mul_1)
-
 IFDOS(``push   %rsi            '')
 IFDOS(``push   %rdi            '')
 IFDOS(``mov    %rdx, %rsi      '')
index 73b346fa9e7db45dd7491331f05de31b264551c9..f408c52250e6612c97b1127410c710cf5b0bc7c4 100644 (file)
@@ -4,19 +4,30 @@ dnl  store the result in a third limb vector.
 dnl  Copyright 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/mul_basecase.asm b/mpn/x86_64/mul_basecase.asm
deleted file mode 100644 (file)
index be9e276..0000000
+++ /dev/null
@@ -1,458 +0,0 @@
-dnl  AMD64 mpn_mul_basecase.
-
-dnl  Contributed to the GNU project by Torbjorn Granlund and David Harvey.
-
-dnl  Copyright 2008, 2012 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 AMD K8,K9     2.375
-C AMD K10       2.375
-C Intel P4     15-16
-C Intel core2   4.45
-C Intel corei   4.35
-C Intel atom    ?
-C VIA nano      4.5
-
-C The inner loops of this code are the result of running a code generation and
-C optimization tool suite written by David Harvey and Torbjorn Granlund.
-
-C TODO
-C  * Use fewer registers.  (how??? I can't see it -- david)
-C  * Avoid some "mov $0,r" and instead use "xor r,r".
-C  * Can the top of each L(addmul_outer_n) prologue be folded into the
-C    mul_1/mul_2 prologues, saving a LEA (%rip)? It would slow down the
-C    case where vn = 1 or 2; is it worth it?
-
-C INPUT PARAMETERS
-define(`rp',      `%rdi')
-define(`up',      `%rsi')
-define(`un_param',`%rdx')
-define(`vp',      `%rcx')
-define(`vn',      `%r8')
-
-define(`v0', `%r12')
-define(`v1', `%r9')
-
-define(`w0', `%rbx')
-define(`w1', `%r15')
-define(`w2', `%rbp')
-define(`w3', `%r10')
-
-define(`n',  `%r11')
-define(`outer_addr', `%r14')
-define(`un',  `%r13')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
-       TEXT
-       ALIGN(16)
-PROLOGUE(mpn_mul_basecase)
-       FUNC_ENTRY(4)
-IFDOS(`        mov     56(%rsp), %r8d  ')
-       push    %rbx
-       push    %rbp
-       push    %r12
-       push    %r13
-       push    %r14
-       push    %r15
-
-       xor     R32(un), R32(un)
-       mov     (up), %rax
-       mov     (vp), v0
-
-       sub     un_param, un            C rdx used by mul
-       mov     un, n
-       mov     R32(un_param), R32(w0)
-
-       lea     (rp,un_param,8), rp
-       lea     (up,un_param,8), up
-
-       mul     v0
-
-       test    $1, R8(vn)
-       jz      L(mul_2)
-
-C ===========================================================
-C     mul_1 for vp[0] if vn is odd
-
-L(mul_1):
-       and     $3, R32(w0)
-       jz      L(mul_1_prologue_0)
-       cmp     $2, R32(w0)
-       jc      L(mul_1_prologue_1)
-       jz      L(mul_1_prologue_2)
-
-L(mul_1_prologue_3):
-       add     $-1, n
-       lea     L(addmul_outer_3)(%rip), outer_addr
-       mov     %rax, w3
-       mov     %rdx, w0
-       jmp     L(mul_1_entry_3)
-
-L(mul_1_prologue_0):
-       mov     %rax, w2
-       mov     %rdx, w3                C note: already w0 == 0
-       lea     L(addmul_outer_0)(%rip), outer_addr
-       jmp     L(mul_1_entry_0)
-
-L(mul_1_prologue_1):
-       cmp     $-1, un
-       jne     2f
-       mov     %rax, -8(rp)
-       mov     %rdx, (rp)
-       jmp     L(ret)
-2:     add     $1, n
-       lea     L(addmul_outer_1)(%rip), outer_addr
-       mov     %rax, w1
-       mov     %rdx, w2
-       xor     R32(w3), R32(w3)
-       mov     (up,n,8), %rax
-       jmp     L(mul_1_entry_1)
-
-L(mul_1_prologue_2):
-       add     $-2, n
-       lea     L(addmul_outer_2)(%rip), outer_addr
-       mov     %rax, w0
-       mov     %rdx, w1
-       mov     24(up,n,8), %rax
-       xor     R32(w2), R32(w2)
-       xor     R32(w3), R32(w3)
-       jmp     L(mul_1_entry_2)
-
-
-       C this loop is 10 c/loop = 2.5 c/l on K8, for all up/rp alignments
-
-       ALIGN(16)
-L(mul_1_top):
-       mov     w0, -16(rp,n,8)
-       add     %rax, w1
-       mov     (up,n,8), %rax
-       adc     %rdx, w2
-L(mul_1_entry_1):
-       xor     R32(w0), R32(w0)
-       mul     v0
-       mov     w1, -8(rp,n,8)
-       add     %rax, w2
-       adc     %rdx, w3
-L(mul_1_entry_0):
-       mov     8(up,n,8), %rax
-       mul     v0
-       mov     w2, (rp,n,8)
-       add     %rax, w3
-       adc     %rdx, w0
-L(mul_1_entry_3):
-       mov     16(up,n,8), %rax
-       mul     v0
-       mov     w3, 8(rp,n,8)
-       xor     R32(w2), R32(w2)        C zero
-       mov     w2, w3                  C zero
-       add     %rax, w0
-       mov     24(up,n,8), %rax
-       mov     w2, w1                  C zero
-       adc     %rdx, w1
-L(mul_1_entry_2):
-       mul     v0
-       add     $4, n
-       js      L(mul_1_top)
-
-       mov     w0, -16(rp)
-       add     %rax, w1
-       mov     w1, -8(rp)
-       adc     %rdx, w2
-       mov     w2, (rp)
-
-       add     $-1, vn                 C vn -= 1
-       jz      L(ret)
-
-       mov     8(vp), v0
-       mov     16(vp), v1
-
-       lea     8(vp), vp               C vp += 1
-       lea     8(rp), rp               C rp += 1
-
-       jmp     *outer_addr
-
-C ===========================================================
-C     mul_2 for vp[0], vp[1] if vn is even
-
-       ALIGN(16)
-L(mul_2):
-       mov     8(vp), v1
-
-       and     $3, R32(w0)
-       jz      L(mul_2_prologue_0)
-       cmp     $2, R32(w0)
-       jz      L(mul_2_prologue_2)
-       jc      L(mul_2_prologue_1)
-
-L(mul_2_prologue_3):
-       lea     L(addmul_outer_3)(%rip), outer_addr
-       add     $2, n
-       mov     %rax, -16(rp,n,8)
-       mov     %rdx, w2
-       xor     R32(w3), R32(w3)
-       xor     R32(w0), R32(w0)
-       mov     -16(up,n,8), %rax
-       jmp     L(mul_2_entry_3)
-
-       ALIGN(16)
-L(mul_2_prologue_0):
-       add     $3, n
-       mov     %rax, w0
-       mov     %rdx, w1
-       xor     R32(w2), R32(w2)
-       mov     -24(up,n,8), %rax
-       lea     L(addmul_outer_0)(%rip), outer_addr
-       jmp     L(mul_2_entry_0)
-
-       ALIGN(16)
-L(mul_2_prologue_1):
-       mov     %rax, w3
-       mov     %rdx, w0
-       xor     R32(w1), R32(w1)
-       lea     L(addmul_outer_1)(%rip), outer_addr
-       jmp     L(mul_2_entry_1)
-
-       ALIGN(16)
-L(mul_2_prologue_2):
-       add     $1, n
-       lea     L(addmul_outer_2)(%rip), outer_addr
-       mov     $0, R32(w0)
-       mov     $0, R32(w1)
-       mov     %rax, w2
-       mov     -8(up,n,8), %rax
-       mov     %rdx, w3
-       jmp     L(mul_2_entry_2)
-
-       C this loop is 18 c/loop = 2.25 c/l on K8, for all up/rp alignments
-
-       ALIGN(16)
-L(mul_2_top):
-       mov     -32(up,n,8), %rax
-       mul     v1
-       add     %rax, w0
-       adc     %rdx, w1
-       mov     -24(up,n,8), %rax
-       xor     R32(w2), R32(w2)
-       mul     v0
-       add     %rax, w0
-       mov     -24(up,n,8), %rax
-       adc     %rdx, w1
-       adc     $0, R32(w2)
-L(mul_2_entry_0):
-       mul     v1
-       add     %rax, w1
-       mov     w0, -24(rp,n,8)
-       adc     %rdx, w2
-       mov     -16(up,n,8), %rax
-       mul     v0
-       mov     $0, R32(w3)
-       add     %rax, w1
-       adc     %rdx, w2
-       mov     -16(up,n,8), %rax
-       adc     $0, R32(w3)
-       mov     $0, R32(w0)
-       mov     w1, -16(rp,n,8)
-L(mul_2_entry_3):
-       mul     v1
-       add     %rax, w2
-       mov     -8(up,n,8), %rax
-       adc     %rdx, w3
-       mov     $0, R32(w1)
-       mul     v0
-       add     %rax, w2
-       mov     -8(up,n,8), %rax
-       adc     %rdx, w3
-       adc     R32(w1), R32(w0)        C adc $0, w0
-L(mul_2_entry_2):
-       mul     v1
-       add     %rax, w3
-       mov     w2, -8(rp,n,8)
-       adc     %rdx, w0
-       mov     (up,n,8), %rax
-       mul     v0
-       add     %rax, w3
-       adc     %rdx, w0
-       adc     $0, R32(w1)
-L(mul_2_entry_1):
-       add     $4, n
-       mov     w3, -32(rp,n,8)
-       js      L(mul_2_top)
-
-       mov     -32(up,n,8), %rax       C FIXME: n is constant
-       mul     v1
-       add     %rax, w0
-       mov     w0, (rp)
-       adc     %rdx, w1
-       mov     w1, 8(rp)
-
-       add     $-2, vn                 C vn -= 2
-       jz      L(ret)
-
-       mov     16(vp), v0
-       mov     24(vp), v1
-
-       lea     16(vp), vp              C vp += 2
-       lea     16(rp), rp              C rp += 2
-
-       jmp     *outer_addr
-
-
-C ===========================================================
-C     addmul_2 for remaining vp's
-
-       C in the following prologues, we reuse un to store the
-       C adjusted value of n that is reloaded on each iteration
-
-L(addmul_outer_0):
-       add     $3, un
-       lea     0(%rip), outer_addr
-
-       mov     un, n
-       mov     -24(up,un,8), %rax
-       mul     v0
-       mov     %rax, w0
-       mov     -24(up,un,8), %rax
-       mov     %rdx, w1
-       xor     R32(w2), R32(w2)
-       jmp     L(addmul_entry_0)
-
-L(addmul_outer_1):
-       mov     un, n
-       mov     (up,un,8), %rax
-       mul     v0
-       mov     %rax, w3
-       mov     (up,un,8), %rax
-       mov     %rdx, w0
-       xor     R32(w1), R32(w1)
-       jmp     L(addmul_entry_1)
-
-L(addmul_outer_2):
-       add     $1, un
-       lea     0(%rip), outer_addr
-
-       mov     un, n
-       mov     -8(up,un,8), %rax
-       mul     v0
-       xor     R32(w0), R32(w0)
-       mov     %rax, w2
-       xor     R32(w1), R32(w1)
-       mov     %rdx, w3
-       mov     -8(up,un,8), %rax
-       jmp     L(addmul_entry_2)
-
-L(addmul_outer_3):
-       add     $2, un
-       lea     0(%rip), outer_addr
-
-       mov     un, n
-       mov     -16(up,un,8), %rax
-       xor     R32(w3), R32(w3)
-       mul     v0
-       mov     %rax, w1
-       mov     -16(up,un,8), %rax
-       mov     %rdx, w2
-       jmp     L(addmul_entry_3)
-
-       C this loop is 19 c/loop = 2.375 c/l on K8, for all up/rp alignments
-
-       ALIGN(16)
-L(addmul_top):
-       add     w3, -32(rp,n,8)
-       adc     %rax, w0
-       mov     -24(up,n,8), %rax
-       adc     %rdx, w1
-       xor     R32(w2), R32(w2)
-       mul     v0
-       add     %rax, w0
-       mov     -24(up,n,8), %rax
-       adc     %rdx, w1
-       adc     R32(w2), R32(w2)        C adc $0, w2
-L(addmul_entry_0):
-       mul     v1
-       xor     R32(w3), R32(w3)
-       add     w0, -24(rp,n,8)
-       adc     %rax, w1
-       mov     -16(up,n,8), %rax
-       adc     %rdx, w2
-       mul     v0
-       add     %rax, w1
-       mov     -16(up,n,8), %rax
-       adc     %rdx, w2
-       adc     $0, R32(w3)
-L(addmul_entry_3):
-       mul     v1
-       add     w1, -16(rp,n,8)
-       adc     %rax, w2
-       mov     -8(up,n,8), %rax
-       adc     %rdx, w3
-       mul     v0
-       xor     R32(w0), R32(w0)
-       add     %rax, w2
-       adc     %rdx, w3
-       mov     $0, R32(w1)
-       mov     -8(up,n,8), %rax
-       adc     R32(w1), R32(w0)        C adc $0, w0
-L(addmul_entry_2):
-       mul     v1
-       add     w2, -8(rp,n,8)
-       adc     %rax, w3
-       adc     %rdx, w0
-       mov     (up,n,8), %rax
-       mul     v0
-       add     %rax, w3
-       mov     (up,n,8), %rax
-       adc     %rdx, w0
-       adc     $0, R32(w1)
-L(addmul_entry_1):
-       mul     v1
-       add     $4, n
-       js      L(addmul_top)
-
-       add     w3, -8(rp)
-       adc     %rax, w0
-       mov     w0, (rp)
-       adc     %rdx, w1
-       mov     w1, 8(rp)
-
-       add     $-2, vn                 C vn -= 2
-       jz      L(ret)
-
-       lea     16(rp), rp              C rp += 2
-       lea     16(vp), vp              C vp += 2
-
-       mov     (vp), v0
-       mov     8(vp), v1
-
-       jmp     *outer_addr
-
-       ALIGN(16)
-L(ret):        pop     %r15
-       pop     %r14
-       pop     %r13
-       pop     %r12
-       pop     %rbp
-       pop     %rbx
-       FUNC_EXIT()
-       ret
-
-EPILOGUE()
diff --git a/mpn/x86_64/mullo_basecase.asm b/mpn/x86_64/mullo_basecase.asm
deleted file mode 100644 (file)
index a066b82..0000000
+++ /dev/null
@@ -1,425 +0,0 @@
-dnl  AMD64 mpn_mullo_basecase.
-
-dnl  Contributed to the GNU project by Torbjorn Granlund.
-
-dnl  Copyright 2008, 2009, 2011, 2012 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 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.
-
-C NOTES
-C   * There is a major stupidity in that we call mpn_mul_1 initially, for a
-C     large trip count.  Instead, we should start with mul_2 for any operand
-C     size congruence class.
-C   * Stop iterating addmul_2 earlier, falling into straight-line triangle code
-C     for the last 2-3 iterations.
-C   * Perhaps implement n=4 special code.
-C   * The reload of the outer loop jump address hurts branch preditiction.
-C   * The addmul_2 loop ends with an MUL whose high part is not used upon loop
-C     exit.
-
-C INPUT PARAMETERS
-define(`rp',      `%rdi')
-define(`up',      `%rsi')
-define(`vp_param', `%rdx')
-define(`n',       `%rcx')
-
-define(`vp',   `%r11')
-define(`outer_addr', `%r8')
-define(`j',    `%r9')
-define(`v0',   `%r13')
-define(`v1',   `%r14')
-define(`w0',   `%rbx')
-define(`w1',   `%r15')
-define(`w2',   `%rbp')
-define(`w3',   `%r10')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
-       TEXT
-       ALIGN(16)
-PROLOGUE(mpn_mullo_basecase)
-       FUNC_ENTRY(4)
-       cmp     $4, n
-       jge     L(gen)
-       mov     (up), %rax              C u0
-       mov     (vp_param), %r8         C v0
-
-       lea     L(tab)(%rip), %r9
-ifdef(`PIC',
-`      movslq  (%r9,%rcx,4), %r10
-       add     %r10, %r9
-       jmp     *%r9
-',`
-       jmp     *(%r9,n,8)
-')
-       JUMPTABSECT
-       ALIGN(8)
-L(tab):        JMPENT( L(tab), L(tab))                 C not allowed
-       JMPENT( L(1), L(tab))                   C 1
-       JMPENT( L(2), L(tab))                   C 2
-       JMPENT( L(3), L(tab))                   C 3
-dnl    JMPENT( L(0m4), L(tab))                 C 4
-dnl    JMPENT( L(1m4), L(tab))                 C 5
-dnl    JMPENT( L(2m4), L(tab))                 C 6
-dnl    JMPENT( L(3m4), L(tab))                 C 7
-dnl    JMPENT( L(0m4), L(tab))                 C 8
-dnl    JMPENT( L(1m4), L(tab))                 C 9
-dnl    JMPENT( L(2m4), L(tab))                 C 10
-dnl    JMPENT( L(3m4), L(tab))                 C 11
-       TEXT
-
-L(1):  imul    %r8, %rax
-       mov     %rax, (rp)
-       FUNC_EXIT()
-       ret
-
-L(2):  mov     8(vp_param), %r11
-       imul    %rax, %r11              C u0 x v1
-       mul     %r8                     C u0 x v0
-       mov     %rax, (rp)
-       imul    8(up), %r8              C u1 x v0
-       lea     (%r11, %rdx), %rax
-       add     %r8, %rax
-       mov     %rax, 8(rp)
-       FUNC_EXIT()
-       ret
-
-L(3):  mov     8(vp_param), %r9        C v1
-       mov     16(vp_param), %r11
-       mul     %r8                     C u0 x v0 -> <r1,r0>
-       mov     %rax, (rp)              C r0
-       mov     (up), %rax              C u0
-       mov     %rdx, %rcx              C r1
-       mul     %r9                     C u0 x v1 -> <r2,r1>
-       imul    8(up), %r9              C u1 x v1 -> r2
-       mov     16(up), %r10
-       imul    %r8, %r10               C u2 x v0 -> r2
-       add     %rax, %rcx
-       adc     %rdx, %r9
-       add     %r10, %r9
-       mov     8(up), %rax             C u1
-       mul     %r8                     C u1 x v0 -> <r2,r1>
-       add     %rax, %rcx
-       adc     %rdx, %r9
-       mov     %r11, %rax
-       imul    (up), %rax              C u0 x v2 -> r2
-       add     %rax, %r9
-       mov     %rcx, 8(rp)
-       mov     %r9, 16(rp)
-       FUNC_EXIT()
-       ret
-
-L(0m4):
-L(1m4):
-L(2m4):
-L(3m4):
-L(gen):        push    %rbx
-       push    %rbp
-       push    %r13
-       push    %r14
-       push    %r15
-
-       mov     (up), %rax
-       mov     (vp_param), v0
-       mov     vp_param, vp
-
-       lea     (rp,n,8), rp
-       lea     (up,n,8), up
-       neg     n
-
-       mul     v0
-
-       test    $1, R8(n)
-       jz      L(mul_2)
-
-L(mul_1):
-       lea     -8(rp), rp
-       lea     -8(up), up
-       test    $2, R8(n)
-       jnz     L(mul_1_prologue_3)
-
-L(mul_1_prologue_2):           C n = 7, 11, 15, ...
-       lea     -1(n), j
-       lea     L(addmul_outer_1)(%rip), outer_addr
-       mov     %rax, w0
-       mov     %rdx, w1
-       xor     R32(w2), R32(w2)
-       xor     R32(w3), R32(w3)
-       mov     16(up,n,8), %rax
-       jmp     L(mul_1_entry_2)
-
-L(mul_1_prologue_3):           C n = 5, 9, 13, ...
-       lea     1(n), j
-       lea     L(addmul_outer_3)(%rip), outer_addr
-       mov     %rax, w2
-       mov     %rdx, w3
-       xor     R32(w0), R32(w0)
-       jmp     L(mul_1_entry_0)
-
-       ALIGN(16)
-L(mul_1_top):
-       mov     w0, -16(rp,j,8)
-       add     %rax, w1
-       mov     (up,j,8), %rax
-       adc     %rdx, w2
-       xor     R32(w0), R32(w0)
-       mul     v0
-       mov     w1, -8(rp,j,8)
-       add     %rax, w2
-       adc     %rdx, w3
-L(mul_1_entry_0):
-       mov     8(up,j,8), %rax
-       mul     v0
-       mov     w2, (rp,j,8)
-       add     %rax, w3
-       adc     %rdx, w0
-       mov     16(up,j,8), %rax
-       mul     v0
-       mov     w3, 8(rp,j,8)
-       xor     R32(w2), R32(w2)        C zero
-       mov     w2, w3                  C zero
-       add     %rax, w0
-       mov     24(up,j,8), %rax
-       mov     w2, w1                  C zero
-       adc     %rdx, w1
-L(mul_1_entry_2):
-       mul     v0
-       add     $4, j
-       js      L(mul_1_top)
-
-       mov     w0, -16(rp)
-       add     %rax, w1
-       mov     w1, -8(rp)
-       adc     %rdx, w2
-
-       imul    (up), v0
-       add     v0, w2
-       mov     w2, (rp)
-
-       add     $1, n
-       jz      L(ret)
-
-       mov     8(vp), v0
-       mov     16(vp), v1
-
-       lea     16(up), up
-       lea     8(vp), vp
-       lea     24(rp), rp
-
-       jmp     *outer_addr
-
-
-L(mul_2):
-       mov     8(vp), v1
-       test    $2, R8(n)
-       jz      L(mul_2_prologue_3)
-
-       ALIGN(16)
-L(mul_2_prologue_1):
-       lea     0(n), j
-       mov     %rax, w3
-       mov     %rdx, w0
-       xor     R32(w1), R32(w1)
-       mov     (up,n,8), %rax
-       lea     L(addmul_outer_3)(%rip), outer_addr
-       jmp     L(mul_2_entry_1)
-
-       ALIGN(16)
-L(mul_2_prologue_3):
-       lea     2(n), j
-       mov     $0, R32(w3)
-       mov     %rax, w1
-       mov     (up,n,8), %rax
-       mov     %rdx, w2
-       lea     L(addmul_outer_1)(%rip), outer_addr
-       jmp     L(mul_2_entry_3)
-
-       ALIGN(16)
-L(mul_2_top):
-       mov     -32(up,j,8), %rax
-       mul     v1
-       add     %rax, w0
-       adc     %rdx, w1
-       mov     -24(up,j,8), %rax
-       xor     R32(w2), R32(w2)
-       mul     v0
-       add     %rax, w0
-       mov     -24(up,j,8), %rax
-       adc     %rdx, w1
-       adc     $0, R32(w2)
-       mul     v1
-       add     %rax, w1
-       mov     w0, -24(rp,j,8)
-       adc     %rdx, w2
-       mov     -16(up,j,8), %rax
-       mul     v0
-       mov     $0, R32(w3)
-       add     %rax, w1
-       adc     %rdx, w2
-       mov     -16(up,j,8), %rax
-       adc     $0, R32(w3)
-L(mul_2_entry_3):
-       mov     $0, R32(w0)
-       mov     w1, -16(rp,j,8)
-       mul     v1
-       add     %rax, w2
-       mov     -8(up,j,8), %rax
-       adc     %rdx, w3
-       mov     $0, R32(w1)
-       mul     v0
-       add     %rax, w2
-       mov     -8(up,j,8), %rax
-       adc     %rdx, w3
-       adc     R32(w1), R32(w0)
-       mul     v1
-       add     %rax, w3
-       mov     w2, -8(rp,j,8)
-       adc     %rdx, w0
-       mov     (up,j,8), %rax
-       mul     v0
-       add     %rax, w3
-       adc     %rdx, w0
-       adc     $0, R32(w1)
-L(mul_2_entry_1):
-       add     $4, j
-       mov     w3, -32(rp,j,8)
-       js      L(mul_2_top)
-
-       imul    -16(up), v1
-       add     v1, w0
-       imul    -8(up), v0
-       add     v0, w0
-       mov     w0, -8(rp)
-
-       add     $2, n
-       jz      L(ret)
-
-       mov     16(vp), v0
-       mov     24(vp), v1
-
-       lea     16(vp), vp
-       lea     16(rp), rp
-
-       jmp     *outer_addr
-
-
-L(addmul_outer_1):
-       lea     -2(n), j
-       mov     -16(up,n,8), %rax
-       mul     v0
-       mov     %rax, w3
-       mov     -16(up,n,8), %rax
-       mov     %rdx, w0
-       xor     R32(w1), R32(w1)
-       lea     L(addmul_outer_3)(%rip), outer_addr
-       jmp     L(addmul_entry_1)
-
-L(addmul_outer_3):
-       lea     0(n), j
-       mov     -16(up,n,8), %rax
-       xor     R32(w3), R32(w3)
-       mul     v0
-       mov     %rax, w1
-       mov     -16(up,n,8), %rax
-       mov     %rdx, w2
-       lea     L(addmul_outer_1)(%rip), outer_addr
-       jmp     L(addmul_entry_3)
-
-       ALIGN(16)
-L(addmul_top):
-       add     w3, -32(rp,j,8)
-       adc     %rax, w0
-       mov     -24(up,j,8), %rax
-       adc     %rdx, w1
-       xor     R32(w2), R32(w2)
-       mul     v0
-       add     %rax, w0
-       mov     -24(up,j,8), %rax
-       adc     %rdx, w1
-       adc     R32(w2), R32(w2)
-       mul     v1
-       xor     R32(w3), R32(w3)
-       add     w0, -24(rp,j,8)
-       adc     %rax, w1
-       mov     -16(up,j,8), %rax
-       adc     %rdx, w2
-       mul     v0
-       add     %rax, w1
-       mov     -16(up,j,8), %rax
-       adc     %rdx, w2
-       adc     $0, R32(w3)
-L(addmul_entry_3):
-       mul     v1
-       add     w1, -16(rp,j,8)
-       adc     %rax, w2
-       mov     -8(up,j,8), %rax
-       adc     %rdx, w3
-       mul     v0
-       xor     R32(w0), R32(w0)
-       add     %rax, w2
-       adc     %rdx, w3
-       mov     $0, R32(w1)
-       mov     -8(up,j,8), %rax
-       adc     R32(w1), R32(w0)
-       mul     v1
-       add     w2, -8(rp,j,8)
-       adc     %rax, w3
-       adc     %rdx, w0
-       mov     (up,j,8), %rax
-       mul     v0
-       add     %rax, w3
-       mov     (up,j,8), %rax
-       adc     %rdx, w0
-       adc     $0, R32(w1)
-L(addmul_entry_1):
-       mul     v1
-       add     $4, j
-       js      L(addmul_top)
-
-       add     w3, -32(rp)
-       adc     %rax, w0
-
-       imul    -24(up), v0
-       add     v0, w0
-       add     w0, -24(rp)
-
-       add     $2, n
-       jns     L(ret)
-
-       lea     16(vp), vp
-
-       mov     (vp), v0
-       mov     8(vp), v1
-
-       lea     -16(up), up
-
-       jmp     *outer_addr
-
-L(ret):        pop     %r15
-       pop     %r14
-       pop     %r13
-       pop     %rbp
-       pop     %rbx
-       FUNC_EXIT()
-       ret
-EPILOGUE()
diff --git a/mpn/x86_64/mulmid_basecase.asm b/mpn/x86_64/mulmid_basecase.asm
deleted file mode 100644 (file)
index a4802bf..0000000
+++ /dev/null
@@ -1,548 +0,0 @@
-dnl  AMD64 mpn_mulmid_basecase
-
-dnl  Contributed by David Harvey.
-
-dnl  Copyright 2011, 2012 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 K8,K9:        2.375  (2.5 when un - vn is "small")
-C K10:          ?
-C P4:           ?
-C P6-15:        ?
-
-C INPUT PARAMETERS
-define(`rp',      `%rdi')
-define(`up',      `%rsi')
-define(`un_param',`%rdx')
-define(`vp_param',`%rcx')
-define(`vn',      `%r8')
-
-define(`v0', `%r12')
-define(`v1', `%r9')
-
-define(`w0', `%rbx')
-define(`w1', `%rcx')
-define(`w2', `%rbp')
-define(`w3', `%r10')
-
-define(`n',  `%r11')
-define(`outer_addr', `%r14')
-define(`un',  `%r13')
-define(`vp',  `%r15')
-
-define(`vp_inner', `%r10')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
-       TEXT
-       ALIGN(16)
-PROLOGUE(mpn_mulmid_basecase)
-       FUNC_ENTRY(4)
-IFDOS(`        mov     56(%rsp), %r8d  ')
-       push    %rbx
-       push    %rbp
-       push    %r12
-       push    %r13
-       push    %r14
-       push    %r15
-
-       mov     vp_param, vp
-
-       C use un for row length (= un_param - vn + 1)
-       lea     1(un_param), un
-       sub     vn, un
-
-       lea     (rp,un,8), rp
-
-       cmp     $4, un          C TODO: needs tuning
-       jc      L(diagonal)
-
-       lea     (up,un_param,8), up
-
-       test    $1, vn
-       jz      L(mul_2)
-
-C ===========================================================
-C     mul_1 for vp[0] if vn is odd
-
-L(mul_1):
-       mov     R32(un), R32(w0)
-
-       neg     un
-       mov     (up,un,8), %rax
-       mov     (vp), v0
-       mul     v0
-
-       and     $-4, un         C round down to multiple of 4
-       mov     un, n
-
-       and     $3, R32(w0)
-       jz      L(mul_1_prologue_0)
-       cmp     $2, R32(w0)
-       jc      L(mul_1_prologue_1)
-       jz      L(mul_1_prologue_2)
-
-L(mul_1_prologue_3):
-       mov     %rax, w3
-       mov     %rdx, w0
-       lea     L(addmul_prologue_3)(%rip), outer_addr
-       jmp     L(mul_1_entry_3)
-
-       ALIGN(16)
-L(mul_1_prologue_0):
-       mov     %rax, w2
-       mov     %rdx, w3                C note already w0 == 0
-       lea     L(addmul_prologue_0)(%rip), outer_addr
-       jmp     L(mul_1_entry_0)
-
-       ALIGN(16)
-L(mul_1_prologue_1):
-       add     $4, n
-       mov     %rax, w1
-       mov     %rdx, w2
-       mov     $0, R32(w3)
-       mov     (up,n,8), %rax
-       lea     L(addmul_prologue_1)(%rip), outer_addr
-       jmp     L(mul_1_entry_1)
-
-       ALIGN(16)
-L(mul_1_prologue_2):
-       mov     %rax, w0
-       mov     %rdx, w1
-       mov     24(up,n,8), %rax
-       mov     $0, R32(w2)
-       mov     $0, R32(w3)
-       lea     L(addmul_prologue_2)(%rip), outer_addr
-       jmp     L(mul_1_entry_2)
-
-
-       C this loop is 10 c/loop = 2.5 c/l on K8
-
-       ALIGN(16)
-L(mul_1_top):
-       mov     w0, -16(rp,n,8)
-       add     %rax, w1
-       mov     (up,n,8), %rax
-       adc     %rdx, w2
-L(mul_1_entry_1):
-       mov     $0, R32(w0)
-       mul     v0
-       mov     w1, -8(rp,n,8)
-       add     %rax, w2
-       adc     %rdx, w3
-L(mul_1_entry_0):
-       mov     8(up,n,8), %rax
-       mul     v0
-       mov     w2, (rp,n,8)
-       add     %rax, w3
-       adc     %rdx, w0
-L(mul_1_entry_3):
-       mov     16(up,n,8), %rax
-       mul     v0
-       mov     w3, 8(rp,n,8)
-       mov     $0, R32(w2)             C zero
-       mov     w2, w3                  C zero
-       add     %rax, w0
-       mov     24(up,n,8), %rax
-       mov     w2, w1                  C zero
-       adc     %rdx, w1
-L(mul_1_entry_2):
-       mul     v0
-       add     $4, n
-       js      L(mul_1_top)
-
-       mov     w0, -16(rp)
-       add     %rax, w1
-       mov     w1, -8(rp)
-       mov     w2, 8(rp)               C zero last limb of output
-       adc     %rdx, w2
-       mov     w2, (rp)
-
-       dec     vn
-       jz      L(ret)
-
-       lea     -8(up), up
-       lea     8(vp), vp
-
-       mov     un, n
-       mov     (vp), v0
-       mov     8(vp), v1
-
-       jmp     *outer_addr
-
-C ===========================================================
-C     mul_2 for vp[0], vp[1] if vn is even
-
-       ALIGN(16)
-L(mul_2):
-       mov     R32(un), R32(w0)
-
-       neg     un
-       mov     -8(up,un,8), %rax
-       mov     (vp), v0
-       mov     8(vp), v1
-       mul     v1
-
-       and     $-4, un         C round down to multiple of 4
-       mov     un, n
-
-       and     $3, R32(w0)
-       jz      L(mul_2_prologue_0)
-       cmp     $2, R32(w0)
-       jc      L(mul_2_prologue_1)
-       jz      L(mul_2_prologue_2)
-
-L(mul_2_prologue_3):
-       mov     %rax, w1
-       mov     %rdx, w2
-       lea     L(addmul_prologue_3)(%rip), outer_addr
-       jmp     L(mul_2_entry_3)
-
-       ALIGN(16)
-L(mul_2_prologue_0):
-       mov     %rax, w0
-       mov     %rdx, w1
-       lea     L(addmul_prologue_0)(%rip), outer_addr
-       jmp     L(mul_2_entry_0)
-
-       ALIGN(16)
-L(mul_2_prologue_1):
-       mov     %rax, w3
-       mov     %rdx, w0
-       mov     $0, R32(w1)
-       lea     L(addmul_prologue_1)(%rip), outer_addr
-       jmp     L(mul_2_entry_1)
-
-       ALIGN(16)
-L(mul_2_prologue_2):
-       mov     %rax, w2
-       mov     %rdx, w3
-       mov     $0, R32(w0)
-       mov     16(up,n,8), %rax
-       lea     L(addmul_prologue_2)(%rip), outer_addr
-       jmp     L(mul_2_entry_2)
-
-
-       C this loop is 18 c/loop = 2.25 c/l on K8
-
-       ALIGN(16)
-L(mul_2_top):
-       mov     -8(up,n,8), %rax
-       mul     v1
-       add     %rax, w0
-       adc     %rdx, w1
-L(mul_2_entry_0):
-       mov     $0, R32(w2)
-       mov     (up,n,8), %rax
-       mul     v0
-       add     %rax, w0
-       mov     (up,n,8), %rax
-       adc     %rdx, w1
-       adc     $0, R32(w2)
-       mul     v1
-       add     %rax, w1
-       mov     w0, (rp,n,8)
-       adc     %rdx, w2
-L(mul_2_entry_3):
-       mov     8(up,n,8), %rax
-       mul     v0
-       mov     $0, R32(w3)
-       add     %rax, w1
-       adc     %rdx, w2
-       mov     $0, R32(w0)
-       adc     $0, R32(w3)
-       mov     8(up,n,8), %rax
-       mov     w1, 8(rp,n,8)
-       mul     v1
-       add     %rax, w2
-       mov     16(up,n,8), %rax
-       adc     %rdx, w3
-L(mul_2_entry_2):
-       mov     $0, R32(w1)
-       mul     v0
-       add     %rax, w2
-       mov     16(up,n,8), %rax
-       adc     %rdx, w3
-       adc     $0, R32(w0)
-       mul     v1
-       add     %rax, w3
-       mov     w2, 16(rp,n,8)
-       adc     %rdx, w0
-L(mul_2_entry_1):
-       mov     24(up,n,8), %rax
-       mul     v0
-       add     %rax, w3
-       adc     %rdx, w0
-       adc     $0, R32(w1)
-       add     $4, n
-       mov     w3, -8(rp,n,8)
-       jnz     L(mul_2_top)
-
-       mov     w0, (rp)
-       mov     w1, 8(rp)
-
-       sub     $2, vn
-       jz      L(ret)
-
-       lea     16(vp), vp
-       lea     -16(up), up
-
-       mov     un, n
-       mov     (vp), v0
-       mov     8(vp), v1
-
-       jmp     *outer_addr
-
-C ===========================================================
-C     addmul_2 for remaining vp's
-
-       ALIGN(16)
-L(addmul_prologue_0):
-       mov     -8(up,n,8), %rax
-       mul     v1
-       mov     %rax, w1
-       mov     %rdx, w2
-       mov     $0, R32(w3)
-       jmp     L(addmul_entry_0)
-
-       ALIGN(16)
-L(addmul_prologue_1):
-       mov     16(up,n,8), %rax
-       mul     v1
-       mov     %rax, w0
-       mov     %rdx, w1
-       mov     $0, R32(w2)
-       mov     24(up,n,8), %rax
-       jmp     L(addmul_entry_1)
-
-       ALIGN(16)
-L(addmul_prologue_2):
-       mov     8(up,n,8), %rax
-       mul     v1
-       mov     %rax, w3
-       mov     %rdx, w0
-       mov     $0, R32(w1)
-       jmp     L(addmul_entry_2)
-
-       ALIGN(16)
-L(addmul_prologue_3):
-       mov     (up,n,8), %rax
-       mul     v1
-       mov     %rax, w2
-       mov     %rdx, w3
-       mov     $0, R32(w0)
-       mov     $0, R32(w1)
-       jmp     L(addmul_entry_3)
-
-       C this loop is 19 c/loop = 2.375 c/l on K8
-
-       ALIGN(16)
-L(addmul_top):
-       mov     $0, R32(w3)
-       add     %rax, w0
-       mov     -8(up,n,8), %rax
-       adc     %rdx, w1
-       adc     $0, R32(w2)
-       mul     v1
-       add     w0, -8(rp,n,8)
-       adc     %rax, w1
-       adc     %rdx, w2
-L(addmul_entry_0):
-       mov     (up,n,8), %rax
-       mul     v0
-       add     %rax, w1
-       mov     (up,n,8), %rax
-       adc     %rdx, w2
-       adc     $0, R32(w3)
-       mul     v1
-       add     w1, (rp,n,8)
-       mov     $0, R32(w1)
-       adc     %rax, w2
-       mov     $0, R32(w0)
-       adc     %rdx, w3
-L(addmul_entry_3):
-       mov     8(up,n,8), %rax
-       mul     v0
-       add     %rax, w2
-       mov     8(up,n,8), %rax
-       adc     %rdx, w3
-       adc     $0, R32(w0)
-       mul     v1
-       add     w2, 8(rp,n,8)
-       adc     %rax, w3
-       adc     %rdx, w0
-L(addmul_entry_2):
-       mov     16(up,n,8), %rax
-       mul     v0
-       add     %rax, w3
-       mov     16(up,n,8), %rax
-       adc     %rdx, w0
-       adc     $0, R32(w1)
-       mul     v1
-       add     w3, 16(rp,n,8)
-       nop                     C don't ask...
-       adc     %rax, w0
-       mov     $0, R32(w2)
-       mov     24(up,n,8), %rax
-       adc     %rdx, w1
-L(addmul_entry_1):
-       mul     v0
-       add     $4, n
-       jnz     L(addmul_top)
-
-       add     %rax, w0
-       adc     %rdx, w1
-       adc     $0, R32(w2)
-
-       add     w0, -8(rp)
-       adc     w1, (rp)
-       adc     w2, 8(rp)
-
-       sub     $2, vn
-       jz      L(ret)
-
-       lea     16(vp), vp
-       lea     -16(up), up
-
-       mov     un, n
-       mov     (vp), v0
-       mov     8(vp), v1
-
-       jmp     *outer_addr
-
-C ===========================================================
-C     accumulate along diagonals if un - vn is small
-
-       ALIGN(16)
-L(diagonal):
-       xor     R32(w0), R32(w0)
-       xor     R32(w1), R32(w1)
-       xor     R32(w2), R32(w2)
-
-       neg     un
-
-       mov     R32(vn), %eax
-       and     $3, %eax
-       jz      L(diag_prologue_0)
-       cmp     $2, %eax
-       jc      L(diag_prologue_1)
-       jz      L(diag_prologue_2)
-
-L(diag_prologue_3):
-       lea     -8(vp), vp
-       mov     vp, vp_inner
-       add     $1, vn
-       mov     vn, n
-       lea     L(diag_entry_3)(%rip), outer_addr
-       jmp     L(diag_entry_3)
-
-L(diag_prologue_0):
-       mov     vp, vp_inner
-       mov     vn, n
-       lea     0(%rip), outer_addr
-       mov     -8(up,n,8), %rax
-       jmp     L(diag_entry_0)
-
-L(diag_prologue_1):
-       lea     8(vp), vp
-       mov     vp, vp_inner
-       add     $3, vn
-       mov     vn, n
-       lea     0(%rip), outer_addr
-       mov     -8(vp_inner), %rax
-       jmp     L(diag_entry_1)
-
-L(diag_prologue_2):
-       lea     -16(vp), vp
-       mov     vp, vp_inner
-       add     $2, vn
-       mov     vn, n
-       lea     0(%rip), outer_addr
-       mov     16(vp_inner), %rax
-       jmp     L(diag_entry_2)
-
-
-       C this loop is 10 c/loop = 2.5 c/l on K8
-
-       ALIGN(16)
-L(diag_top):
-       add     %rax, w0
-       adc     %rdx, w1
-       mov     -8(up,n,8), %rax
-       adc     $0, w2
-L(diag_entry_0):
-       mulq    (vp_inner)
-       add     %rax, w0
-       adc     %rdx, w1
-       adc     $0, w2
-L(diag_entry_3):
-       mov     -16(up,n,8), %rax
-       mulq    8(vp_inner)
-       add     %rax, w0
-       mov     16(vp_inner), %rax
-       adc     %rdx, w1
-       adc     $0, w2
-L(diag_entry_2):
-       mulq    -24(up,n,8)
-       add     %rax, w0
-       mov     24(vp_inner), %rax
-       adc     %rdx, w1
-       lea     32(vp_inner), vp_inner
-       adc     $0, w2
-L(diag_entry_1):
-       mulq    -32(up,n,8)
-       sub     $4, n
-       jnz     L(diag_top)
-
-       add     %rax, w0
-       adc     %rdx, w1
-       adc     $0, w2
-
-       mov     w0, (rp,un,8)
-
-       inc     un
-       jz      L(diag_end)
-
-       mov     vn, n
-       mov     vp, vp_inner
-
-       lea     8(up), up
-       mov     w1, w0
-       mov     w2, w1
-       xor     R32(w2), R32(w2)
-
-       jmp     *outer_addr
-
-L(diag_end):
-       mov     w1, (rp)
-       mov     w2, 8(rp)
-
-L(ret):        pop     %r15
-       pop     %r14
-       pop     %r13
-       pop     %r12
-       pop     %rbp
-       pop     %rbx
-       FUNC_EXIT()
-       ret
-EPILOGUE()
diff --git a/mpn/x86_64/mulx/adx/addmul_1.asm b/mpn/x86_64/mulx/adx/addmul_1.asm
new file mode 100644 (file)
index 0000000..ea60789
--- /dev/null
@@ -0,0 +1,149 @@
+dnl  AMD64 mpn_addmul_1 for CPUs with mulx and adx.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 2012, 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     -
+C AMD K10       -
+C AMD bd1       -
+C AMD bobcat    -
+C Intel P4      -
+C Intel PNR     -
+C Intel NHM     -
+C Intel SBR     -
+C Intel HWL     -
+C Intel BWL     ?
+C Intel atom    -
+C VIA nano      -
+
+define(`rp',      `%rdi')      dnl rcx
+define(`up',      `%rsi')      dnl rdx
+define(`n_param', `%rdx')      dnl r8
+define(`v0_param',`%rcx')      dnl r9
+
+define(`n',       `%rcx')      dnl
+define(`v0',      `%rdx')      dnl
+
+C Testing mechanism for running this on older AMD64 processors
+ifelse(FAKE_MULXADX,1,`
+  include(CONFIG_TOP_SRCDIR`/mpn/x86_64/missing-call.m4')
+',`
+  define(`adox',       ``adox' $1, $2')
+  define(`adcx',       ``adcx' $1, $2')
+  define(`mulx',       ``mulx' $1, $2, $3')
+')
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_addmul_1)
+       mov     (up), %r8
+
+       push    %rbx
+       push    %r12
+       push    %r13
+
+       lea     (up,n_param,8), up
+       lea     -16(rp,n_param,8), rp
+       mov     R32(n_param), R32(%rax)
+       xchg    v0_param, v0            C FIXME: is this insn fast?
+
+       neg     n
+
+       and     $3, R8(%rax)
+       jz      L(b0)
+       cmp     $2, R8(%rax)
+       jl      L(b1)
+       jz      L(b2)
+
+L(b3): mulx(   (up,n,8), %r11, %r10)
+       mulx(   8(up,n,8), %r13, %r12)
+       mulx(   16(up,n,8), %rbx, %rax)
+       dec     n
+       jmp     L(lo3)
+
+L(b0): mulx(   (up,n,8), %r9, %r8)
+       mulx(   8(up,n,8), %r11, %r10)
+       mulx(   16(up,n,8), %r13, %r12)
+       jmp     L(lo0)
+
+L(b2): mulx(   (up,n,8), %r13, %r12)
+       mulx(   8(up,n,8), %rbx, %rax)
+       lea     2(n), n
+       jrcxz   L(wd2)
+L(gt2):        mulx(   (up,n,8), %r9, %r8)
+       jmp     L(lo2)
+
+L(b1): and     R8(%rax), R8(%rax)
+       mulx(   (up,n,8), %rbx, %rax)
+       lea     1(n), n
+       jrcxz   L(wd1)
+       mulx(   (up,n,8), %r9, %r8)
+       mulx(   8(up,n,8), %r11, %r10)
+       jmp     L(lo1)
+
+L(end):        adcx(   %r10, %r13)
+       mov     %r11, -8(rp)
+L(wd2):        adox(   (rp), %r13)
+       adcx(   %r12, %rbx)
+       mov     %r13, (rp)
+L(wd1):        adox(   8(rp), %rbx)
+       adcx(   %rcx, %rax)
+       adox(   %rcx, %rax)
+       mov     %rbx, 8(rp)
+       pop     %r13
+       pop     %r12
+       pop     %rbx
+       ret
+
+L(top):        jrcxz   L(end)
+       mulx(   (up,n,8), %r9, %r8)
+       adcx(   %r10, %r13)
+       mov     %r11, -8(rp,n,8)
+L(lo2):        adox(   (rp,n,8), %r13)
+       mulx(   8(up,n,8), %r11, %r10)
+       adcx(   %r12, %rbx)
+       mov     %r13, (rp,n,8)
+L(lo1):        adox(   8(rp,n,8), %rbx)
+       mulx(   16(up,n,8), %r13, %r12)
+       adcx(   %rax, %r9)
+       mov     %rbx, 8(rp,n,8)
+L(lo0):        adox(   16(rp,n,8), %r9)
+       mulx(   24(up,n,8), %rbx, %rax)
+       adcx(   %r8, %r11)
+       mov     %r9, 16(rp,n,8)
+L(lo3):        adox(   24(rp,n,8), %r11)
+       lea     4(n), n
+       jmp     L(top)
+EPILOGUE()
+ASM_END()
diff --git a/mpn/x86_64/mulx/aorsmul_1.asm b/mpn/x86_64/mulx/aorsmul_1.asm
new file mode 100644 (file)
index 0000000..285c073
--- /dev/null
@@ -0,0 +1,161 @@
+dnl  AMD64 mpn_addmul_1 and mpn_submul_1 for CPUs with mulx.
+
+dnl  Copyright 2012, 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     -
+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 HWL     ?
+C Intel BWL     ?
+C Intel atom    -
+C VIA nano      -
+
+define(`rp',      `%rdi')   C rcx
+define(`up',      `%rsi')   C rdx
+define(`n_param', `%rdx')   C r8
+define(`v0_param',`%rcx')   C r9
+
+define(`n',       `%rcx')
+define(`v0',      `%rdx')
+
+ifdef(`OPERATION_addmul_1',`
+      define(`ADDSUB',        `add')
+      define(`ADCSBB',        `adc')
+      define(`func',  `mpn_addmul_1')
+')
+ifdef(`OPERATION_submul_1',`
+      define(`ADDSUB',        `sub')
+      define(`ADCSBB',        `sbb')
+      define(`func',  `mpn_submul_1')
+')
+
+MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
+
+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
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(func)
+       mov     (up), %r8
+
+       push    %rbx
+       push    %r12
+       push    %r13
+
+       lea     (up,n_param,8), up
+       lea     -32(rp,n_param,8), rp
+       mov     R32(n_param), R32(%rax)
+       xchg    v0_param, v0            C FIXME: is this insn fast?
+
+       neg     n
+
+       and     $3, R8(%rax)
+       jz      L(b0)
+       cmp     $2, R8(%rax)
+       jz      L(b2)
+       jg      L(b3)
+
+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
+       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
+       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
+       add     %r10, %r13
+       adc     %r12, %rbx
+       adc     $0, %rax
+       sub     $-3, n
+       jz      L(wd3)
+       test    R32(%rax), R32(%rax)            C clear cy
+       jmp     L(lo3)
+
+L(b2): mulx    %r8, %r13, %r12
+       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
+       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
+       ADCSBB  %r11, 8(rp,n,8)
+L(lo2):        mulx    8(up,n,8), %r11, %r10
+       ADCSBB  %r13, 16(rp,n,8)
+L(lo1):        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
+       adc     %r8, %r11
+       adc     %r10, %r13
+       adc     %r12, %rbx
+       adc     $0, %rax                C rax = carry limb
+       add     $4, n
+       js      L(top)
+
+L(end):        ADDSUB  %r9, (rp)
+L(wd3):        ADCSBB  %r11, 8(rp)
+L(wd2):        ADCSBB  %r13, 16(rp)
+L(wd1):        ADCSBB  %rbx, 24(rp)
+       adc     n, %rax
+       pop     %r13
+       pop     %r12
+       pop     %rbx
+       ret
+EPILOGUE()
+ASM_END()
diff --git a/mpn/x86_64/mulx/mul_1.asm b/mpn/x86_64/mulx/mul_1.asm
new file mode 100644 (file)
index 0000000..34a044d
--- /dev/null
@@ -0,0 +1,154 @@
+dnl  AMD64 mpn_mul_1 for CPUs with mulx.
+
+dnl  Copyright 2012, 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     -
+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 HWL     ?
+C Intel BWL     ?
+C Intel atom    -
+C VIA nano      -
+
+define(`rp',      `%rdi')   C rcx
+define(`up',      `%rsi')   C rdx
+define(`n_param', `%rdx')   C r8
+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
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_mul_1c)
+       jmp     L(ent)
+EPILOGUE()
+PROLOGUE(mpn_mul_1)
+       xor     R32(%r8), R32(%r8)      C carry-in limb
+L(ent):        mov     (up), %r9
+
+       push    %rbx
+       push    %r12
+       push    %r13
+
+       lea     (up,n_param,8), up
+       lea     -32(rp,n_param,8), rp
+       mov     R32(n_param), R32(%rax)
+       xchg    v0_param, v0            C FIXME: is this insn fast?
+
+       neg     n
+
+       and     $3, R8(%rax)
+       jz      L(b0)
+       cmp     $2, R8(%rax)
+       jz      L(b2)
+       jg      L(b3)
+
+L(b1): mov     %r8, %r12
+       mulx    %r9, %rbx, %rax
+       sub     $-1, n
+       jz      L(wd1)
+       mulx    (up,n,8), %r9, %r8
+       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
+       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
+       sub     $-2, n
+       jz      L(wd2)
+       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
+       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
+       adc     %r10, %r13
+       mov     %r11, 8(rp,n,8)
+L(lo2):        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
+       adc     %rax, %r9
+       mov     %rbx, 24(rp,n,8)
+L(lo0):        mulx    24(up,n,8), %rbx, %rax
+       lea     4(n), n
+       jmp     L(top)
+
+L(end):        mov     %r9, (rp)
+L(wd3):        adc     %r8, %r11
+       mov     %r11, 8(rp)
+L(wd2):        adc     %r10, %r13
+       mov     %r13, 16(rp)
+L(wd1):        adc     %r12, %rbx
+       adc     n, %rax
+       mov     %rbx, 24(rp)
+
+       pop     %r13
+       pop     %r12
+       pop     %rbx
+       ret
+EPILOGUE()
+ASM_END()
index 6c6e9db79a6a5c80d1c7f95923a44b2d34853317..f0dc54a55e772b7d9ed594af64f5ef499bd92814 100644 (file)
@@ -3,19 +3,30 @@ dnl  X86-64 mpn_copyd optimised for Intel Sandy Bridge.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 47144498cc41853f43843c0679d51406688b3ca5..9c26e00c522afcb9a89104da43145a3f2c737fde 100644 (file)
@@ -3,19 +3,30 @@ dnl  X86-64 mpn_copyi optimised for Intel Sandy Bridge.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 2edbcd94c706b58cd1021007815972082481498b..e9a07631c4bb13dde020678d69b12062cee7d99c 100644 (file)
@@ -1,22 +1,32 @@
 dnl  AMD64 mpn_divexact_1 -- mpn by limb exact division.
 
-dnl  Copyright 2001, 2002, 2004, 2005, 2006, 2010, 2011, 2012 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2001, 2002, 2004-2006, 2010-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 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  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
+dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index bbbdbcd8248887cc1caf6129e5c2540a70b705d4..3d8e5c7ab12a17367073df93486bdf5fa1abd105 100644 (file)
@@ -3,19 +3,30 @@ dnl  AMD64 mpn_gcd_1.
 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index d93548faef232141b0bdd08e04635fb9779acb9a..fde69dbb7fc833021c876feb7690e7e01204062e 100644 (file)
 /* VIA Nano gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2010, 2012, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 #define SHLD_SLOW 1
 #define SHRD_SLOW 1
 
 /* 1600 MHz Nano 2xxx */
+/* FFT tuning limit = 25000000 */
+/* Generated by tuneup.c, 2014-03-12, gcc 4.2 */
 
 #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_1U_TO_MOD_1_1_THRESHOLD          2
 #define MOD_1_1_TO_MOD_1_2_THRESHOLD        18
 #define MOD_1_2_TO_MOD_1_4_THRESHOLD        20
 #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           22
 
 #define MUL_TOOM22_THRESHOLD                27
-#define MUL_TOOM33_THRESHOLD                33
-#define MUL_TOOM44_THRESHOLD               290
-#define MUL_TOOM6H_THRESHOLD               718
-#define MUL_TOOM8H_THRESHOLD               915
+#define MUL_TOOM33_THRESHOLD                38
+#define MUL_TOOM44_THRESHOLD               324
+#define MUL_TOOM6H_THRESHOLD               450
+#define MUL_TOOM8H_THRESHOLD               632
 
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD      67
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     184
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD     193
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD     193
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD     287
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD      73
+#define MUL_TOOM32_TO_TOOM53_THRESHOLD     207
+#define MUL_TOOM42_TO_TOOM53_THRESHOLD     211
+#define MUL_TOOM42_TO_TOOM63_THRESHOLD     219
+#define MUL_TOOM43_TO_TOOM54_THRESHOLD     315
 
-#define SQR_BASECASE_THRESHOLD               0  /* always (native) */
-#define SQR_TOOM2_THRESHOLD                 34
-#define SQR_TOOM3_THRESHOLD                 93
-#define SQR_TOOM4_THRESHOLD                587
-#define SQR_TOOM6_THRESHOLD               1095
-#define SQR_TOOM8_THRESHOLD                  0  /* always */
+#define SQR_BASECASE_THRESHOLD              10
+#define SQR_TOOM2_THRESHOLD                 52
+#define SQR_TOOM3_THRESHOLD                 73
+#define SQR_TOOM4_THRESHOLD                387
+#define SQR_TOOM6_THRESHOLD                662
+#define SQR_TOOM8_THRESHOLD                781
 
-#define MULMID_TOOM42_THRESHOLD             28
+#define MULMID_TOOM42_THRESHOLD             32
 
-#define MULMOD_BNM1_THRESHOLD               13
-#define SQRMOD_BNM1_THRESHOLD               17
+#define MULMOD_BNM1_THRESHOLD               14
+#define SQRMOD_BNM1_THRESHOLD               15
 
 #define MUL_FFT_MODF_THRESHOLD             376  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    376, 5}, {     21, 6}, {     11, 5}, {     23, 6}, \
-    {     12, 5}, {     25, 6}, {     13, 5}, {     27, 6}, \
-    {     15, 5}, {     31, 6}, {     21, 7}, {     11, 6}, \
-    {     24, 7}, {     13, 6}, {     27, 7}, {     15, 6}, \
-    {     31, 7}, {     19, 6}, {     39, 7}, {     21, 8}, \
-    {     11, 7}, {     25, 8}, {     13, 7}, {     27, 8}, \
-    {     15, 7}, {     32, 8}, {     17, 7}, {     35, 8}, \
-    {     19, 7}, {     40, 8}, {     23, 7}, {     47, 8}, \
-    {     27, 9}, {     15, 8}, {     35, 9}, {     19, 8}, \
-    {     39, 4}, {    767, 5}, {    399, 6}, {    201, 5}, \
-    {    415, 6}, {    208, 7}, {    105, 6}, {    214, 7}, \
-    {    127, 8}, {     71, 9}, {     39, 8}, {     87, 9}, \
-    {     47, 8}, {     97, 9}, {     55,11}, {     15,10}, \
-    {     31, 9}, {     67, 8}, {    135, 9}, {     75,10}, \
-    {     39, 9}, {     87,10}, {     47, 9}, {     99,10}, \
-    {     55,11}, {     31,10}, {     63, 9}, {    127,10}, \
-    {     87,11}, {     47,10}, {    103,12}, {     31,11}, \
-    {     63,10}, {    143,11}, {     79,10}, {    167,11}, \
-    {     95,10}, {    199,11}, {    111,12}, {     63,11}, \
-    {    127, 9}, {    511,11}, {    143,10}, {    287,11}, \
-    {    159, 9}, {    639,11}, {    175,12}, {     95,11}, \
-    {    191,10}, {    383, 9}, {    767,11}, {    207,10}, \
-    {    415, 9}, {    831,13}, {     63,12}, {    127,11}, \
-    {    255,10}, {    511, 9}, {   1023,11}, {    271,10}, \
-    {    543, 9}, {   1087,11}, {    287,10}, {    575,12}, \
-    {    159,11}, {    319,10}, {    639, 9}, {   1279,11}, \
-    {    335,10}, {    671, 9}, {   1343,10}, {    703, 9}, \
+  { {    376, 5}, {     19, 6}, {     10, 5}, {     21, 6}, \
+    {     23, 7}, {     12, 6}, {     25, 7}, {     21, 8}, \
+    {     11, 7}, {     24, 8}, {     13, 7}, {     27, 8}, \
+    {     15, 7}, {     31, 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}, {     43,10}, \
+    {     23, 9}, {     55,11}, {     15,10}, {     31, 9}, \
+    {     67,10}, {     39, 9}, {     83,10}, {     47, 9}, \
+    {     95,10}, {     79,11}, {     47,10}, {    103,12}, \
+    {     31,11}, {     63,10}, {    143,11}, {     79,10}, \
+    {    159, 9}, {    319,10}, {    175,11}, {     95, 9}, \
+    {    383, 8}, {    767,10}, {    207,11}, {    111,12}, \
+    {     63,11}, {    127,10}, {    255,11}, {    143, 9}, \
+    {    575, 8}, {   1151,10}, {    303,11}, {    159,10}, \
+    {    319, 9}, {    639, 8}, {   1279,10}, {    335,12}, \
+    {     95,11}, {    191,10}, {    383, 9}, {    767,11}, \
+    {    207,10}, {    415, 9}, {    831, 8}, {   1663,10}, \
+    {    447,13}, {     63,12}, {    127,11}, {    255,10}, \
+    {    511, 9}, {   1023,11}, {    271,10}, {    543, 9}, \
+    {   1087,10}, {    575, 9}, {   1215,12}, {    159,11}, \
+    {    319,10}, {    639, 9}, {   1279,11}, {    335,10}, \
+    {    671, 9}, {   1343,11}, {    351,10}, {    703, 9}, \
     {   1407,12}, {    191,11}, {    383,10}, {    767, 9}, \
-    {   1535,11}, {    415,10}, {    831, 9}, {   1663,12}, \
-    {    223,11}, {    447,13}, {    127,12}, {    255,11}, \
+    {   1535,10}, {    831, 9}, {   1663,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}, {    671,10}, {   1343,12}, \
-    {    351,11}, {    703,10}, {   1407,13}, {    191,12}, \
-    {    383,11}, {    767,10}, {   1599,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}, {   1343,12}, {    703,11}, {   1407,12}, \
-    {    735,11}, {   1471,13}, {    383,12}, {    767,11}, \
-    {   1535,12}, {    831,11}, {   1663,13}, {    447,12}, \
-    {    895,11}, {   1791,12}, {    959,11}, {   1919,13}, \
-    {    511,12}, {   1023,11}, {   2047,12}, {   1087,11}, \
-    {   2175,13}, {    575,12}, {   1215,13}, {    639,12}, \
-    {   1343,13}, {    703,12}, {   1471,13}, {    767,12}, \
+    {   1215,12}, {    319,11}, {    639,10}, {   1279,11}, \
+    {    671,10}, {   1343,12}, {    351,11}, {    703,10}, \
+    {   1407,13}, {    191,12}, {    383,11}, {    767,10}, \
+    {   1535,12}, {    415,11}, {    831,10}, {   1663,12}, \
+    {    447,11}, {    895,10}, {   1791,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,13}, \
+    {    383,12}, {    767,11}, {   1535,12}, {    831,11}, \
+    {   1663,13}, {    447,12}, {    895,11}, {   1791,13}, \
+    {    511,12}, {   1023,11}, {   2047,12}, {   1087,13}, \
+    {    575,12}, {   1151,11}, {   2303,12}, {   1215,13}, \
+    {    639,12}, {   1279,11}, {   2559,12}, {   1343,13}, \
+    {    703,12}, {   1407,14}, {    383,13}, {    767,12}, \
     {   1535,13}, {    831,12}, {   1663,13}, {    895,12}, \
-    {   1791,13}, {    959,12}, {   1919,14}, {    511,13}, \
-    {   1023,12}, {   2047,13}, {   1087,12}, {   2175,13}, \
-    {   1215,14}, {    639,13}, {   1471,14}, {    767,13}, \
-    {   1727,14}, {    895,13}, {   1791,12}, {   3583,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 215
-#define MUL_FFT_THRESHOLD                 3200
-
-#define SQR_FFT_MODF_THRESHOLD             400  /* k = 5 */
+    {   1791,13}, {    959,14}, {    511,13}, {   1023,12}, \
+    {   2047,13}, {   1087,12}, {   2175,13}, {   1151,12}, \
+    {   2303,13}, {   1215,14}, {    639,13}, {   1279,12}, \
+    {   2559,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}, {   2047,12}, {   4095,13}, \
+    {   2175,14}, {   1151,13}, {   2303,12}, {   4607,13}, \
+    {   2431,14}, {   1279,13}, {   2559,12}, {   5119,14}, \
+    {   1407,13}, {   2815,12}, {   5631,15}, {  32768,16}, \
+    {  65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
+    {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
+#define MUL_FFT_TABLE3_SIZE 224
+#define MUL_FFT_THRESHOLD                 3520
+
+#define SQR_FFT_MODF_THRESHOLD             340  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    400, 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}, {     28, 8}, {     15, 7}, {     32, 8}, \
-    {     17, 7}, {     35, 8}, {     19, 7}, {     39, 8}, \
-    {     27, 9}, {     15, 8}, {     35, 9}, {     19, 8}, \
+  { {    340, 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}, \
     {     41, 9}, {     23, 8}, {     47, 9}, {     27,10}, \
-    {     15, 6}, {    255, 4}, {   1151, 5}, {    607, 7}, \
-    {    167, 8}, {     99, 9}, {     55,10}, {     31, 9}, \
-    {     75,10}, {     39, 9}, {     87,10}, {     47, 9}, \
-    {    103,10}, {     55, 9}, {    111,11}, {     31,10}, \
-    {     63, 9}, {    131,10}, {     71, 9}, {    143,10}, \
-    {     79,11}, {     47,10}, {    103,12}, {     31,11}, \
-    {     63,10}, {    135, 9}, {    271,10}, {    143,11}, \
-    {     79,10}, {    159, 9}, {    319,10}, {    167,11}, \
-    {     95,10}, {    191, 9}, {    383, 8}, {    767,10}, \
-    {    199,11}, {    111,12}, {     63,11}, {    127,10}, \
-    {    255, 9}, {    511, 8}, {   1023,11}, {    143, 9}, \
-    {    575, 8}, {   1151,11}, {    159,10}, {    319, 9}, \
-    {    639, 8}, {   1279,12}, {     95,11}, {    191,10}, \
-    {    383, 9}, {    767, 8}, {   1535, 9}, {    799,11}, \
+    {     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,10}, {     71, 9}, \
+    {    143,10}, {     79,11}, {     47,10}, {     95, 9}, \
+    {    191,10}, {    103,12}, {     31,11}, {     63,10}, \
+    {    127, 9}, {    255,10}, {    135, 7}, {   1087, 9}, \
+    {    287,11}, {     79, 9}, {    319, 8}, {    639,10}, \
+    {    167,11}, {     95,10}, {    191, 9}, {    383, 8}, \
+    {    767,11}, {    111,12}, {     63,11}, {    127,10}, \
+    {    255, 9}, {    511, 8}, {   1023,10}, {    271, 9}, \
+    {    543, 8}, {   1087,11}, {    143, 9}, {    575, 8}, \
+    {   1151,10}, {    303, 9}, {    639, 8}, {   1279,10}, \
+    {    335, 9}, {    671,10}, {    351, 9}, {    703,12}, \
+    {     95,11}, {    191,10}, {    383, 9}, {    767,11}, \
     {    207,10}, {    415, 9}, {    831,13}, {     63,12}, \
     {    127,11}, {    255,10}, {    511, 9}, {   1023,11}, \
     {    271,10}, {    543, 9}, {   1087,10}, {    575, 9}, \
-    {   1151,11}, {    303,12}, {    159,10}, {    639, 9}, \
-    {   1279,11}, {    335,10}, {    671, 9}, {   1343,11}, \
-    {    351,10}, {    703, 9}, {   1471,12}, {    191,11}, \
-    {    383,10}, {    767, 9}, {   1535,11}, {    399,10}, \
-    {    799,11}, {    415,10}, {    831, 9}, {   1663,12}, \
-    {    223,11}, {    447,10}, {    895,13}, {    127,12}, \
+    {   1151,11}, {    303,10}, {    607, 9}, {   1215,12}, \
+    {    159,11}, {    319,10}, {    639, 9}, {   1279,10}, \
+    {    671, 9}, {   1343,11}, {    351,10}, {    703, 9}, \
+    {   1407,12}, {    191,11}, {    383,10}, {    767, 9}, \
+    {   1535,11}, {    415,10}, {    831, 9}, {   1663,12}, \
+    {    223,11}, {    447,10}, {    959,13}, {    127,12}, \
     {    255,11}, {    511,10}, {   1023,11}, {    543,10}, \
-    {   1087,12}, {    287,11}, {    575,10}, {   1215,11}, \
-    {    639,10}, {   1279,11}, {    671,10}, {   1343,11}, \
-    {    703,10}, {   1407,11}, {    735,10}, {   1471,13}, \
-    {    191,12}, {    383,11}, {    767,10}, {   1535,11}, \
-    {    799,10}, {   1599,12}, {    415,11}, {    831,10}, \
-    {   1663,11}, {    863,12}, {    447,11}, {    895,10}, \
-    {   1791,11}, {    959,14}, {    127,12}, {    511,11}, \
-    {   1023,12}, {    543,11}, {   1087,12}, {    575,11}, \
-    {   1215,12}, {    639,11}, {   1279,12}, {    671,11}, \
-    {   1343,12}, {    703,11}, {   1471,13}, {    383,12}, \
-    {    767,11}, {   1535,12}, {    799,11}, {   1599,12}, \
-    {    831,11}, {   1663,12}, {    863,13}, {    447,12}, \
-    {    895,11}, {   1791,12}, {    959,13}, {    511,12}, \
-    {   1023,11}, {   2047,12}, {   1087,13}, {    575,12}, \
-    {   1215,13}, {    639,12}, {   1343,13}, {    703,12}, \
-    {   1471,13}, {    767,12}, {   1599,13}, {    831,12}, \
-    {   1727,13}, {    895,12}, {   1791,13}, {    959,12}, \
-    {   1919,14}, {    511,13}, {   1023,12}, {   2047,13}, \
-    {   1215,14}, {    639,13}, {   1471,14}, {    767,13}, \
-    {   1727,14}, {    895,13}, {   1791,12}, {   3583,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 215
-#define SQR_FFT_THRESHOLD                 2880
-
-#define MULLO_BASECASE_THRESHOLD             0  /* always */
-#define MULLO_DC_THRESHOLD                  79
-#define MULLO_MUL_N_THRESHOLD             6253
-
-#define DC_DIV_QR_THRESHOLD                 54
-#define DC_DIVAPPR_Q_THRESHOLD             153
-#define DC_BDIV_QR_THRESHOLD                51
-#define DC_BDIV_Q_THRESHOLD                 52
-
-#define INV_MULMOD_BNM1_THRESHOLD           52
-#define INV_NEWTON_THRESHOLD               150
-#define INV_APPR_THRESHOLD                 151
-
-#define BINV_NEWTON_THRESHOLD              232
-#define REDC_1_TO_REDC_2_THRESHOLD          13
-#define REDC_2_TO_REDC_N_THRESHOLD          55
+    {   1087,11}, {    575,10}, {   1215,12}, {    319,11}, \
+    {    639,10}, {   1279,11}, {    671,10}, {   1343,12}, \
+    {    351,11}, {    703,10}, {   1407,13}, {    191,12}, \
+    {    383,11}, {    767,10}, {   1535,12}, {    415,11}, \
+    {    831,10}, {   1663,12}, {    447,11}, {    895,10}, \
+    {   1791,12}, {    479,11}, {    959,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,13}, {    383,12}, \
+    {    767,11}, {   1535,12}, {    831,11}, {   1663,13}, \
+    {    447,12}, {    895,11}, {   1791,12}, {    959,13}, \
+    {    511,12}, {   1023,11}, {   2047,12}, {   1087,13}, \
+    {    575,12}, {   1215,13}, {    639,12}, {   1343,13}, \
+    {    703,12}, {   1407,11}, {   2815,13}, {    767,12}, \
+    {   1535,13}, {    831,12}, {   1663,13}, {    895,12}, \
+    {   1791,13}, {    959,14}, {    511,13}, {   1023,12}, \
+    {   2047,13}, {   1087,12}, {   2175,13}, {   1215,14}, \
+    {    639,13}, {   1279,12}, {   2559,13}, {   1407,12}, \
+    {   2815,14}, {    767,13}, {   1535,12}, {   3071,13}, \
+    {   1663,14}, {    895,13}, {   1791,12}, {   3583,13}, \
+    {   1919,15}, {    511,14}, {   1023,13}, {   2047,12}, \
+    {   4095,13}, {   2175,14}, {   1151,13}, {   2303,12}, \
+    {   4607,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 230
+#define SQR_FFT_THRESHOLD                 2496
+
+#define MULLO_BASECASE_THRESHOLD            13
+#define MULLO_DC_THRESHOLD                  38
+#define MULLO_MUL_N_THRESHOLD             6633
+
+#define DC_DIV_QR_THRESHOLD                 56
+#define DC_DIVAPPR_Q_THRESHOLD             173
+#define DC_BDIV_QR_THRESHOLD                55
+#define DC_BDIV_Q_THRESHOLD                 96
+
+#define INV_MULMOD_BNM1_THRESHOLD           54
+#define INV_NEWTON_THRESHOLD               202
+#define INV_APPR_THRESHOLD                 166
+
+#define BINV_NEWTON_THRESHOLD              246
+#define REDC_1_TO_REDC_2_THRESHOLD           7
+#define REDC_2_TO_REDC_N_THRESHOLD          85
 
 #define MU_DIV_QR_THRESHOLD               1499
-#define MU_DIVAPPR_Q_THRESHOLD            1620
-#define MUPI_DIV_QR_THRESHOLD               75
-#define MU_BDIV_QR_THRESHOLD              1142
+#define MU_DIVAPPR_Q_THRESHOLD            1652
+#define MUPI_DIV_QR_THRESHOLD               83
+#define MU_BDIV_QR_THRESHOLD              1210
 #define MU_BDIV_Q_THRESHOLD               1499
 
-#define POWM_SEC_TABLE  4,29,387,1421
+#define POWM_SEC_TABLE  1,28,129,642,2387
 
-#define MATRIX22_STRASSEN_THRESHOLD         17
-#define HGCD_THRESHOLD                     112
-#define HGCD_APPR_THRESHOLD                185
-#define HGCD_REDUCE_THRESHOLD             3134
-#define GCD_DC_THRESHOLD                   492
-#define GCDEXT_DC_THRESHOLD                465
+#define MATRIX22_STRASSEN_THRESHOLD         15
+#define HGCD_THRESHOLD                     127
+#define HGCD_APPR_THRESHOLD                214
+#define HGCD_REDUCE_THRESHOLD             2479
+#define GCD_DC_THRESHOLD                   487
+#define GCDEXT_DC_THRESHOLD                505
 #define JACOBI_BASE_METHOD                   4
 
-#define GET_STR_DC_THRESHOLD                11
-#define GET_STR_PRECOMPUTE_THRESHOLD        25
-#define SET_STR_DC_THRESHOLD               414
-#define SET_STR_PRECOMPUTE_THRESHOLD      1945
+#define GET_STR_DC_THRESHOLD                12
+#define GET_STR_PRECOMPUTE_THRESHOLD        24
+#define SET_STR_DC_THRESHOLD               802
+#define SET_STR_PRECOMPUTE_THRESHOLD      2042
 
-#define FAC_DSC_THRESHOLD                 1517
+#define FAC_DSC_THRESHOLD                 1737
 #define FAC_ODD_THRESHOLD                   44
index 4753acfb6a7a3d910629994461a14164d56bd07e..fb14dd3d318c2f8cdaf92f41ee0cec8273d56c35 100644 (file)
@@ -3,19 +3,30 @@ dnl  x86-64 mpn_popcount.
 dnl  Copyright 2007, 2011 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index f238d03b01a991d273f01564f1e5af4afba7b271..8e6ee1bae6bb6a745252a00040f54261f2ed0cb0 100644 (file)
@@ -2,22 +2,33 @@ dnl  x86-64 mpn_add_n/mpn_sub_n optimized for Pentium 4.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2007, 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2007, 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 24aecff6186e208a562297733bd6dcfa5e1345c9..66937d32678851b3af91af4593278275302acd29 100644 (file)
@@ -3,22 +3,33 @@ dnl  optimised for Pentium 4.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 4f2d52b30aade5c8f7afc1fe1d6cfdd3d85e24c9..001f0ac5bfa726cd7b746cc86f7a5db01871a9cb 100644 (file)
@@ -3,22 +3,33 @@ dnl  optimised for Pentium 4.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index c61f6f998cadd0dcf7c4bcb135c4745607ea8798..d03c6a3f305e72a4d741f164321f2ba4339c2398 100644 (file)
@@ -3,22 +3,33 @@ dnl  C is 1, 2, 3.  Optimized for Pentium 4.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 C           cycles/limb
 C AMD K8,K9     3.8
@@ -184,7 +195,6 @@ L(1):       mov     %r11, 8(rp)
        pop     %rbp
        pop     %r12
        pop     %rbx
-       emms
        FUNC_EXIT()
        ret
 L(c3): mov     $1, R8(%rax)
index 37c94dc46f33cba0a18d2ab43b880bd73b8c3aa6..2171e230a5ce079ad62d25a9067edccb777d545a 100644 (file)
@@ -1,25 +1,35 @@
 /* Pentium 4-64 gmp-mparam.h -- Compiler/machine parameter header file.
 
-Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000-2010, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 BYTES_PER_MP_LIMB 8
+#define GMP_LIMB_BYTES 8
 
 /* These routines exists for all x86_64 chips, but they are slower on Pentium4
    than separate add/sub and shift.  Make sure they are not really used.  */
@@ -28,138 +38,194 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #undef HAVE_NATIVE_mpn_addlsh_n
 #undef HAVE_NATIVE_mpn_rsblsh_n
 
-/* 3400 MHz Pentium / 1024 Kibyte cache */
+/* 3400 MHz Pentium4 Nocona / 1024 Kibyte cache */
+/* 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          4
-#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        36
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD      8
+#define MOD_1U_TO_MOD_1_1_THRESHOLD          3
+#define MOD_1_1_TO_MOD_1_2_THRESHOLD        16
+#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_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 MUL_TOOM22_THRESHOLD                11
-#define MUL_TOOM33_THRESHOLD                68
-#define MUL_TOOM44_THRESHOLD               120
+#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_TOOM32_TO_TOOM43_THRESHOLD      81
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD     131
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD     122
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD      80
+#define MUL_TOOM32_TO_TOOM43_THRESHOLD      73
+#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 SQR_BASECASE_THRESHOLD               0  /* always (native) */
-#define SQR_TOOM2_THRESHOLD                 18
-#define SQR_TOOM3_THRESHOLD                 81
-#define SQR_TOOM4_THRESHOLD                214
-#define SQR_TOOM6_THRESHOLD                238
-#define SQR_TOOM8_THRESHOLD                430
+#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 MULMID_TOOM42_THRESHOLD             16
+#define MULMID_TOOM42_THRESHOLD             22
 
 #define MULMOD_BNM1_THRESHOLD                9
 #define SQRMOD_BNM1_THRESHOLD                9
 
-#define MUL_FFT_MODF_THRESHOLD             236  /* k = 5 */
+#define MUL_FFT_MODF_THRESHOLD             252  /* k = 5 */
 #define MUL_FFT_TABLE3                                      \
-  { {    236, 5}, {      9, 4}, {     19, 5}, {     13, 6}, \
-    {      9, 5}, {     19, 6}, {     13, 7}, {      7, 6}, \
-    {     15, 7}, {      8, 6}, {     17, 7}, {      9, 6}, \
-    {     19, 7}, {     11, 6}, {     23, 7}, {     13, 8}, \
-    {      7, 7}, {     17, 8}, {      9, 7}, {     21, 8}, \
+  { {    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}, \
     {     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, 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,10}, \
-    {    303,11}, {    159,10}, {    319,11}, {    175,12}, \
-    {     95,11}, {    191,10}, {    383,11}, {    223,13}, \
-    {   8192,14}, {  16384,15}, {  32768,16}, {  65536,17}, \
+    {     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}, \
+    {    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 91
+#define MUL_FFT_TABLE3_SIZE 211
 #define MUL_FFT_THRESHOLD                 2240
 
-#define SQR_FFT_MODF_THRESHOLD             216  /* k = 5 */
+#define SQR_FFT_MODF_THRESHOLD             212  /* k = 5 */
 #define SQR_FFT_TABLE3                                      \
-  { {    216, 5}, {     13, 6}, {      9, 5}, {     19, 6}, \
-    {     15, 7}, {      8, 6}, {     17, 7}, {      9, 6}, \
-    {     19, 7}, {     10, 6}, {     21, 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}, \
-    {     23, 8}, {     47, 9}, {     27,10}, {     15, 9}, \
-    {     39,10}, {     23, 9}, {     47,11}, {     15,10}, \
-    {     31, 9}, {     63, 8}, {    127,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, 9}, {    255,10}, \
-    {    143, 9}, {    287,11}, {     79,10}, {    159, 9}, \
-    {    319,10}, {    175, 9}, {    351,11}, {     95,10}, \
-    {    191, 9}, {    383,10}, {    207,11}, {    111,12}, \
-    {     63,11}, {    127,10}, {    255,11}, {    143,10}, \
-    {    287,11}, {    159,10}, {    319, 9}, {    639,11}, \
-    {    175,10}, {    351,12}, {     95,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
+  { {    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}, \
+    {     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}, \
+    {    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}, \
+    {    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}, \
+    {   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
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
 #define MULLO_DC_THRESHOLD                  33
 #define MULLO_MUL_N_THRESHOLD             4392
 
-#define DC_DIV_QR_THRESHOLD                 27
-#define DC_DIVAPPR_Q_THRESHOLD              60
-#define DC_BDIV_QR_THRESHOLD                27
-#define DC_BDIV_Q_THRESHOLD                 38
+#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 INV_MULMOD_BNM1_THRESHOLD           20
-#define INV_NEWTON_THRESHOLD               202
-#define INV_APPR_THRESHOLD                 106
+#define INV_MULMOD_BNM1_THRESHOLD           22
+#define INV_NEWTON_THRESHOLD               195
+#define INV_APPR_THRESHOLD                 116
 
-#define BINV_NEWTON_THRESHOLD              198
-#define REDC_1_TO_REDC_2_THRESHOLD          16
-#define REDC_2_TO_REDC_N_THRESHOLD          43
+#define BINV_NEWTON_THRESHOLD              199
+#define REDC_1_TO_REDC_2_THRESHOLD           4
+#define REDC_2_TO_REDC_N_THRESHOLD          42
 
 #define MU_DIV_QR_THRESHOLD                979
 #define MU_DIVAPPR_Q_THRESHOLD             979
-#define MUPI_DIV_QR_THRESHOLD               92
-#define MU_BDIV_QR_THRESHOLD               807
+#define MUPI_DIV_QR_THRESHOLD               91
+#define MU_BDIV_QR_THRESHOLD               855
 #define MU_BDIV_Q_THRESHOLD                942
 
-#define POWM_SEC_TABLE  6,65,192,792,2578
+#define POWM_SEC_TABLE  1,16,175,692,1603
 
 #define MATRIX22_STRASSEN_THRESHOLD         17
-#define HGCD_THRESHOLD                      99
-#define HGCD_APPR_THRESHOLD                121
+#define HGCD_THRESHOLD                     109
+#define HGCD_APPR_THRESHOLD                119
 #define HGCD_REDUCE_THRESHOLD             1679
-#define GCD_DC_THRESHOLD                   205
-#define GCDEXT_DC_THRESHOLD                225
+#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               232
-#define SET_STR_PRECOMPUTE_THRESHOLD      1585
+#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_ODD_THRESHOLD                    0  /* always */
index 19c641bd9290e5d5b59eceaa8365ab5e3ebddc7f..d3b521364fffc9ca541f794bd2187c96fc28a208 100644 (file)
@@ -3,19 +3,30 @@ dnl  x86-64 mpn_lshift optimized for Pentium 4.
 dnl  Copyright 2003, 2005, 2007, 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 39894903876c55a499c7f684b8d8c763b08b86de..fc64676574eb4f70a91615b142b4f31ef056d7b0 100644 (file)
@@ -4,19 +4,30 @@ dnl  Copyright 2003, 2005, 2007, 2008, 2010, 2012 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 2974fcc7b18380d2634f7927cf2a203b52ed1718..f34b3f079ab474c793d24b06138ebea92ead9f5d 100644 (file)
@@ -1,22 +1,33 @@
 dnl  AMD64 mpn_mod_34lsub1 -- remainder modulo 2^48-1.
 
-dnl  Copyright 2000, 2001, 2002, 2004, 2005, 2007, 2010, 2011, 2012 Free
-dnl  Software Foundation, Inc.
+dnl  Copyright 2000-2002, 2004, 2005, 2007, 2010-2012 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 7b52044a9dcaa3c5659454129175e1e94582ed09..7014b39de562477984811554cd113f28e84ddc89 100644 (file)
@@ -3,19 +3,30 @@ dnl  x86-64 mpn_popcount optimized for Pentium 4.
 dnl  Copyright 2007 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
index ca09a735fd3068051838a91be8ced8b2254b8f8c..5528ce47dae58c7a0babfb1a9a99c49a5e9e71c5 100644 (file)
@@ -2,22 +2,33 @@ dnl  x86-64 mpn_rsh1add_n/mpn_rsh1sub_n optimized for Pentium 4.
 
 dnl  Contributed to the GNU project by Torbjorn Granlund.
 
-dnl  Copyright 2007, 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2007, 2008, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index c491b4f77b53d64ccbdbfd1c836b2fbe07a3912a..b7c1ee2cdd49aa80bc90f10a556aec59313bce4d 100644 (file)
@@ -3,19 +3,30 @@ dnl  x86-64 mpn_rshift optimized for Pentium 4.
 dnl  Copyright 2003, 2005, 2007, 2008, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/pentium4/sec_tabselect.asm b/mpn/x86_64/pentium4/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..e436034
--- /dev/null
@@ -0,0 +1,37 @@
+dnl  X86-64 mpn_sec_tabselect.
+
+dnl  Copyright 2012, 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')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+MULFUNC_PROLOGUE(mpn_sec_tabselect)
+include_mpn(`x86_64/fastsse/sec_tabselect.asm')
index a1f53da120ba9fa8dee1bc27fae73d47354b4039..9005f817762fd37e961d0c8e0f0f71f341562fba 100644 (file)
@@ -1,21 +1,32 @@
 dnl  AMD64 mpn_popcount, mpn_hamdist -- population count and hamming distance.
 
-dnl  Copyright 2004, 2005, 2007, 2010, 2011, 2012 Free Software Foundation, Inc.
+dnl  Copyright 2004, 2005, 2007, 2010-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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 include(`../config.m4')
diff --git a/mpn/x86_64/redc_1.asm b/mpn/x86_64/redc_1.asm
deleted file mode 100644 (file)
index b6404d4..0000000
+++ /dev/null
@@ -1,327 +0,0 @@
-dnl  AMD64 mpn_redc_1 -- Montgomery reduction with a one-limb modular inverse.
-
-dnl  Copyright 2004, 2008, 2011, 2012 Free Software Foundation, Inc.
-dnl
-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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
-dnl
-dnl  The GNU MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
-dnl
-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           cycles/limb
-C AMD K8,K9     2.5
-C AMD K10       2.5
-C Intel P4      ?
-C Intel core2   5.3
-C Intel corei   ?
-C Intel atom    ?
-C VIA nano      ?
-
-C TODO
-C  * Handle certain sizes, e.g., 1, 2, 3, 4, 8, with single-loop code.
-C    The code for 1, 2, 3, 4 should perhaps be completely register based.
-C  * Perhaps align outer loops.
-C  * We could software pipeline the IMUL stuff, by putting it before the
-C    outer loops and before the end of the outer loops.  The last outer
-C    loop iteration would then compute an unneeded product, but it is at
-C    least not a stray read from up[], since it is at up[n].
-C  * Make a tail call to mpn_add_n.
-
-C INPUT PARAMETERS
-define(`rp',     `%rdi')       C rcx
-define(`up',     `%rsi')       C rdx
-define(`mp_param',`%rdx')      C r8
-define(`n',      `%rcx')       C r9
-define(`invm',   `%r8')        C stack
-
-define(`mp',     `%r13')
-define(`i',      `%r11')
-define(`nneg',   `%r12')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
-       TEXT
-       ALIGN(32)
-PROLOGUE(mpn_redc_1)
-       FUNC_ENTRY(4)
-IFDOS(`        mov     56(%rsp), %r8   ')
-       push    %rbp
-       push    %rbx
-       push    %r12
-       push    %r13
-       push    %r14
-
-       lea     (mp_param,n,8), mp      C mp += n
-       lea     (up,n,8), up            C up += n
-
-       mov     n, nneg
-       neg     nneg
-
-       mov     R32(n), R32(%rax)
-       and     $3, R32(%rax)
-       jz      L(b0)
-       cmp     $2, R32(%rax)
-       jz      L(b2)
-       jg      L(b3)
-
-L(b1): C lea   (mp), mp
-       lea     -16(up), up
-L(o1): mov     nneg, i
-       mov     16(up,nneg,8), %rbp     C up[0]
-       imul    invm, %rbp
-
-       mov     (mp,i,8), %rax
-       xor     R32(%rbx), R32(%rbx)
-       mul     %rbp
-       add     $1, i
-       jnz     1f
-       add     %rax, 8(up,i,8)
-       adc     $0, %rdx
-       mov     %rdx, %r14
-       jmp     L(n1)
-
-1:     mov     %rax, %r9
-       mov     (mp,i,8), %rax
-       mov     %rdx, %r14
-       jmp     L(mi1)
-
-       ALIGN(16)
-L(lo1):        add     %r10, (up,i,8)
-       adc     %rax, %r9
-       mov     (mp,i,8), %rax
-       adc     %rdx, %r14
-L(mi1):        xor     R32(%r10), R32(%r10)
-       mul     %rbp
-       add     %r9, 8(up,i,8)
-       adc     %rax, %r14
-       adc     %rdx, %rbx
-       mov     8(mp,i,8), %rax
-       mul     %rbp
-       add     %r14, 16(up,i,8)
-       adc     %rax, %rbx
-       adc     %rdx, %r10
-       mov     16(mp,i,8), %rax
-       mul     %rbp
-       xor     R32(%r9), R32(%r9)
-       xor     R32(%r14), R32(%r14)
-       add     %rbx, 24(up,i,8)
-       adc     %rax, %r10
-       mov     24(mp,i,8), %rax
-       adc     %rdx, %r9
-       xor     R32(%rbx), R32(%rbx)
-       mul     %rbp
-       add     $4, i
-       js      L(lo1)
-L(ed1):        add     %r10, (up)
-       adc     %rax, %r9
-       adc     %rdx, %r14
-       xor     R32(%r10), R32(%r10)
-       add     %r9, 8(up)
-       adc     $0, %r14
-L(n1): mov     %r14, 16(up,nneg,8)     C up[0]
-       add     $8, up
-       dec     n
-       jnz     L(o1)
-       lea     16(up,nneg,8), up
-       jmp     L(common)
-
-L(b0): C lea   (mp), mp
-       lea     -16(up), up
-L(o0): mov     nneg, i
-       mov     16(up,nneg,8), %rbp     C up[0]
-       imul    invm, %rbp
-
-       mov     (mp,i,8), %rax
-       xor     R32(%r10), R32(%r10)
-       mul     %rbp
-       mov     %rax, %r14
-       mov     %rdx, %rbx
-       jmp     L(mi0)
-
-       ALIGN(16)
-L(lo0):        add     %r10, (up,i,8)
-       adc     %rax, %r9
-       mov     (mp,i,8), %rax
-       adc     %rdx, %r14
-       xor     R32(%r10), R32(%r10)
-       mul     %rbp
-       add     %r9, 8(up,i,8)
-       adc     %rax, %r14
-       adc     %rdx, %rbx
-L(mi0):        mov     8(mp,i,8), %rax
-       mul     %rbp
-       add     %r14, 16(up,i,8)
-       adc     %rax, %rbx
-       adc     %rdx, %r10
-       mov     16(mp,i,8), %rax
-       mul     %rbp
-       xor     R32(%r9), R32(%r9)
-       xor     R32(%r14), R32(%r14)
-       add     %rbx, 24(up,i,8)
-       adc     %rax, %r10
-       mov     24(mp,i,8), %rax
-       adc     %rdx, %r9
-       xor     R32(%rbx), R32(%rbx)
-       mul     %rbp
-       add     $4, i
-       js      L(lo0)
-L(ed0):        add     %r10, (up)
-       adc     %rax, %r9
-       adc     %rdx, %r14
-       xor     R32(%r10), R32(%r10)
-       add     %r9, 8(up)
-       adc     $0, %r14
-       mov     %r14, 16(up,nneg,8)     C up[0]
-       add     $8, up
-       dec     n
-       jnz     L(o0)
-       lea     16(up,nneg,8), up
-       jmp     L(common)
-
-L(b3): lea     -8(mp), mp
-       lea     -24(up), up
-L(o3): mov     nneg, i
-       mov     24(up,nneg,8), %rbp     C up[0]
-       imul    invm, %rbp
-
-       mov     8(mp,i,8), %rax
-       mul     %rbp
-       mov     %rax, %rbx
-       mov     %rdx, %r10
-       jmp     L(mi3)
-
-       ALIGN(16)
-L(lo3):        add     %r10, (up,i,8)
-       adc     %rax, %r9
-       mov     (mp,i,8), %rax
-       adc     %rdx, %r14
-       xor     R32(%r10), R32(%r10)
-       mul     %rbp
-       add     %r9, 8(up,i,8)
-       adc     %rax, %r14
-       adc     %rdx, %rbx
-       mov     8(mp,i,8), %rax
-       mul     %rbp
-       add     %r14, 16(up,i,8)
-       adc     %rax, %rbx
-       adc     %rdx, %r10
-L(mi3):        mov     16(mp,i,8), %rax
-       mul     %rbp
-       xor     R32(%r9), R32(%r9)
-       xor     R32(%r14), R32(%r14)
-       add     %rbx, 24(up,i,8)
-       adc     %rax, %r10
-       mov     24(mp,i,8), %rax
-       adc     %rdx, %r9
-       xor     R32(%rbx), R32(%rbx)
-       mul     %rbp
-       add     $4, i
-       js      L(lo3)
-L(ed3):        add     %r10, 8(up)
-       adc     %rax, %r9
-       adc     %rdx, %r14
-       xor     R32(%r10), R32(%r10)
-       add     %r9, 16(up)
-       adc     $0, %r14
-       mov     %r14, 24(up,nneg,8)     C up[0]
-       add     $8, up
-       dec     n
-       jnz     L(o3)
-       lea     24(up,nneg,8), up
-       jmp     L(common)
-
-L(b2): lea     -16(mp), mp
-       lea     -32(up), up
-L(o2): mov     nneg, i
-       mov     32(up,nneg,8), %rbp     C up[0]
-       imul    invm, %rbp
-
-       mov     16(mp,i,8), %rax
-       mul     %rbp
-       xor     R32(%r14), R32(%r14)
-       mov     %rax, %r10
-       mov     24(mp,i,8), %rax
-       mov     %rdx, %r9
-       jmp     L(mi2)
-
-       ALIGN(16)
-L(lo2):        add     %r10, (up,i,8)
-       adc     %rax, %r9
-       mov     (mp,i,8), %rax
-       adc     %rdx, %r14
-       xor     R32(%r10), R32(%r10)
-       mul     %rbp
-       add     %r9, 8(up,i,8)
-       adc     %rax, %r14
-       adc     %rdx, %rbx
-       mov     8(mp,i,8), %rax
-       mul     %rbp
-       add     %r14, 16(up,i,8)
-       adc     %rax, %rbx
-       adc     %rdx, %r10
-       mov     16(mp,i,8), %rax
-       mul     %rbp
-       xor     R32(%r9), R32(%r9)
-       xor     R32(%r14), R32(%r14)
-       add     %rbx, 24(up,i,8)
-       adc     %rax, %r10
-       mov     24(mp,i,8), %rax
-       adc     %rdx, %r9
-L(mi2):        xor     R32(%rbx), R32(%rbx)
-       mul     %rbp
-       add     $4, i
-       js      L(lo2)
-L(ed2):        add     %r10, 16(up)
-       adc     %rax, %r9
-       adc     %rdx, %r14
-       xor     R32(%r10), R32(%r10)
-       add     %r9, 24(up)
-       adc     $0, %r14
-       mov     %r14, 32(up,nneg,8)     C up[0]
-       add     $8, up
-       dec     n
-       jnz     L(o2)
-       lea     32(up,nneg,8), up
-
-
-L(common):
-
-C   cy = mpn_add_n (rp, up, up - n, n);
-C                  rdi rsi  rdx    rcx         STD
-C                  rcx rdx  r8     r9          DOS
-
-IFSTD(` lea    (up,nneg,8), %rdx       ') C rdx = up - n [up entry value]
-IFSTD(` mov    nneg, %rcx              ')
-IFSTD(` neg    %rcx                    ') C rcx = -nneg = n
-
-IFDOS(` lea    (up,nneg,8), %r8        ') C r8 = up - n
-IFDOS(` mov    up, %rdx                ') C rdx = up
-IFDOS(` mov    nneg, %r9               ')
-IFDOS(` neg    %r9                     ') C r9 = -nneg = n
-IFDOS(` mov    rp, %rcx                ') C rcx = rp
-
-       CALL(   mpn_add_n)
-
-       pop     %r14
-       pop     %r13
-       pop     %r12
-       pop     %rbx
-       pop     %rbp
-       FUNC_EXIT()
-       ret
-EPILOGUE()
index 4deb939dcac1b2805d56c5350e11e91d9ab7b990..a3e9cc5d2394ee0ab10fe983a0ea09892eab54b0 100644 (file)
@@ -4,19 +4,30 @@ dnl  AMD64 mpn_rsh1sub_n -- rp[] = (up[] - vp[]) >> 1
 dnl  Copyright 2003, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
index 8879f8012c657a0df0656585cd2c6bbc029c1f69..3f344f1dfc0a9f04e7c84a31a2ff70ef824fefea 100644 (file)
@@ -3,19 +3,30 @@ dnl  AMD64 mpn_rshift -- mpn right shift.
 dnl  Copyright 2003, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/sec_tabselect.asm b/mpn/x86_64/sec_tabselect.asm
new file mode 100644 (file)
index 0000000..e8aed26
--- /dev/null
@@ -0,0 +1,176 @@
+dnl  AMD64 mpn_sec_tabselect.
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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')
+
+
+C           cycles/limb          good for cpu
+C AMD K8,K9     1.5                    Y
+C AMD K10       1.4
+C AMD bd1       2.64
+C AMD bobcat    2.15                   Y
+C Intel P4      4
+C Intel core2   1.38
+C Intel NHM     1.75
+C Intel SBR     1.25
+C Intel atom    2.5                    Y
+C VIA nano      1.75                   Y
+
+C NOTES
+C  * This has not been tuned for any specific processor.  Its speed should not
+C    be too bad, though.
+C  * Using SSE2/AVX2 could result in many-fold speedup.
+C  * WORKS FOR n mod 4 = 0 ONLY!
+
+C mpn_sec_tabselect (mp_limb_t *rp, mp_limb_t *tp, mp_size_t n, mp_size_t nents, mp_size_t which)
+define(`rp',     `%rdi')
+define(`tp',     `%rsi')
+define(`n',      `%rdx')
+define(`nents',  `%rcx')
+define(`which',  `%r8')
+
+define(`i',      `%rbp')
+define(`j',      `%r9')
+
+C rax  rbx  rcx  rdx  rdi  rsi  rbp   r8   r9  r10  r11  r12  r13  r14  r15
+C          nents  n   rp   tab   i   which j    *    *    *    *    *    *
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(16)
+PROLOGUE(mpn_sec_tabselect)
+       FUNC_ENTRY(4)
+IFDOS(`        mov     56(%rsp), %r8d  ')
+
+       push    %rbx
+       push    %rbp
+       push    %r12
+       push    %r13
+       push    %r14
+       push    %r15
+
+       mov     n, j
+       add     $-4, j
+       js      L(outer_end)
+
+L(outer_top):
+       mov     nents, i
+       push    tp
+       xor     R32(%r12), R32(%r12)
+       xor     R32(%r13), R32(%r13)
+       xor     R32(%r14), R32(%r14)
+       xor     R32(%r15), R32(%r15)
+       mov     which, %rbx
+
+       ALIGN(16)
+L(top):        sub     $1, %rbx
+       sbb     %rax, %rax
+       mov     0(tp), %r10
+       mov     8(tp), %r11
+       and     %rax, %r10
+       and     %rax, %r11
+       or      %r10, %r12
+       or      %r11, %r13
+       mov     16(tp), %r10
+       mov     24(tp), %r11
+       and     %rax, %r10
+       and     %rax, %r11
+       or      %r10, %r14
+       or      %r11, %r15
+       lea     (tp,n,8), tp
+       add     $-1, i
+       jne     L(top)
+
+       mov     %r12, 0(rp)
+       mov     %r13, 8(rp)
+       mov     %r14, 16(rp)
+       mov     %r15, 24(rp)
+       pop     tp
+       lea     32(tp), tp
+       lea     32(rp), rp
+       add     $-4, j
+       jns     L(outer_top)
+L(outer_end):
+
+       test    $2, R8(n)
+       jz      L(b0x)
+L(b1x):        mov     nents, i
+       push    tp
+       xor     R32(%r12), R32(%r12)
+       xor     R32(%r13), R32(%r13)
+       mov     which, %rbx
+       ALIGN(16)
+L(tp2):        sub     $1, %rbx
+       sbb     %rax, %rax
+       mov     0(tp), %r10
+       mov     8(tp), %r11
+       and     %rax, %r10
+       and     %rax, %r11
+       or      %r10, %r12
+       or      %r11, %r13
+       lea     (tp,n,8), tp
+       add     $-1, i
+       jne     L(tp2)
+       mov     %r12, 0(rp)
+       mov     %r13, 8(rp)
+       pop     tp
+       lea     16(tp), tp
+       lea     16(rp), rp
+
+L(b0x):        test    $1, R8(n)
+       jz      L(b00)
+L(b01):        mov     nents, i
+       xor     R32(%r12), R32(%r12)
+       mov     which, %rbx
+       ALIGN(16)
+L(tp1):        sub     $1, %rbx
+       sbb     %rax, %rax
+       mov     0(tp), %r10
+       and     %rax, %r10
+       or      %r10, %r12
+       lea     (tp,n,8), tp
+       add     $-1, i
+       jne     L(tp1)
+       mov     %r12, 0(rp)
+
+L(b00):        pop     %r15
+       pop     %r14
+       pop     %r13
+       pop     %r12
+       pop     %rbp
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
diff --git a/mpn/x86_64/sqr_basecase.asm b/mpn/x86_64/sqr_basecase.asm
deleted file mode 100644 (file)
index 9c3dd76..0000000
+++ /dev/null
@@ -1,796 +0,0 @@
-dnl  AMD64 mpn_sqr_basecase.
-
-dnl  Contributed to the GNU project by Torbjorn Granlund.
-
-dnl  Copyright 2008, 2009, 2011, 2012 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 The inner loops of this code are the result of running a code generation and
-C optimization tool suite written by David Harvey and Torbjorn Granlund.
-
-C NOTES
-C   * There is a major stupidity in that we call mpn_mul_1 initially, for a
-C     large trip count.  Instead, we should follow the generic/sqr_basecase.c
-C     code which uses addmul_2s from the start, conditionally leaving a 1x1
-C     multiply to the end.  (In assembly code, one would stop invoking
-C     addmul_2s loops when perhaps 3x2s respectively a 2x2s remains.)
-C   * Another stupidity is in the sqr_diag_addlsh1 code.  It does not need to
-C     save/restore carry, instead it can propagate into the high product word.
-C   * Align more labels, should shave off a few cycles.
-C   * We can safely use 32-bit size operations, since operands with (2^32)
-C     limbs will lead to non-termination in practice.
-C   * The jump table could probably be optimized, at least for non-pic.
-C   * The special code for n <= 4 was quickly written.  It is probably too
-C     large and unnecessarily slow.
-C   * Consider combining small cases code so that the n=k-1 code jumps into the
-C     middle of the n=k code.
-C   * Avoid saving registers for small cases code.
-C   * Needed variables:
-C    n   r11  input size
-C    i   r8   work left, initially n
-C    j   r9   inner loop count
-C        r15  unused
-C    v0  r13
-C    v1  r14
-C    rp  rdi
-C    up  rsi
-C    w0  rbx
-C    w1  rcx
-C    w2  rbp
-C    w3  r10
-C    tp  r12
-C    lo  rax
-C    hi  rdx
-C        rsp
-
-C INPUT PARAMETERS
-define(`rp',     `%rdi')
-define(`up',     `%rsi')
-define(`n_param', `%rdx')
-
-define(`n',    `%r11')
-define(`tp',   `%r12')
-define(`i',    `%r8')
-define(`j',    `%r9')
-define(`v0',   `%r13')
-define(`v1',   `%r14')
-define(`w0',   `%rbx')
-define(`w1',   `%rcx')
-define(`w2',   `%rbp')
-define(`w3',   `%r10')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
-       TEXT
-       ALIGN(16)
-PROLOGUE(mpn_sqr_basecase)
-       FUNC_ENTRY(3)
-       mov     R32(n_param), R32(%rcx)
-       mov     R32(n_param), R32(n)            C free original n register (rdx)
-
-       add     $-40, %rsp
-
-       and     $3, R32(%rcx)
-       cmp     $4, R32(n_param)
-       lea     4(%rcx), %r8
-
-       mov     %rbx, 32(%rsp)
-       mov     %rbp, 24(%rsp)
-       mov     %r12, 16(%rsp)
-       mov     %r13, 8(%rsp)
-       mov     %r14, (%rsp)
-
-       cmovg   %r8, %rcx
-
-       lea     L(tab)(%rip), %rax
-ifdef(`PIC',
-`      movslq  (%rax,%rcx,4), %r10
-       add     %r10, %rax
-       jmp     *%rax
-',`
-       jmp     *(%rax,%rcx,8)
-')
-       JUMPTABSECT
-       ALIGN(8)
-L(tab):        JMPENT( L(4), L(tab))
-       JMPENT( L(1), L(tab))
-       JMPENT( L(2), L(tab))
-       JMPENT( L(3), L(tab))
-       JMPENT( L(0m4), L(tab))
-       JMPENT( L(1m4), L(tab))
-       JMPENT( L(2m4), L(tab))
-       JMPENT( L(3m4), L(tab))
-       TEXT
-
-L(1):  mov     (up), %rax
-       mul     %rax
-       add     $40, %rsp
-       mov     %rax, (rp)
-       mov     %rdx, 8(rp)
-       FUNC_EXIT()
-       ret
-
-L(2):  mov     (up), %rax
-       mov     %rax, %r8
-       mul     %rax
-       mov     8(up), %r11
-       mov     %rax, (rp)
-       mov     %r11, %rax
-       mov     %rdx, %r9
-       mul     %rax
-       add     $40, %rsp
-       mov     %rax, %r10
-       mov     %r11, %rax
-       mov     %rdx, %r11
-       mul     %r8
-       xor     %r8, %r8
-       add     %rax, %r9
-       adc     %rdx, %r10
-       adc     %r8, %r11
-       add     %rax, %r9
-       mov     %r9, 8(rp)
-       adc     %rdx, %r10
-       mov     %r10, 16(rp)
-       adc     %r8, %r11
-       mov     %r11, 24(rp)
-       FUNC_EXIT()
-       ret
-
-L(3):  mov     (up), %rax
-       mov     %rax, %r10
-       mul     %rax
-       mov     8(up), %r11
-       mov     %rax, (rp)
-       mov     %r11, %rax
-       mov     %rdx, 8(rp)
-       mul     %rax
-       mov     16(up), %rcx
-       mov     %rax, 16(rp)
-       mov     %rcx, %rax
-       mov     %rdx, 24(rp)
-       mul     %rax
-       mov     %rax, 32(rp)
-       mov     %rdx, 40(rp)
-
-       mov     %r11, %rax
-       mul     %r10
-       mov     %rax, %r8
-       mov     %rcx, %rax
-       mov     %rdx, %r9
-       mul     %r10
-       xor     %r10, %r10
-       add     %rax, %r9
-       mov     %r11, %rax
-       mov     %r10, %r11
-       adc     %rdx, %r10
-
-       mul     %rcx
-       add     $40, %rsp
-       add     %rax, %r10
-       adc     %r11, %rdx
-       add     %r8, %r8
-       adc     %r9, %r9
-       adc     %r10, %r10
-       adc     %rdx, %rdx
-       adc     %r11, %r11
-       add     %r8, 8(rp)
-       adc     %r9, 16(rp)
-       adc     %r10, 24(rp)
-       adc     %rdx, 32(rp)
-       adc     %r11, 40(rp)
-       FUNC_EXIT()
-       ret
-
-L(4):  mov     (up), %rax
-       mov     %rax, %r11
-       mul     %rax
-       mov     8(up), %rbx
-       mov     %rax, (rp)
-       mov     %rbx, %rax
-       mov     %rdx, 8(rp)
-       mul     %rax
-       mov     %rax, 16(rp)
-       mov     %rdx, 24(rp)
-       mov     16(up), %rax
-       mul     %rax
-       mov     %rax, 32(rp)
-       mov     %rdx, 40(rp)
-       mov     24(up), %rax
-       mul     %rax
-       mov     %rax, 48(rp)
-       mov     %rbx, %rax
-       mov     %rdx, 56(rp)
-
-       mul     %r11
-       add     $32, %rsp
-       mov     %rax, %r8
-       mov     %rdx, %r9
-       mov     16(up), %rax
-       mul     %r11
-       xor     %r10, %r10
-       add     %rax, %r9
-       adc     %rdx, %r10
-       mov     24(up), %rax
-       mul     %r11
-       xor     %r11, %r11
-       add     %rax, %r10
-       adc     %rdx, %r11
-       mov     16(up), %rax
-       mul     %rbx
-       xor     %rcx, %rcx
-       add     %rax, %r10
-       adc     %rdx, %r11
-       adc     $0, %rcx
-       mov     24(up), %rax
-       mul     %rbx
-       pop     %rbx
-       add     %rax, %r11
-       adc     %rdx, %rcx
-       mov     16(up), %rdx
-       mov     24(up), %rax
-       mul     %rdx
-       add     %rax, %rcx
-       adc     $0, %rdx
-
-       add     %r8, %r8
-       adc     %r9, %r9
-       adc     %r10, %r10
-       adc     %r11, %r11
-       adc     %rcx, %rcx
-       mov     $0, R32(%rax)
-       adc     %rdx, %rdx
-
-       adc     %rax, %rax
-       add     %r8, 8(rp)
-       adc     %r9, 16(rp)
-       adc     %r10, 24(rp)
-       adc     %r11, 32(rp)
-       adc     %rcx, 40(rp)
-       adc     %rdx, 48(rp)
-       adc     %rax, 56(rp)
-       FUNC_EXIT()
-       ret
-
-
-L(0m4):
-       lea     -16(rp,n,8), tp         C point tp in middle of result operand
-       mov     (up), v0
-       mov     8(up), %rax
-       lea     (up,n,8), up            C point up at end of input operand
-
-       lea     -4(n), i
-C Function mpn_mul_1_m3(tp, up - i, i, up[-i - 1])
-       xor     R32(j), R32(j)
-       sub     n, j
-
-       mul     v0
-       xor     R32(w2), R32(w2)
-       mov     %rax, w0
-       mov     16(up,j,8), %rax
-       mov     %rdx, w3
-       jmp     L(L3)
-
-       ALIGN(16)
-L(mul_1_m3_top):
-       add     %rax, w2
-       mov     w3, (tp,j,8)
-       mov     (up,j,8), %rax
-       adc     %rdx, w1
-       xor     R32(w0), R32(w0)
-       mul     v0
-       xor     R32(w3), R32(w3)
-       mov     w2, 8(tp,j,8)
-       add     %rax, w1
-       adc     %rdx, w0
-       mov     8(up,j,8), %rax
-       mov     w1, 16(tp,j,8)
-       xor     R32(w2), R32(w2)
-       mul     v0
-       add     %rax, w0
-       mov     16(up,j,8), %rax
-       adc     %rdx, w3
-L(L3): xor     R32(w1), R32(w1)
-       mul     v0
-       add     %rax, w3
-       mov     24(up,j,8), %rax
-       adc     %rdx, w2
-       mov     w0, 24(tp,j,8)
-       mul     v0
-       add     $4, j
-       js      L(mul_1_m3_top)
-
-       add     %rax, w2
-       mov     w3, (tp)
-       adc     %rdx, w1
-       mov     w2, 8(tp)
-       mov     w1, 16(tp)
-
-       lea     eval(2*8)(tp), tp       C tp += 2
-       lea     -8(up), up
-       jmp     L(dowhile)
-
-
-L(1m4):
-       lea     8(rp,n,8), tp           C point tp in middle of result operand
-       mov     (up), v0                C u0
-       mov     8(up), %rax             C u1
-       lea     8(up,n,8), up           C point up at end of input operand
-
-       lea     -3(n), i
-C Function mpn_mul_2s_m0(tp, up - i, i, up - i - 1)
-       lea     -3(n), j
-       neg     j
-
-       mov     %rax, v1                C u1
-       mul     v0                      C u0 * u1
-       mov     %rdx, w1
-       xor     R32(w2), R32(w2)
-       mov     %rax, 8(rp)
-       jmp     L(m0)
-
-       ALIGN(16)
-L(mul_2_m0_top):
-       mul     v1
-       add     %rax, w0
-       adc     %rdx, w1
-       mov     -24(up,j,8), %rax
-       mov     $0, R32(w2)
-       mul     v0
-       add     %rax, w0
-       mov     -24(up,j,8), %rax
-       adc     %rdx, w1
-       adc     $0, R32(w2)
-       mul     v1                      C v1 * u0
-       add     %rax, w1
-       mov     w0, -24(tp,j,8)
-       adc     %rdx, w2
-L(m0): mov     -16(up,j,8), %rax       C u2, u6 ...
-       mul     v0                      C u0 * u2
-       mov     $0, R32(w3)
-       add     %rax, w1
-       adc     %rdx, w2
-       mov     -16(up,j,8), %rax
-       adc     $0, R32(w3)
-       mov     $0, R32(w0)
-       mov     w1, -16(tp,j,8)
-       mul     v1
-       add     %rax, w2
-       mov     -8(up,j,8), %rax
-       adc     %rdx, w3
-       mov     $0, R32(w1)
-       mul     v0
-       add     %rax, w2
-       mov     -8(up,j,8), %rax
-       adc     %rdx, w3
-       adc     $0, R32(w0)
-       mul     v1
-       add     %rax, w3
-       mov     w2, -8(tp,j,8)
-       adc     %rdx, w0
-L(m2x):        mov     (up,j,8), %rax
-       mul     v0
-       add     %rax, w3
-       adc     %rdx, w0
-       adc     $0, R32(w1)
-       add     $4, j
-       mov     -32(up,j,8), %rax
-       mov     w3, -32(tp,j,8)
-       js      L(mul_2_m0_top)
-
-       mul     v1
-       add     %rax, w0
-       adc     %rdx, w1
-       mov     w0, -8(tp)
-       mov     w1, (tp)
-
-       lea     -16(up), up
-       lea     eval(3*8-24)(tp), tp    C tp += 3
-       jmp     L(dowhile_end)
-
-
-L(2m4):
-       lea     -16(rp,n,8), tp         C point tp in middle of result operand
-       mov     (up), v0
-       mov     8(up), %rax
-       lea     (up,n,8), up            C point up at end of input operand
-
-       lea     -4(n), i
-C Function mpn_mul_1_m1(tp, up - (i - 1), i - 1, up[-i])
-       lea     -2(n), j
-       neg     j
-
-       mul     v0
-       mov     %rax, w2
-       mov     (up,j,8), %rax
-       mov     %rdx, w1
-       jmp     L(L1)
-
-       ALIGN(16)
-L(mul_1_m1_top):
-       add     %rax, w2
-       mov     w3, (tp,j,8)
-       mov     (up,j,8), %rax
-       adc     %rdx, w1
-L(L1): xor     R32(w0), R32(w0)
-       mul     v0
-       xor     R32(w3), R32(w3)
-       mov     w2, 8(tp,j,8)
-       add     %rax, w1
-       adc     %rdx, w0
-       mov     8(up,j,8), %rax
-       mov     w1, 16(tp,j,8)
-       xor     R32(w2), R32(w2)
-       mul     v0
-       add     %rax, w0
-       mov     16(up,j,8), %rax
-       adc     %rdx, w3
-       xor     R32(w1), R32(w1)
-       mul     v0
-       add     %rax, w3
-       mov     24(up,j,8), %rax
-       adc     %rdx, w2
-       mov     w0, 24(tp,j,8)
-       mul     v0
-       add     $4, j
-       js      L(mul_1_m1_top)
-
-       add     %rax, w2
-       mov     w3, (tp)
-       adc     %rdx, w1
-       mov     w2, 8(tp)
-       mov     w1, 16(tp)
-
-       lea     eval(2*8)(tp), tp       C tp += 2
-       lea     -8(up), up
-       jmp     L(dowhile_mid)
-
-
-L(3m4):
-       lea     8(rp,n,8), tp           C point tp in middle of result operand
-       mov     (up), v0                C u0
-       mov     8(up), %rax             C u1
-       lea     8(up,n,8), up           C point up at end of input operand
-
-       lea     -5(n), i
-C Function mpn_mul_2s_m2(tp, up - i + 1, i - 1, up - i)
-       lea     -1(n), j
-       neg     j
-
-       mov     %rax, v1                C u1
-       mul     v0                      C u0 * u1
-       mov     %rdx, w3
-       xor     R32(w0), R32(w0)
-       xor     R32(w1), R32(w1)
-       mov     %rax, 8(rp)
-       jmp     L(m2)
-
-       ALIGN(16)
-L(mul_2_m2_top):
-       mul     v1
-       add     %rax, w0
-       adc     %rdx, w1
-       mov     -24(up,j,8), %rax
-       mov     $0, R32(w2)
-       mul     v0
-       add     %rax, w0
-       mov     -24(up,j,8), %rax
-       adc     %rdx, w1
-       adc     $0, R32(w2)
-       mul     v1                      C v1 * u0
-       add     %rax, w1
-       mov     w0, -24(tp,j,8)
-       adc     %rdx, w2
-       mov     -16(up,j,8), %rax
-       mul     v0
-       mov     $0, R32(w3)
-       add     %rax, w1
-       adc     %rdx, w2
-       mov     -16(up,j,8), %rax
-       adc     $0, R32(w3)
-       mov     $0, R32(w0)
-       mov     w1, -16(tp,j,8)
-       mul     v1
-       add     %rax, w2
-       mov     -8(up,j,8), %rax
-       adc     %rdx, w3
-       mov     $0, R32(w1)
-       mul     v0
-       add     %rax, w2
-       mov     -8(up,j,8), %rax
-       adc     %rdx, w3
-       adc     $0, R32(w0)
-       mul     v1
-       add     %rax, w3
-       mov     w2, -8(tp,j,8)
-       adc     %rdx, w0
-L(m2): mov     (up,j,8), %rax
-       mul     v0
-       add     %rax, w3
-       adc     %rdx, w0
-       adc     $0, R32(w1)
-       add     $4, j
-       mov     -32(up,j,8), %rax
-       mov     w3, -32(tp,j,8)
-       js      L(mul_2_m2_top)
-
-       mul     v1
-       add     %rax, w0
-       adc     %rdx, w1
-       mov     w0, -8(tp)
-       mov     w1, (tp)
-
-       lea     -16(up), up
-       jmp     L(dowhile_mid)
-
-L(dowhile):
-C Function mpn_addmul_2s_m2(tp, up - (i - 1), i - 1, up - i)
-       lea     4(i), j
-       neg     j
-
-       mov     16(up,j,8), v0
-       mov     24(up,j,8), v1
-       mov     24(up,j,8), %rax
-       mul     v0
-       xor     R32(w3), R32(w3)
-       add     %rax, 24(tp,j,8)
-       adc     %rdx, w3
-       xor     R32(w0), R32(w0)
-       xor     R32(w1), R32(w1)
-       jmp     L(am2)
-
-       ALIGN(16)
-L(addmul_2_m2_top):
-       add     w3, (tp,j,8)
-       adc     %rax, w0
-       mov     8(up,j,8), %rax
-       adc     %rdx, w1
-       mov     $0, R32(w2)
-       mul     v0
-       add     %rax, w0
-       mov     8(up,j,8), %rax
-       adc     %rdx, w1
-       adc     $0, R32(w2)
-       mul     v1                              C v1 * u0
-       add     w0, 8(tp,j,8)
-       adc     %rax, w1
-       adc     %rdx, w2
-       mov     16(up,j,8), %rax
-       mov     $0, R32(w3)
-       mul     v0                              C v0 * u1
-       add     %rax, w1
-       mov     16(up,j,8), %rax
-       adc     %rdx, w2
-       adc     $0, R32(w3)
-       mul     v1                              C v1 * u1
-       add     w1, 16(tp,j,8)
-       adc     %rax, w2
-       mov     24(up,j,8), %rax
-       adc     %rdx, w3
-       mul     v0
-       mov     $0, R32(w0)
-       add     %rax, w2
-       adc     %rdx, w3
-       mov     $0, R32(w1)
-       mov     24(up,j,8), %rax
-       adc     $0, R32(w0)
-       mul     v1
-       add     w2, 24(tp,j,8)
-       adc     %rax, w3
-       adc     %rdx, w0
-L(am2):        mov     32(up,j,8), %rax
-       mul     v0
-       add     %rax, w3
-       mov     32(up,j,8), %rax
-       adc     %rdx, w0
-       adc     $0, R32(w1)
-       mul     v1
-       add     $4, j
-       js      L(addmul_2_m2_top)
-
-       add     w3, (tp)
-       adc     %rax, w0
-       adc     %rdx, w1
-       mov     w0, 8(tp)
-       mov     w1, 16(tp)
-
-       lea     eval(2*8)(tp), tp       C tp += 2
-
-       add     $-2, R32(i)             C i -= 2
-
-L(dowhile_mid):
-C Function mpn_addmul_2s_m0(tp, up - (i - 1), i - 1, up - i)
-       lea     2(i), j
-       neg     j
-
-       mov     (up,j,8), v0
-       mov     8(up,j,8), v1
-       mov     8(up,j,8), %rax
-       mul     v0
-       xor     R32(w1), R32(w1)
-       add     %rax, 8(tp,j,8)
-       adc     %rdx, w1
-       xor     R32(w2), R32(w2)
-       jmp     L(20)
-
-       ALIGN(16)
-L(addmul_2_m0_top):
-       add     w3, (tp,j,8)
-       adc     %rax, w0
-       mov     8(up,j,8), %rax
-       adc     %rdx, w1
-       mov     $0, R32(w2)
-       mul     v0
-       add     %rax, w0
-       mov     8(up,j,8), %rax
-       adc     %rdx, w1
-       adc     $0, R32(w2)
-       mul     v1                              C v1 * u0
-       add     w0, 8(tp,j,8)
-       adc     %rax, w1
-       adc     %rdx, w2
-L(20): mov     16(up,j,8), %rax
-       mov     $0, R32(w3)
-       mul     v0                              C v0 * u1
-       add     %rax, w1
-       mov     16(up,j,8), %rax
-       adc     %rdx, w2
-       adc     $0, R32(w3)
-       mul     v1                              C v1 * u1
-       add     w1, 16(tp,j,8)
-       adc     %rax, w2
-       mov     24(up,j,8), %rax
-       adc     %rdx, w3
-       mul     v0
-       mov     $0, R32(w0)
-       add     %rax, w2
-       adc     %rdx, w3
-       mov     $0, R32(w1)
-       mov     24(up,j,8), %rax
-       adc     $0, R32(w0)
-       mul     v1
-       add     w2, 24(tp,j,8)
-       adc     %rax, w3
-       adc     %rdx, w0
-       mov     32(up,j,8), %rax
-       mul     v0
-       add     %rax, w3
-       mov     32(up,j,8), %rax
-       adc     %rdx, w0
-       adc     $0, R32(w1)
-       mul     v1
-       add     $4, j
-       js      L(addmul_2_m0_top)
-
-       add     w3, (tp)
-       adc     %rax, w0
-       adc     %rdx, w1
-       mov     w0, 8(tp)
-       mov     w1, 16(tp)
-
-       lea     eval(2*8)(tp), tp       C tp += 2
-L(dowhile_end):
-
-       add     $-2, R32(i)             C i -= 2
-       jne     L(dowhile)
-
-C Function mpn_addmul_2s_2
-       mov     -16(up), v0
-       mov     -8(up), v1
-       mov     -8(up), %rax
-       mul     v0
-       xor     R32(w3), R32(w3)
-       add     %rax, -8(tp)
-       adc     %rdx, w3
-       xor     R32(w0), R32(w0)
-       xor     R32(w1), R32(w1)
-       mov     (up), %rax
-       mul     v0
-       add     %rax, w3
-       mov     (up), %rax
-       adc     %rdx, w0
-       mul     v1
-       add     w3, (tp)
-       adc     %rax, w0
-       adc     %rdx, w1
-       mov     w0, 8(tp)
-       mov     w1, 16(tp)
-
-C Function mpn_sqr_diag_addlsh1
-       lea     -4(n,n), j
-
-       mov     8(rp), %r11
-       lea     -8(up), up
-       lea     (rp,j,8), rp
-       neg     j
-       mov     (up,j,4), %rax
-       mul     %rax
-       test    $2, R8(j)
-       jnz     L(odd)
-
-L(evn):        add     %r11, %r11
-       sbb     R32(%rbx), R32(%rbx)            C save CF
-       add     %rdx, %r11
-       mov     %rax, (rp,j,8)
-       jmp     L(d0)
-
-L(odd):        add     %r11, %r11
-       sbb     R32(%rbp), R32(%rbp)            C save CF
-       add     %rdx, %r11
-       mov     %rax, (rp,j,8)
-       lea     -2(j), j
-       jmp     L(d1)
-
-       ALIGN(16)
-L(top):        mov     (up,j,4), %rax
-       mul     %rax
-       add     R32(%rbp), R32(%rbp)            C restore carry
-       adc     %rax, %r10
-       adc     %rdx, %r11
-       mov     %r10, (rp,j,8)
-L(d0): mov     %r11, 8(rp,j,8)
-       mov     16(rp,j,8), %r10
-       adc     %r10, %r10
-       mov     24(rp,j,8), %r11
-       adc     %r11, %r11
-       nop
-       sbb     R32(%rbp), R32(%rbp)            C save CF
-       mov     8(up,j,4), %rax
-       mul     %rax
-       add     R32(%rbx), R32(%rbx)            C restore carry
-       adc     %rax, %r10
-       adc     %rdx, %r11
-       mov     %r10, 16(rp,j,8)
-L(d1): mov     %r11, 24(rp,j,8)
-       mov     32(rp,j,8), %r10
-       adc     %r10, %r10
-       mov     40(rp,j,8), %r11
-       adc     %r11, %r11
-       sbb     R32(%rbx), R32(%rbx)            C save CF
-       add     $4, j
-       js      L(top)
-
-       mov     (up), %rax
-       mul     %rax
-       add     R32(%rbp), R32(%rbp)            C restore carry
-       adc     %rax, %r10
-       adc     %rdx, %r11
-       mov     %r10, (rp)
-       mov     %r11, 8(rp)
-       mov     16(rp), %r10
-       adc     %r10, %r10
-       sbb     R32(%rbp), R32(%rbp)            C save CF
-       neg     R32(%rbp)
-       mov     8(up), %rax
-       mul     %rax
-       add     R32(%rbx), R32(%rbx)            C restore carry
-       adc     %rax, %r10
-       adc     %rbp, %rdx
-       mov     %r10, 16(rp)
-       mov     %rdx, 24(rp)
-
-       pop     %r14
-       pop     %r13
-       pop     %r12
-       pop     %rbp
-       pop     %rbx
-       FUNC_EXIT()
-       ret
-EPILOGUE()
diff --git a/mpn/x86_64/sqr_diag_addlsh1.asm b/mpn/x86_64/sqr_diag_addlsh1.asm
new file mode 100644 (file)
index 0000000..4ad034c
--- /dev/null
@@ -0,0 +1,116 @@
+dnl  AMD64 mpn_sqr_diag_addlsh1
+
+dnl  Contributed to the GNU project by Torbjörn Granlund.
+
+dnl  Copyright 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')
+
+C           cycles/limb
+C AMD K8,K9     2.5
+C AMD K10       2.5
+C AMD bull      3.6
+C AMD pile      3.6
+C AMD steam     ?
+C AMD bobcat    4
+C AMD jaguar    ?
+C Intel P4      ?
+C Intel core    4
+C Intel NHM     3.6
+C Intel SBR     3.15
+C Intel IBR     3.2
+C Intel HWL     2.6
+C Intel BWL     ?
+C Intel atom   14
+C VIA nano      3.5
+
+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(`tp',     `%rsi')
+define(`up_arg', `%rdx')
+define(`n',      `%rcx')
+
+define(`up',     `%r11')
+
+ABI_SUPPORT(DOS64)
+ABI_SUPPORT(STD64)
+
+ASM_START()
+       TEXT
+       ALIGN(32)
+PROLOGUE(mpn_sqr_diag_addlsh1)
+       FUNC_ENTRY(4)
+       push    %rbx
+
+       dec     n
+       shl     n
+
+       mov     (up_arg), %rax
+
+       lea     (rp,n,8), rp
+       lea     (tp,n,8), tp
+       lea     (up_arg,n,4), up
+       neg     n
+
+       mul     %rax
+       mov     %rax, (rp,n,8)
+
+       xor     R32(%rbx), R32(%rbx)
+       jmp     L(mid)
+
+       ALIGN(16)
+L(top):        add     %r10, %r8
+       adc     %rax, %r9
+       mov     %r8, -8(rp,n,8)
+       mov     %r9, (rp,n,8)
+L(mid):        mov     8(up,n,4), %rax
+       mov     (tp,n,8), %r8
+       mov     8(tp,n,8), %r9
+       adc     %r8, %r8
+       adc     %r9, %r9
+       lea     (%rdx,%rbx), %r10
+       setc    R8(%rbx)
+       mul     %rax
+       add     $2, n
+       js      L(top)
+
+L(end):        add     %r10, %r8
+       adc     %rax, %r9
+       mov     %r8, I(-8(rp),-8(rp,n,8))
+       mov     %r9, I((rp),(rp,n,8))
+       adc     %rbx, %rdx
+       mov     %rdx, I(8(rp),8(rp,n,8))
+
+       pop     %rbx
+       FUNC_EXIT()
+       ret
+EPILOGUE()
index 678a60b976b7cb51013373b68c6a02ec9db0837c..c6d829fcb2d35bd7ab9c8a310826f99870c43c70 100644 (file)
@@ -1,22 +1,32 @@
 dnl  AMD64 mpn_sublsh1_n -- rp[] = up[] - (vp[] << 1)
 
-dnl  Copyright 2003, 2005, 2006, 2007, 2011, 2012 Free Software Foundation,
-dnl  Inc.
+dnl  Copyright 2003, 2005-2007, 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 the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff --git a/mpn/x86_64/tabselect.asm b/mpn/x86_64/tabselect.asm
deleted file mode 100644 (file)
index e578b6e..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-dnl  AMD64 mpn_tabselect.
-
-dnl  Copyright 2011, 2012 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 AMD K8,K9     2.5
-C AMD K10       2.5
-C AMD bobcat    3.5
-C Intel P4      4
-C Intel core2   2.33
-C Intel NHM     2.5
-C Intel SBR     2.2
-C Intel atom    5
-C VIA nano      3.5
-
-C NOTES
-C  * This has not been tuned for any specific processor.  Its speed should not
-C    be too bad, though.
-C  * Using SSE2/AVX2 could result in many-fold speedup.
-
-C mpn_tabselect (mp_limb_t *rp, mp_limb_t *tp, mp_size_t n, mp_size_t nents, mp_size_t which)
-define(`rp',     `%rdi')
-define(`tp',     `%rsi')
-define(`n',      `%rdx')
-define(`nents',  `%rcx')
-define(`which',  `%r8')
-
-define(`i',      `%rbp')
-define(`maskp',  `%r11')
-define(`maskn',  `%r12')
-
-C rax rbx  rcx  rdx rdi rsi rbp (rsp)  r8   r9 r10 r11 r12 r13 r14 r15
-C         nents  n  rp  tab           which
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
-       TEXT
-       ALIGN(16)
-PROLOGUE(mpn_tabselect)
-       FUNC_ENTRY(4)
-IFDOS(`        mov     56(%rsp), %r8d  ')
-       push    %rbx
-       push    %rbp
-       push    %r12
-
-       lea     (rp,n,8), rp
-       lea     (tp,n,8), tp
-       sub     nents, which
-L(outer):
-       lea     (which,nents), %rax
-       neg     %rax                    C set CF iff 'which' != k
-       sbb     maskn, maskn
-       mov     maskn, maskp
-       not     maskp
-
-       mov     n, i
-       neg     i
-       test    $1, R32(n)
-       je      L(top)
-       mov     (tp,i,8), %rax
-       and     maskp, %rax
-       mov     (rp,i,8), %r9
-       and     maskn, %r9
-       or      %r9, %rax
-       mov     %rax, (rp,i,8)
-       add     $1, i
-       jns     L(end)
-
-       ALIGN(16)
-L(top):        mov     (tp,i,8), %rax
-       mov     8(tp,i,8), %rbx
-       and     maskp, %rax
-       and     maskp, %rbx
-       mov     (rp,i,8), %r9
-       mov     8(rp,i,8), %r10
-       and     maskn, %r9
-       and     maskn, %r10
-       or      %r9, %rax
-       or      %r10, %rbx
-       mov     %rax, (rp,i,8)
-       mov     %rbx, 8(rp,i,8)
-       add     $2, i
-       js      L(top)
-
-L(end):        lea     (tp,n,8), tp
-       dec     nents
-       jne     L(outer)
-
-L(outer_end):
-       pop     %r12
-       pop     %rbp
-       pop     %rbx
-       FUNC_EXIT()
-       ret
-EPILOGUE()
index 0e9a8b16ca45f0026184e6ac2a6edcda93e1947d..366598b41de0ea5d8d8d5a2a411c08c52230ad81 100644 (file)
@@ -2,23 +2,33 @@ divert(-1)
 
 dnl  m4 macros for amd64 assembler.
 
-dnl  Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2011,
-dnl  2012, 2013 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999-2005, 2008, 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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  The GNU MP Library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+dnl  or both in parallel, as here.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  The GNU MP Library is distributed in the hope that it will be useful, but
+dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 
 dnl  Usage: CPUVEC_FUNCS_LIST
@@ -33,6 +43,8 @@ define(CPUVEC_FUNCS_LIST,
 `addmul_1',
 `addmul_2',
 `bdiv_dbm1c',
+`cnd_add_n',
+`cnd_sub_n',
 `com',
 `copyd',
 `copyi',
@@ -180,9 +192,12 @@ define(`R8',
 dnl  Usage: CALL(funcname)
 dnl
 
+define(`CALL',`dnl
 ifdef(`PIC',
-  `define(`CALL',`call GSYM_PREFIX`'$1@PLT')',
-  `define(`CALL',`call GSYM_PREFIX`'$1')')
+       `call   GSYM_PREFIX`'$1@PLT'
+,
+       `call   GSYM_PREFIX`'$1'
+)')
 
 
 define(`JUMPTABSECT', `.section        .data.rel.ro.local,"aw",@progbits')
@@ -278,4 +293,62 @@ eval(0xc0+x86_opcode_regxmm($3)%8*8+x86_opcode_regxmm($2)%8),dnl
 substr($1,1)')
 
 
+dnl  Usage
+dnl
+dnl    regnum(op)   raw operand index (so slightly misnamed)
+dnl    regnumh(op)  high bit of register operand nimber
+dnl    ix(op)       0 for reg operand, 1 for plain pointer operand.
+dnl
+
+define(`regnum',`x86_lookup(`$1',oplist)')
+define(`regnumh',`eval(regnum($1)/8 & 1)')
+define(`ix',`eval(regnum($1)/16)')
+define(`oplist',
+``%rax',   0, `%rcx',   1, `%rdx',   2,  `%rbx',   3,
+ `%rsp',   4, `%rbp',   5, `%rsi',   6,  `%rdi',   7,
+ `%r8',    8, `%r9',    9, `%r10',  10,  `%r11',  11,
+ `%r12',  12, `%r13',  13, `%r14',  14,  `%r15',  15,
+ `(%rax)',16, `(%rcx)',17, `(%rdx)',18,  `(%rbx)',19,
+ `(%rsp)',20, `(%rbp)',21, `(%rsi)',22,  `(%rdi)',23,
+ `(%r8)', 24, `(%r9)', 25, `(%r10)',26,  `(%r11)',27,
+ `(%r12)',28, `(%r13)',29, `(%r14)',30,  `(%r15)' 31')
+
+
+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.
+dnl
+dnl  The exceptions are due to special coding needed for some registers; rsp
+dnl  and r12 need an extra byte 0x24 at the end while rbp and r13 lack the
+dnl  offset-less form.
+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
+ifelse($#,3,
+`.byte 0xc4`'dnl
+,0x`'eval(0xe2^32*regnumh($1)^128*regnumh($3),16)`'dnl
+,0x`'eval(0xfb-8*regnum($2),16)`'dnl
+,0xf6`'dnl
+,0x`'eval(0xc0+(7 & regnum($1))+8*(7 & regnum($3))-0xc0*ix($1),16)`'dnl
+',$#,4,
+`.byte 0xc4`'dnl
+,0x`'eval(0xe2^32*regnumh($2)^128*regnumh($4),16)`'dnl
+,0x`'eval(0xfb-8*regnum($3),16)`'dnl
+,0xf6`'dnl
+,0x`'eval(0x40+(7 & regnum($2))+8*(7 & regnum($4)),16)`'dnl
+,0x`'eval(($1 + 256) % 256,16)`'dnl
+')')
+
 divert`'dnl
diff --git a/mpn/z8000/README b/mpn/z8000/README
deleted file mode 100644 (file)
index c58420e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-Copyright 2003, 2004 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 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.
-
-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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-
-
-
-                      Z8000 MPN SUBROUTINES
-
-
-This directory contains mpn functions for the Zilog Z8000.
-
-
-STATUS
-
-This code is old and has not been used for a long time.
-
-mpn/z8000 uses a 16-bit limb, it's possible this doesn't really work, on
-account of various bits of C code assuming limb>=long and of course long is
-invariably at least 32 bits.
diff --git a/mpn/z8000/add_n.s b/mpn/z8000/add_n.s
deleted file mode 100644 (file)
index 89fbb1a..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-! Z8000 __gmpn_add_n -- Add two limb vectors of equal, non-zero length.
-
-! Copyright 1993, 1994, 2000 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 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.
-
-! 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 Lesser General Public
-! License for more details.
-
-! You should have received a copy of the GNU Lesser General Public License
-! along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-! INPUT PARAMETERS
-! res_ptr      r7
-! s1_ptr       r6
-! s2_ptr       r5
-! size         r4
-
-! If we are really crazy, we can use push to write a few result words
-! backwards, using push just because it is faster than reg+disp.  We'd
-! then add 2x the number of words written to r7...
-
-       unseg
-       .text
-       even
-       global ___gmpn_add_n
-___gmpn_add_n:
-       pop     r0,@r6
-       pop     r1,@r5
-       add     r0,r1
-       ld      @r7,r0
-       dec     r4
-       jr      eq,Lend
-Loop:  pop     r0,@r6
-       pop     r1,@r5
-       adc     r0,r1
-       inc     r7,#2
-       ld      @r7,r0
-       dec     r4
-       jr      ne,Loop
-Lend:  ld      r2,r4           ! use 0 already in r4
-       adc     r2,r2
-       ret     t
diff --git a/mpn/z8000/gmp-mparam.h b/mpn/z8000/gmp-mparam.h
deleted file mode 100644 (file)
index 1b25c9b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/* gmp-mparam.h -- Compiler/machine parameter header file.
-
-Copyright 1991, 1993, 1994, 2001 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 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.
-
-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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
-
-#define GMP_LIMB_BITS 16
-#define BYTES_PER_MP_LIMB 2
diff --git a/mpn/z8000/mul_1.s b/mpn/z8000/mul_1.s
deleted file mode 100644 (file)
index fa92bc3..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-! Z8000 __gmpn_mul_1 -- Multiply a limb vector with a limb and store
-! the result in a second limb vector.
-
-! Copyright 1993, 1994, 1995, 2000 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 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.
-
-! 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 Lesser General Public
-! License for more details.
-
-! You should have received a copy of the GNU Lesser General Public License
-! along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-! INPUT PARAMETERS
-! res_ptr      r7
-! s1_ptr       r6
-! size         r5
-! s2_limb      r4
-
-       unseg
-       .text
-       even
-       global ___gmpn_mul_1
-___gmpn_mul_1:
-       sub     r2,r2           ! zero carry limb
-       and     r4,r4
-       jr      mi,Lneg
-
-Lpos:  pop     r1,@r6
-       ld      r9,r1
-       mult    rr8,r4
-       and     r1,r1           ! shift msb of loaded limb into cy
-       jr      mi,Lp           ! branch if loaded limb's msb is set
-       add     r8,r4           ! hi_limb += sign_comp2
-Lp:    add     r9,r2           ! lo_limb += cy_limb
-       xor     r2,r2
-       adc     r2,r8
-       ld      @r7,r9
-       inc     r7,#2
-       dec     r5
-       jr      ne,Lpos
-       ret t
-
-Lneg:  pop     r1,@r6
-       ld      r9,r1
-       mult    rr8,r4
-       add     r8,r1           ! hi_limb += sign_comp1
-       and     r1,r1
-       jr      mi,Ln
-       add     r8,r4           ! hi_limb += sign_comp2
-Ln:    add     r9,r2           ! lo_limb += cy_limb
-       xor     r2,r2
-       adc     r2,r8
-       ld      @r7,r9
-       inc     r7,#2
-       dec     r5
-       jr      ne,Lneg
-       ret t
diff --git a/mpn/z8000/sub_n.s b/mpn/z8000/sub_n.s
deleted file mode 100644 (file)
index 1dbd837..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-! Z8000 __gmpn_sub_n -- Subtract two limb vectors of the same length > 0 and
-! store difference in a third limb vector.
-
-! Copyright 1993, 1994, 2000 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 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.
-
-! 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 Lesser General Public
-! License for more details.
-
-! You should have received a copy of the GNU Lesser General Public License
-! along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-! INPUT PARAMETERS
-! res_ptr      r7
-! s1_ptr       r6
-! s2_ptr       r5
-! size         r4
-
-! If we are really crazy, we can use push to write a few result words
-! backwards, using push just because it is faster than reg+disp.  We'd
-! then add 2x the number of words written to r7...
-
-       unseg
-       .text
-       even
-       global ___gmpn_sub_n
-___gmpn_sub_n:
-       pop     r0,@r6
-       pop     r1,@r5
-       sub     r0,r1
-       ld      @r7,r0
-       dec     r4
-       jr      eq,Lend
-Loop:  pop     r0,@r6
-       pop     r1,@r5
-       sbc     r0,r1
-       inc     r7,#2
-       ld      @r7,r0
-       dec     r4
-       jr      ne,Loop
-Lend:  ld      r2,r4           ! use 0 already in r4
-       adc     r2,r2
-       ret     t
index f5db4e57e692d9c925cb6386ac2bdf3261876819..406aa9f8dc6a9ae03c42a1c8c44801e49cc4ef3d 100644 (file)
@@ -1,21 +1,32 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 1996, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright 1996, 1998, 2000-2002 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
index e87ec18092adb8168299da0ed013baff96a35425..8bc0a9984f0288d0edd4cd4f0f366e7d3e19f12f 100644 (file)
 
 @SET_MAKE@
 
-# Copyright 1996, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright 1996, 1998, 2000-2002 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 VPATH = @srcdir@
 am__make_dryrun = \
index 3f0caeba98b077e9c002cb243d509d7c08b7974d..7fe04a35bb65b38bbcdcc3c1f1f047cd663976fc 100644 (file)
--- a/mpq/abs.c
+++ b/mpq/abs.c
@@ -5,17 +5,28 @@ Copyright 2000, 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpq_abs 1
 
index 6a8c049d980d9e1b006fee8cc239d825ced34e31..81edc1fa398b4e7dbd782d357e9fb06ac614d655 100644 (file)
@@ -1,22 +1,33 @@
 /* mpq_add, mpq_sub -- add or subtract rational numbers.
 
-Copyright 1991, 1994, 1995, 1996, 1997, 2000, 2001, 2004, 2005 Free Software
-Foundation, Inc.
+Copyright 1991, 1994-1997, 2000, 2001, 2004, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index ab7925b51207aad650641328a6515b3b064e7d5d..882f408fb8397f727fa0ab92f7e723df2ca248ad 100644 (file)
@@ -1,29 +1,39 @@
 /* mpq_canonicalize(op) -- Remove common factors of the denominator and
    numerator in OP.
 
-Copyright 1991, 1994, 1995, 1996, 2000, 2001, 2005 Free Software Foundation,
-Inc.
+Copyright 1991, 1994-1996, 2000, 2001, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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_canonicalize (MP_RAT *op)
+mpq_canonicalize (mpq_t op)
 {
   mpz_t gcd;
   TMP_DECL;
index 787dae14bcbb075b9fa429c30b650da8983bd743..ce0b973f9f4bf0e1c0a137ed4ce2e5e63beeda1d 100644 (file)
@@ -1,30 +1,41 @@
-/* mpq_clear -- free the space occupied by a MP_RAT.
+/* mpq_clear -- free the space occupied by a mpq_t.
 
 Copyright 1991, 1994, 1995, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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 (MP_RAT *m)
+mpq_clear (mpq_t m)
 {
   (*__gmp_free_func) (PTR(NUM(m)),
-                   ALLOC(NUM(m)) * BYTES_PER_MP_LIMB);
+                   (size_t) ALLOC(NUM(m)) * GMP_LIMB_BYTES);
   (*__gmp_free_func) (PTR(DEN(m)),
-                   ALLOC(DEN(m)) * BYTES_PER_MP_LIMB);
+                   (size_t) ALLOC(DEN(m)) * GMP_LIMB_BYTES);
 }
index 0aa8b57c8182bdffdc96c201515f6caf10999a4a..f949fe36cd8dd2c444dfdebc5d094a2f246b8225 100644 (file)
@@ -1,55 +1,51 @@
 /* mpq_clears() -- Clear multiple mpq_t variables.
 
-Copyright 2009 Free Software Foundation, Inc.
+Copyright 2009, 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>             /* for NULL */
 #include "gmp.h"
 #include "gmp-impl.h"
 
 void
-#if HAVE_STDARG
 mpq_clears (mpq_ptr x, ...)
-#else
-mpq_clears (va_alist)
-     va_dcl
-#endif
 {
   va_list  ap;
 
-#if HAVE_STDARG
   va_start (ap, x);
-#else
-  mpq_ptr x;
-  va_start (ap);
-  x = va_arg (ap, mpq_ptr);
-#endif
 
   while (x != NULL)
     {
-      mpq_clear (x);
+      (*__gmp_free_func) (PTR(NUM(x)),
+                         (size_t) ALLOC(NUM(x)) * GMP_LIMB_BYTES);
+      (*__gmp_free_func) (PTR(DEN(x)),
+                         (size_t) ALLOC(DEN(x)) * GMP_LIMB_BYTES);
       x = va_arg (ap, mpq_ptr);
     }
   va_end (ap);
index c4bb5e0de27d65b829a4dc7d66fc41dda1ec9ae9..e633b6f42d4b06397f3132113a060709bf60af2d 100644 (file)
--- a/mpq/cmp.c
+++ b/mpq/cmp.c
@@ -6,24 +6,35 @@ Copyright 1991, 1994, 1996, 2001, 2002, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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"
 
 int
-mpq_cmp (const MP_RAT *op1, const MP_RAT *op2)
+mpq_cmp (const mpq_t op1, const mpq_t op2)
 {
   mp_size_t num1_size = SIZ(NUM(op1));
   mp_size_t den1_size = SIZ(DEN(op1));
index b9482b1db74e0824f30dcee10a8f2cb84f580a2e..0a31fe8c9e7e29c898e41dff2cb29be20c38d66c 100644 (file)
@@ -1,21 +1,32 @@
 /* _mpq_cmp_si -- compare mpq and long/ulong fraction.
 
-Copyright 2001 Free Software Foundation, Inc.
+Copyright 2001, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -46,11 +57,11 @@ _mpq_cmp_si (mpq_srcptr q, long n, unsigned long d)
         {
           mpq_t  qabs;
           SIZ(NUM(qabs)) = ABSIZ(NUM(q));
-          PTR(NUM(qabs))    = PTR(NUM(q));
+          PTR(NUM(qabs)) = PTR(NUM(q));
           SIZ(DEN(qabs)) = SIZ(DEN(q));
-          PTR(DEN(qabs))    = PTR(DEN(q));
+          PTR(DEN(qabs)) = PTR(DEN(q));
 
-          return - _mpq_cmp_ui (qabs, -n, d);    /* <0 cmp <0 */
+          return - _mpq_cmp_ui (qabs, NEG_CAST (unsigned long, n), d);    /* <0 cmp <0 */
         }
     }
 }
index a52c2e8e8c98e4a9625b12a08c1acc81f945f2ac..a2e2d8ca812502a11ffbefec1d9cbbce23e821e7 100644 (file)
@@ -2,29 +2,39 @@
    negative based on if U > V, U == V, or U < V.  Vn and Vd may have
    common factors.
 
-Copyright 1993, 1994, 1996, 2000, 2001, 2002, 2003, 2005 Free Software
-Foundation, Inc.
+Copyright 1993, 1994, 1996, 2000-2003, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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
-_mpq_cmp_ui (const MP_RAT *op1, unsigned long int num2, unsigned long int den2)
+_mpq_cmp_ui (const mpq_t op1, unsigned long int num2, unsigned long int den2)
 {
   mp_size_t num1_size = SIZ(NUM(op1));
   mp_size_t den1_size = SIZ(DEN(op1));
index 1f64f6d478c036ac784e8c4a166f7a55f86009ef..7d91e0998aea1204a4f18f508c29a021ecb126cf 100644 (file)
--- a/mpq/div.c
+++ b/mpq/div.c
@@ -1,21 +1,32 @@
 /* mpq_div -- divide two rational numbers.
 
-Copyright 1991, 1994, 1995, 1996, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1991, 1994-1996, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index e55180a5627ee8fec9d30bc08d58e12b5ba0519b..500c2d802ea015516df68e6b71e5c3a9f8b7f04e 100644 (file)
@@ -6,17 +6,28 @@ Copyright 1996, 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 3db822689e36540343093d56c3a1d987fb32095b..6318e222936d76b843fefd3d0a7efc6935cdbdb9 100644 (file)
@@ -1,22 +1,32 @@
 /* double mpq_get_d (mpq_t src) -- mpq to double, rounding towards zero.
 
-Copyright 1995, 1996, 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
-Inc.
+Copyright 1995, 1996, 2001-2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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"
@@ -91,7 +101,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
    like to have helping everywhere that uses a quotient-only division. */
 
 double
-mpq_get_d (const MP_RAT *src)
+mpq_get_d (const mpq_t src)
 {
   double res;
   mp_srcptr np, dp;
@@ -101,7 +111,7 @@ mpq_get_d (const MP_RAT *src)
   mp_size_t qsize, prospective_qsize, zeros, chop, tsize;
   mp_size_t sign_quotient = nsize;
   long exp;
-#define N_QLIMBS (1 + (sizeof (double) + BYTES_PER_MP_LIMB-1) / BYTES_PER_MP_LIMB)
+#define N_QLIMBS (1 + (sizeof (double) + GMP_LIMB_BYTES-1) / GMP_LIMB_BYTES)
   mp_limb_t qarr[N_QLIMBS + 1];
   mp_ptr qp = qarr;
   TMP_DECL;
index 6a969dfe3ea351a621101ba4ad4d6133f88146ad..48a385c817efcfce46b9bb524a7b746a9583946b 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1991, 1994, 1995, 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index bbc6448fd0a92f5e57d6f66ed45497b04404ac1c..cb464ccb94f76eb9a0f954d1b919e304d86618d7 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1991, 1994, 1995, 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 74398a5380be65509b97100a8f8720f7646b6ebd..8fa0de1cd744aac301d71245ffc3ee958e18f73f 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2002, 2006, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <string.h>
index f075477d634c1a85003aa755132c1f713e675896..0f526ef31d08bd7c65a6e78387f8c35109d0e142 100644 (file)
@@ -1,33 +1,44 @@
 /* mpq_init -- Make a new rational number with value 0/1.
 
-Copyright 1991, 1994, 1995, 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1991, 1994, 1995, 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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 (MP_RAT *x)
+mpq_init (mpq_t x)
 {
   ALLOC(NUM(x)) = 1;
-  PTR(NUM(x)) = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
+  PTR(NUM(x)) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
   SIZ(NUM(x)) = 0;
   ALLOC(DEN(x)) = 1;
-  PTR(DEN(x)) = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
+  PTR(DEN(x)) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
   PTR(DEN(x))[0] = 1;
   SIZ(DEN(x)) = 1;
 
index 851daaa454aed9dab00ef321832e26dd0ac8c1c5..97c41656ffdd4351ae6784b721ce506a8fa9b98d 100644 (file)
@@ -5,47 +5,40 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>             /* for NULL */
 #include "gmp.h"
 #include "gmp-impl.h"
 
 void
-#if HAVE_STDARG
 mpq_inits (mpq_ptr x, ...)
-#else
-mpq_inits (va_alist)
-     va_dcl
-#endif
 {
   va_list  ap;
 
-#if HAVE_STDARG
   va_start (ap, x);
-#else
-  mpq_ptr x;
-  va_start (ap);
-  x = va_arg (ap, mpq_ptr);
-#endif
 
   while (x != NULL)
     {
index fef2f987dd2786c9d3090f0444026faaec3efe86..7ba95743f8f4a5e666c14190fcb620349197521f 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <ctype.h>
index 48f0ae75f2f05d3e112157520e0d4707bba8adfe..bd703d4860257e6eaef1c726614dc79a161c573d 100644 (file)
--- a/mpq/inv.c
+++ b/mpq/inv.c
@@ -6,17 +6,28 @@ Copyright 1991, 1994, 1995, 2000, 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 7b85793d27ec8af4c3e3db7499b8c613dc583bfa..a2a7e1e2fb723b5381d31c3a35c064149db3074d 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2000, 2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 839308b42a6bddcde43c063beb6dad6eeb0c5aa5..49d618f3bc1dde032464faebeba008d703990da1 100644 (file)
--- a/mpq/mul.c
+++ b/mpq/mul.c
@@ -1,22 +1,32 @@
 /* mpq_mul -- multiply two rational numbers.
 
-Copyright 1991, 1994, 1995, 1996, 2000, 2001, 2002 Free Software Foundation,
-Inc.
+Copyright 1991, 1994-1996, 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 32115c2fcb2e928e78e332b6c52d238c39d1bbd2..054e21ebe339da76232067bbcfc7d20ea93518e0 100644 (file)
--- a/mpq/neg.c
+++ b/mpq/neg.c
@@ -5,17 +5,28 @@ Copyright 2000, 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpq_neg 1
 
index ade8e2b19923ede81ab4ca16d5ade02b99f6c8c1..c2bc053b215b62457218af6c34e8c7971bb1b018 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
index b2dad7e591296d62f11d729f3e99bff29e849dcd..fb7bfad49c6a1c84beea046f1bd1b74e02813476 100644 (file)
--- a/mpq/set.c
+++ b/mpq/set.c
@@ -5,17 +5,28 @@ Copyright 1991, 1994, 1995, 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index c56ef5d69c7371591a28b6d3da280cd4078b37f9..308677db402c1ebd82ba28791765bc7e1e665bf6 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2000, 2002, 2003, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index e9ee17b71e528889251952e7834e1f66f0b4f6b9..4bcb86b097709654c1945e2fbc243e94882748d2 100644 (file)
@@ -1,22 +1,32 @@
 /* mpq_set_den(dest,den) -- Set the denominator of DEST from DEN.
 
-Copyright 1991, 1994, 1995, 1996, 2000, 2001, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1994-1996, 2000, 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index d1e14867be0a3722b8d301ca93fe45862050265f..7764a17f05e1cc4218732fc558dfd80e26d371cd 100644 (file)
@@ -1,21 +1,32 @@
 /* mpq_set_f -- set an mpq from an mpf.
 
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 5b018c808bd095113f2e1210e5a49f7d9c704402..c6b52ccaa18cae946a5353251242a8f954487e91 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1991, 1994, 1995, 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index f7499aa7c927fd6a756cf7157543459d5286b0ec..0a10b3048d1addfb4104255555f50cb5d1b552c1 100644 (file)
@@ -6,23 +6,34 @@ Copyright 1991, 1994, 1995, 2001, 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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 (MP_RAT *dest, signed long int num, unsigned long int den)
+mpq_set_si (mpq_t dest, signed long int num, unsigned long int den)
 {
   unsigned long int abs_num;
 
index 07a18bb17fd782ddc74ff5fd0052ae8cd44ab174..930fe5576c0a4630869fa3bf6003811a941eed92 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <string.h>
index 231e07d2a44c9de0a74b108416468edb274dcf9d..4473b30bb84b54dcb57c9296f524262a6630089b 100644 (file)
@@ -1,28 +1,39 @@
 /* mpq_set_ui(dest,ulong_num,ulong_den) -- Set DEST to the rational number
    ULONG_NUM/ULONG_DEN.
 
-Copyright 1991, 1994, 1995, 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 1991, 1994, 1995, 2001-2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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_ui (MP_RAT *dest, unsigned long int num, unsigned long int den)
+mpq_set_ui (mpq_t dest, unsigned long int num, unsigned long int den)
 {
   if (GMP_NUMB_BITS < BITS_PER_ULONG)
     {
index e6f3ff0b62294655d3a1f06ccf1680480105a00c..358d1ca899c414819d2e7ac6519e1fd93e0826b2 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1996, 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 0736c8779fabada4dc26af32983767ab33025ddb..51fdcac7fd3aa1e1fb5464f3cafbc00e16614280 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1997, 1998, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 2fd7c7f1c5a578307f6b14ac418607b57b576932..37e6c468bc82f0c9f280c14a6250b2107e29416b 100644 (file)
@@ -7,17 +7,28 @@ Copyright 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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 +73,7 @@ mpz_2fac_ui (mpz_ptr x, unsigned long n)
       mp_limb_t *factors, prod, max_prod, j;
       TMP_SDECL;
 
-      /* FIXME: we might alloc a fixed ammount 1+FAC_2DSC_THRESHOLD/FACTORS_PER_LIMB */
+      /* FIXME: we might alloc a fixed amount 1+FAC_2DSC_THRESHOLD/FACTORS_PER_LIMB */
       TMP_SMARK;
       factors = TMP_SALLOC_LIMBS (1 + n / (2 * FACTORS_PER_LIMB));
 
index cfc2d71ce7648526df959532e13d5982b2d143a4..1aac41b992a36cc0228af3c524ad9b444ae9faf0 100644 (file)
@@ -1,22 +1,32 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2012 Free Software
-# Foundation, Inc.
+# Copyright 1996, 1998-2003, 2012 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
@@ -43,12 +53,13 @@ libmpz_la_SOURCES = aors.h aors_ui.h fits_s.h mul_i.h \
   import.c init.c init2.c inits.c inp_raw.c inp_str.c \
   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 lucnum_ui.c lucnum2_ui.c mfac_uiui.c millerrabin.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 \
   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 root.c rootrem.c rrandomb.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 \
   swap.c tdiv_ui.c tdiv_q.c tdiv_q_2exp.c tdiv_q_ui.c tdiv_qr.c \
index c002ac75b93668b298649592895a855a3973ae46..fc2eb0fab7fccbda17b46abcbd3defc448e480d5 100644 (file)
 
 @SET_MAKE@
 
-# Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2012 Free Software
-# Foundation, Inc.
+# Copyright 1996, 1998-2003, 2012 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
 #
-# This file is part of the GNU MP Library.
+#    * 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.
 #
-# The GNU MP Library is free software; you can redistribute it and/or modify
-# it under the terms of 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 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 Lesser General Public
-# License for more details.
+#  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 a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  You should have received copies of the GNU General Public License and the
+#  GNU Lesser General Public License along with the GNU MP Library.  If not,
+#  see https://www.gnu.org/licenses/.
 
 VPATH = @srcdir@
 am__make_dryrun = \
@@ -99,18 +109,20 @@ am_libmpz_la_OBJECTS = 2fac_ui.lo add.lo add_ui.lo abs.lo aorsmul.lo \
        inits.lo inp_raw.lo inp_str.lo invert.lo ior.lo iset.lo \
        iset_d.lo iset_si.lo iset_str.lo iset_ui.lo jacobi.lo \
        kronsz.lo kronuz.lo kronzs.lo kronzu.lo lcm.lo lcm_ui.lo \
+       limbs_read.lo limbs_write.lo limbs_modify.lo limbs_finish.lo \
        lucnum_ui.lo lucnum2_ui.lo mfac_uiui.lo millerrabin.lo mod.lo \
        mul.lo mul_2exp.lo mul_si.lo mul_ui.lo n_pow_ui.lo neg.lo \
        nextprime.lo oddfac_1.lo out_raw.lo out_str.lo perfpow.lo \
        perfsqr.lo popcount.lo pow_ui.lo powm.lo powm_sec.lo \
        powm_ui.lo pprime_p.lo prodlimbs.lo primorial_ui.lo random.lo \
-       random2.lo realloc.lo realloc2.lo remove.lo root.lo rootrem.lo \
-       rrandomb.lo scan0.lo scan1.lo set.lo set_d.lo set_f.lo \
-       set_q.lo set_si.lo set_str.lo set_ui.lo setbit.lo size.lo \
-       sizeinbase.lo sqrt.lo sqrtrem.lo sub.lo sub_ui.lo swap.lo \
-       tdiv_ui.lo tdiv_q.lo tdiv_q_2exp.lo tdiv_q_ui.lo tdiv_qr.lo \
-       tdiv_qr_ui.lo tdiv_r.lo tdiv_r_2exp.lo tdiv_r_ui.lo tstbit.lo \
-       ui_pow_ui.lo ui_sub.lo urandomb.lo urandomm.lo xor.lo
+       random2.lo realloc.lo realloc2.lo remove.lo roinit_n.lo \
+       root.lo rootrem.lo rrandomb.lo scan0.lo scan1.lo set.lo \
+       set_d.lo set_f.lo set_q.lo set_si.lo set_str.lo set_ui.lo \
+       setbit.lo size.lo sizeinbase.lo sqrt.lo sqrtrem.lo sub.lo \
+       sub_ui.lo swap.lo tdiv_ui.lo tdiv_q.lo tdiv_q_2exp.lo \
+       tdiv_q_ui.lo tdiv_qr.lo tdiv_qr_ui.lo tdiv_r.lo tdiv_r_2exp.lo \
+       tdiv_r_ui.lo tstbit.lo ui_pow_ui.lo ui_sub.lo urandomb.lo \
+       urandomm.lo xor.lo
 libmpz_la_OBJECTS = $(am_libmpz_la_OBJECTS)
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
 depcomp =
@@ -316,12 +328,13 @@ libmpz_la_SOURCES = aors.h aors_ui.h fits_s.h mul_i.h \
   import.c init.c init2.c inits.c inp_raw.c inp_str.c \
   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 lucnum_ui.c lucnum2_ui.c mfac_uiui.c millerrabin.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 \
   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 root.c rootrem.c rrandomb.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 \
   swap.c tdiv_ui.c tdiv_q.c tdiv_q_2exp.c tdiv_q_ui.c tdiv_qr.c \
index fcbb4a2f1cb3c21d6c2a367c62ea14f3dd0c87c0..81c6b6326688e9023c205f6bd474e03cb444f514 100644 (file)
--- a/mpz/abs.c
+++ b/mpz/abs.c
@@ -1,21 +1,32 @@
 /* mpz_abs(dst, src) -- Assign the absolute value of SRC to DST.
 
-Copyright 1991, 1993, 1994, 1995, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993-1995, 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpz_abs 1
 
index 60cc416263c7441b87a34dd7b2987f236c7eb48a..f1f0ae8e160de556cff8701dce6e3542f6687a2a 100644 (file)
--- a/mpz/add.c
+++ b/mpz/add.c
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 OPERATION_add
index cccb9290464b64d3f878c9aa8d191d20603de79d..8fd15ad61119d64e6b32fc97db572a2aa82a1bd5 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 OPERATION_add_ui
index 5d50c769e01429a405a5021b7ef9229404dc9f94..5aa01a71da1f8cd1c2a9d2495809eb26e93dc894 100644 (file)
--- a/mpz/and.c
+++ b/mpz/and.c
@@ -1,22 +1,33 @@
 /* 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 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 79ac5fcd599b413d69246425f5e4ed8ae2c6ed7a..4d22754b23ba7300da974456bc4a1c32cc8da846 100644 (file)
@@ -6,17 +6,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index e46726747562583e30bf12665b4e4995d3390801..2e3c481ab702ac06fd4d94d558b80a250ba4f0ae 100644 (file)
@@ -1,23 +1,34 @@
 /* mpz_add_ui, mpz_sub_ui -- Add or subtract an mpz_t and an unsigned
    one-word integer.
 
-Copyright 1991, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2004, 2012 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1999-2002, 2004, 2012, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -67,22 +78,21 @@ FUNCTION (mpz_ptr w, mpz_srcptr u, unsigned long int vval)
 #endif
 
   usize = SIZ (u);
+  if (usize == 0)
+    {
+      PTR (w)[0] = vval;
+      SIZ (w) = VARIATION_NEG (vval != 0);
+      return;
+    }
+
   abs_usize = ABS (usize);
 
   /* If not space for W (and possible carry), increase space.  */
-  wsize = abs_usize + 1;
-  wp = MPZ_REALLOC (w, wsize);
+  wp = MPZ_REALLOC (w, abs_usize + 1);
 
   /* These must be after realloc (U may be the same as W).  */
   up = PTR (u);
 
-  if (abs_usize == 0)
-    {
-      wp[0] = vval;
-      SIZ (w) = VARIATION_NEG (vval != 0);
-      return;
-    }
-
   if (usize VARIATION_CMP 0)
     {
       mp_limb_t cy;
index d8145054343f83886106e4266b3b3829545648ef..bf012c965ce71c557024cd278a4d43a5ef845098 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2004, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 647b87978294ea0b456506e3fd4cfd839dc943a2..eafd5f36de9f60e378c34ceb0343ecbc5171a040 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2001, 2002, 2004, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index cdec4fd0d0a3e66a44f7dd6b040d8b6a1c3f27fa..b967ddbeefb84e573660d7f064b7b4e10f1e6130 100644 (file)
@@ -1,22 +1,32 @@
 /* mpz_array_init (array, array_size, size_per_elem) --
 
-Copyright 1991, 1993, 1994, 1995, 2000, 2001, 2002, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993-1995, 2000-2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -24,12 +34,12 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 void
 mpz_array_init (mpz_ptr arr, mp_size_t arr_size, mp_size_t nbits)
 {
-  register mp_ptr p;
-  register mp_size_t i;
+  mp_ptr p;
+  mp_size_t i;
   mp_size_t nlimbs;
 
-  nlimbs = (nbits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
-  p = (mp_ptr) (*__gmp_allocate_func) (arr_size * nlimbs * BYTES_PER_MP_LIMB);
+  nlimbs = nbits / GMP_NUMB_BITS + 1;
+  p = (mp_ptr) (*__gmp_allocate_func) ((size_t) arr_size * nlimbs * GMP_LIMB_BYTES);
 
   for (i = 0; i < arr_size; i++)
     {
index 1370a6c21c8f74b96e908caec10aa2a0a0b603ef..c24b21724c1c5e5fdafb7d75cb32b935a22c817f 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz_bin_ui - compute n over k.
 
-Copyright 1998, 1999, 2000, 2001, 2002, 2012 Free Software Foundation, Inc.
+Copyright 1998-2002, 2012, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -50,8 +61,8 @@ mpz_bin_ui (mpz_ptr r, mpz_srcptr n, unsigned long int k)
     {
       /* bin(n,k) = (-1)^k * bin(-n+k-1,k), and set ni = -n+k-1 - k = -n-1 */
       mpz_init (ni);
-      mpz_neg (ni, n);
-      mpz_sub_ui (ni, ni, 1L);
+      mpz_add_ui (ni, n, 1L);
+      mpz_neg (ni, ni);
       negate = (k & 1);   /* (-1)^k */
     }
   else
index d86fb298e4243dccfaee32297a56e43973256296..94a9dc5c75d8234e81a02ea903f0b8e681815a37 100644 (file)
@@ -2,22 +2,33 @@
 
 Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
 
-Copyright 2010, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2010-2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -149,7 +160,7 @@ typedef mp_limb_t (* mulfunc_t) (mp_limb_t);
 static const mulfunc_t mulfunc[] = {mul1,mul2,mul3,mul4,mul5,mul6,mul7,mul8};
 #define M (numberof(mulfunc))
 
-/* Number of factors-of-2 removed by the corresponding mulN functon.  */
+/* Number of factors-of-2 removed by the corresponding mulN function.  */
 static const unsigned char tcnttab[] = {0, 1, 1, 2, 2, 4, 4, 6};
 
 #if 1
index 4f00227decb60b005bb11574df9b3dfec55437d2..32e3200a8d55a985759f9f7b3bb0687747b264e3 100644 (file)
@@ -1,23 +1,33 @@
 /* mpz_cdiv_q -- Division rounding the quotient towards +infinity.  The
    remainder gets the opposite sign as the denominator.
 
-Copyright 1994, 1995, 1996, 2000, 2001, 2005, 2012 Free Software Foundation,
-Inc.
+Copyright 1994-1996, 2000, 2001, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index c4c6ad4a7cc43ed5c83f9c4ac63f02fbd5e850bc..63608c90438c2bdc3f5633d5909b6ca18b6170e0 100644 (file)
@@ -9,17 +9,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index e2319272ce86849e57b5ed64ccd4a1060d670dfa..45e9a2774ccdafe60b4d7e6f3f58534c15c00c8a 100644 (file)
@@ -1,23 +1,33 @@
 /* mpz_cdiv_qr -- Division rounding the quotient towards +infinity.  The
    remainder gets the opposite sign as the denominator.
 
-Copyright 1994, 1995, 1996, 2000, 2001, 2005, 2012 Free Software Foundation,
-Inc.
+Copyright 1994-1996, 2000, 2001, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index eeec6eddd06b94c5587dbdb71d0ea7b4834ae1d7..1ccfbbe7fd23a0cfd784197116404464fcf5f0d8 100644 (file)
@@ -3,23 +3,34 @@
    always fit into the return type, the negative of the true remainder is
    returned.
 
-Copyright 1994, 1995, 1996, 1999, 2001, 2002, 2004, 2012 Free Software
-Foundation, Inc.
+Copyright 1994-1996, 1999, 2001, 2002, 2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 67e1ee13425f1aef61f58d939d6ebd3936a0711b..9cebab3e061cea85bbe82c4869883149628edc0a 100644 (file)
@@ -1,22 +1,33 @@
 /* mpz_cdiv_r -- Division rounding the quotient towards +infinity.  The
    remainder gets the opposite sign as the denominator.
 
-Copyright 1994, 1995, 1996, 2001, 2005, 2012 Free Software Foundation, Inc.
+Copyright 1994-1996, 2001, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 46e72507b347fa7e1b2c544d90c3fb45a051142e..68fb149c461df1664e4c159be853555c732ad059 100644 (file)
@@ -3,23 +3,34 @@
    always fit into the return type, the negative of the true remainder is
    returned.
 
-Copyright 1994, 1995, 1996, 2001, 2002, 2004, 2005, 2012 Free Software
-Foundation, Inc.
+Copyright 1994-1996, 2001, 2002, 2004, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index bfbb25b8d497bd7d0cafa57d8117fcdc6bd8d8c0..1f7f6e3c1baf4d78577a2fde4c74140b6e65c4b5 100644 (file)
@@ -3,23 +3,34 @@
    always fit into the return type, the negative of the true remainder is
    returned.
 
-Copyright 1994, 1995, 1996, 2001, 2002, 2004, 2005, 2012 Free Software
-Foundation, Inc.
+Copyright 1994-1996, 2001, 2002, 2004, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index c71d4141369fc14b748982280ccb3403a08b9e3d..c69e37c605454a530be7ff3a2f89aeb5a4cdd20a 100644 (file)
@@ -6,17 +6,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 205a7bd23eccc2afe1fc26b4031c5dfacf6b7ec3..5466691f295ee1a4cf8cf8992defe69153ff8dca 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2002, 2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 7dfc8f412b0d37a71b6e16fc9308b0c22de5edd4..30f626c5052ccd9851873361aa25341bc0961b94 100644 (file)
@@ -1,23 +1,34 @@
 /* mpz_clear -- de-allocate the space occupied by the dynamic digit space of
    an integer.
 
-Copyright 1991, 1993, 1994, 1995, 2000, 2001, 2012 Free Software Foundation,
+Copyright 1991, 1993-1995, 2000, 2001, 2012, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -25,5 +36,5 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 void
 mpz_clear (mpz_ptr m)
 {
-  (*__gmp_free_func) (PTR (m), ALLOC (m) * BYTES_PER_MP_LIMB);
+  (*__gmp_free_func) (PTR (m), (size_t) ALLOC (m) * GMP_LIMB_BYTES);
 }
index e9f2cf47b66f49dc69c049a7275d14f009b579be..193c5ade773168f60ad5952c42dc13bd520a344b 100644 (file)
@@ -1,55 +1,48 @@
 /* mpz_clears() -- Clear multiple mpz_t variables.
 
-Copyright 2009 Free Software Foundation, Inc.
+Copyright 2009, 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>             /* for NULL */
 #include "gmp.h"
 #include "gmp-impl.h"
 
 void
-#if HAVE_STDARG
 mpz_clears (mpz_ptr x, ...)
-#else
-mpz_clears (va_alist)
-     va_dcl
-#endif
 {
   va_list  ap;
 
-#if HAVE_STDARG
   va_start (ap, x);
-#else
-  mpz_ptr x;
-  va_start (ap);
-  x = va_arg (ap, mpz_ptr);
-#endif
 
   while (x != NULL)
     {
-      mpz_clear (x);
+      (*__gmp_free_func) (PTR (x), (size_t) ALLOC (x) * GMP_LIMB_BYTES);
       x = va_arg (ap, mpz_ptr);
     }
   va_end (ap);
index ffd910d0cd39901ef0536b8e8398010c713db306..2475efe1e5b79498c990d485387b44264de34259 100644 (file)
@@ -1,22 +1,32 @@
 /* mpz_clrbit -- clear a specified bit.
 
-Copyright 1991, 1993, 1994, 1995, 2001, 2002, 2012 Free Software Foundation,
-Inc.
+Copyright 1991, 1993-1995, 2001, 2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -36,11 +46,10 @@ mpz_clrbit (mpz_ptr d, mp_bitcnt_t bit_idx)
       if (limb_idx < dsize)
        {
          mp_limb_t  dlimb;
-         dlimb = dp[limb_idx];
-         dlimb &= ~mask;
+         dlimb = dp[limb_idx] & ~mask;
          dp[limb_idx] = dlimb;
 
-         if (UNLIKELY (dlimb == 0 && limb_idx == dsize-1))
+         if (UNLIKELY ((dlimb == 0) + limb_idx == dsize)) /* dsize == limb_idx + 1 */
            {
              /* high limb became zero, must normalize */
              MPN_NORMALIZE (dp, limb_idx);
@@ -52,8 +61,6 @@ mpz_clrbit (mpz_ptr d, mp_bitcnt_t bit_idx)
     }
   else
     {
-      mp_size_t zero_bound;
-
       /* Simulate two's complement arithmetic, i.e. simulate
         1. Set OP = ~(OP - 1) [with infinitely many leading ones].
         2. clear the bit.
@@ -61,42 +68,49 @@ mpz_clrbit (mpz_ptr d, mp_bitcnt_t bit_idx)
 
       dsize = -dsize;
 
-      /* No index upper bound on this loop, we're sure there's a non-zero limb
-        sooner or later.  */
-      zero_bound = 0;
-      while (dp[zero_bound] == 0)
-       zero_bound++;
-
-      if (limb_idx > zero_bound)
+      if (limb_idx < dsize)
        {
-         if (limb_idx < dsize)
-           dp[limb_idx] |= mask;
-         else
+         mp_size_t zero_bound;
+
+         /* No index upper bound on this loop, we're sure there's a non-zero limb
+            sooner or later.  */
+         zero_bound = 0;
+         while (dp[zero_bound] == 0)
+           zero_bound++;
+
+         if (limb_idx > zero_bound)
            {
-             /* Ugh.  The bit should be cleared outside of the end of the
-                number.  We have to increase the size of the number.  */
-             dp = MPZ_REALLOC (d, limb_idx + 1);
-             SIZ (d) = -(limb_idx + 1);
-             MPN_ZERO (dp + dsize, limb_idx - dsize);
-             dp[limb_idx] = mask;
+             dp[limb_idx] |= mask;
            }
-       }
-      else if (limb_idx == zero_bound)
-       {
-         dp[limb_idx] = ((((dp[limb_idx] - 1) | mask) + 1) & GMP_NUMB_MASK);
-         if (dp[limb_idx] == 0)
+         else if (limb_idx == zero_bound)
            {
-             /* Increment at limb_idx + 1.  Extend the number with a zero limb
-                for simplicity.  */
-             dp = MPZ_REALLOC (d, dsize + 1);
-             dp[dsize] = 0;
-             MPN_INCR_U (dp + limb_idx + 1, dsize - limb_idx, 1);
-             dsize += dp[dsize];
-
-             SIZ (d) = -dsize;
+             mp_limb_t  dlimb;
+             dlimb = (((dp[limb_idx] - 1) | mask) + 1) & GMP_NUMB_MASK;
+             dp[limb_idx] = dlimb;
+
+             if (dlimb == 0)
+               {
+                 /* Increment at limb_idx + 1.  Extend the number with a zero limb
+                    for simplicity.  */
+                 dp = MPZ_REALLOC (d, dsize + 1);
+                 dp[dsize] = 0;
+                 MPN_INCR_U (dp + limb_idx + 1, dsize - limb_idx, 1);
+                 dsize += dp[dsize];
+
+                 SIZ (d) = -dsize;
+               }
            }
+         else
+           ;
        }
       else
-       ;
+       {
+         /* Ugh.  The bit should be cleared outside of the end of the
+            number.  We have to increase the size of the number.  */
+         dp = MPZ_REALLOC (d, limb_idx + 1);
+         SIZ (d) = -(limb_idx + 1);
+         MPN_ZERO (dp + dsize, limb_idx - dsize);
+         dp[limb_idx] = mask;
+       }
     }
 }
index b7bf0d967f8d331f28dd7cd9c6685811d386c6a8..b8a5eaa7657a4a873117f4a91654dda1a042bbba 100644 (file)
--- a/mpz/cmp.c
+++ b/mpz/cmp.c
@@ -1,23 +1,34 @@
 /* mpz_cmp(u,v) -- Compare U, V.  Return positive, zero, or negative
    based on if U > V, U == V, or U < V.
 
-Copyright 1991, 1993, 1994, 1996, 2001, 2002, 2011 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2001, 2002, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index a9a3a9623b83b24f643b15641f775812de180094..45926d6d54789d273be612a330efaf09809daf53 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz_cmp_d -- compare absolute values of mpz and double.
 
-Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2001-2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 9feac962d0ef223aab605295446992b8041dd43d..86251f436adb52ad6cf5d1b8089b4cede4c56bd7 100644 (file)
@@ -1,23 +1,33 @@
 /* mpz_cmp_si(u,v) -- Compare an integer U with a single-word int V.
    Return positive, zero, or negative based on if U > V, U == V, or U < V.
 
-Copyright 1991, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2012, 2013 Free
-Software Foundation, Inc.
+Copyright 1991, 1993-1996, 2000-2002, 2012, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -25,11 +35,6 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 int
 _mpz_cmp_si (mpz_srcptr u, signed long int v_digit) __GMP_NOTHROW
 {
-  mp_size_t usize = SIZ (u);
-  mp_size_t vsize;
-  mp_limb_t u_digit;
-  unsigned long int absv_digit;
-
 #if GMP_NAIL_BITS != 0
   /* FIXME.  This isn't very pretty.  */
   mpz_t tmp;
@@ -38,30 +43,28 @@ _mpz_cmp_si (mpz_srcptr u, signed long int v_digit) __GMP_NOTHROW
   ALLOC(tmp) = 2;
   mpz_set_si (tmp, v_digit);
   return mpz_cmp (u, tmp);
-#endif
+#else
 
-  vsize = 0;
-  if (v_digit > 0)
-    vsize = 1;
-  else if (v_digit < 0)
-    {
-      vsize = -1;
-    }
-  absv_digit = ABS_CAST (unsigned long int, v_digit);
+  mp_size_t vsize, usize;
 
-  if (usize != vsize)
-    return usize - vsize;
+  usize = SIZ (u);
+  vsize = (v_digit > 0) - (v_digit < 0);
 
-  if (usize == 0)
-    return 0;
+  if ((usize == 0) | (usize != vsize))
+    return usize - vsize;
+  else {
+    mp_limb_t u_digit, absv_digit;
 
-  u_digit = PTR (u)[0];
+    u_digit = PTR (u)[0];
+    absv_digit = ABS_CAST (unsigned long, v_digit);
 
-  if (u_digit == (mp_limb_t) absv_digit)
-    return 0;
+    if (u_digit == absv_digit)
+      return 0;
 
-  if (u_digit > (mp_limb_t) absv_digit)
-    return usize;
-  else
-    return -usize;
+    if (u_digit > absv_digit)
+      return usize;
+    else
+      return -usize;
+  }
+#endif
 }
index f9f27ba494a5889b474f9233e37cca838dfc0b3b..790d8241d683e7f8bcceefc7916e006d7163a9af 100644 (file)
@@ -1,23 +1,33 @@
 /* mpz_cmp_ui.c -- Compare a mpz_t a with an mp_limb_t b.  Return positive,
   zero, or negative based on if a > b, a == b, or a < b.
 
-Copyright 1991, 1993, 1994, 1995, 1996, 2001, 2002 Free Software Foundation,
-Inc.
+Copyright 1991, 1993-1996, 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index f7bbcd7c77a87e4b34843a4784f59156b0896b01..5685776abe954c4c1defc0e6a0f817f67540e744 100644 (file)
@@ -1,23 +1,34 @@
 /* mpz_cmpabs(u,v) -- Compare U, V.  Return positive, zero, or negative
    based on if U > V, U == V, or U < V.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index a5f2085607e0630dac016afc3dfa05c4cb4ba028..a4b95d26aa3399f803f0d32ed000c4668ca892e9 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz_cmpabs_d -- compare absolute values of mpz and double.
 
-Copyright 2001, 2002, 2003, 2012 Free Software Foundation, Inc.
+Copyright 2001-2003, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index f8df4b8c42f6a8d012245c4803c1a4fa38019bef..fdeb061945de9c7b4a537c37274a033f95217f38 100644 (file)
@@ -1,23 +1,33 @@
 /* mpz_cmpabs_ui.c -- Compare a mpz_t a with an mp_limb_t b.  Return positive,
   zero, or negative based on if a > b, a == b, or a < b.
 
-Copyright 1991, 1993, 1994, 1995, 1997, 2000, 2001, 2002 Free Software
-Foundation, Inc.
+Copyright 1991, 1993-1995, 1997, 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 719f3158d381a221a7dbbc04b0a54ef45741e7e3..66d69ce8b24c92e12780323af8c229abf24f8bf7 100644 (file)
--- a/mpz/com.c
+++ b/mpz/com.c
@@ -7,17 +7,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -51,7 +62,7 @@ mpz_com (mpz_ptr dst, mpz_srcptr src)
 
          cy = mpn_add_1 (dst_ptr, src_ptr, size, (mp_limb_t) 1);
          dst_ptr[size] = cy;
-         size += (cy != 0);
+         size += cy;
 
          /* Store a negative size, to indicate ones-extension.  */
          SIZ (dst) = -size;
index 7f3c9f212dadf828335d150fb7794bf4abd5d713..85ea4c8b26c51984c9b9e11e084269df60d5e68e 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2002, 2003, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -50,15 +61,16 @@ mpz_combit (mpz_ptr d, mp_bitcnt_t bit_index)
          dp = MPZ_REALLOC (d, 1 + dsize);
          dp[dsize] = 0;
          MPN_INCR_U (dp + limb_index, 1 + dsize - limb_index, bit);
-         SIZ(d) -= dp[dsize];
+         SIZ(d) = - dsize - dp[dsize];
        }
       else
        {
          /* We toggle a zero bit, subtract from the absolute value. */
          MPN_DECR_U (dp + limb_index, dsize - limb_index, bit);
-         MPN_NORMALIZE (dp, dsize);
-         ASSERT (dsize > 0);
-         SIZ(d) = -dsize;
+         /* The absolute value shrinked by at most one bit. */
+         dsize -= dp[dsize - 1] == 0;
+         ASSERT (dsize > 0 && dp[dsize - 1] != 0);
+         SIZ (d) = -dsize;
        }
     }
   else
@@ -67,15 +79,17 @@ mpz_combit (mpz_ptr d, mp_bitcnt_t bit_index)
       dsize = ABS(dsize);
       if (limb_index < dsize)
        {
-         dp[limb_index] ^= bit;
+         mp_limb_t      dlimb;
+         dlimb = dp[limb_index] ^ bit;
+         dp[limb_index] = dlimb;
 
          /* Can happen only when limb_index = dsize - 1. Avoid SIZ(d)
             bookkeeping in the common case. */
-         if (dp[dsize-1] == 0)
+         if (UNLIKELY ((dlimb == 0) + limb_index == dsize)) /* dsize == limb_index + 1 */
            {
-             dsize--;
-             MPN_NORMALIZE (dp, dsize);
-             SIZ (d) = SIZ (d) >= 0 ? dsize : -dsize;
+             /* high limb became zero, must normalize */
+             MPN_NORMALIZE (dp, limb_index);
+             SIZ (d) = SIZ (d) >= 0 ? limb_index : -limb_index;
            }
        }
       else
index 8dcf0777c46eb09e8be1849e3475118bbd981971..1855b5052ac828cfd869a92343e2e1281fe85aae 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2002, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index b4fb08013fbeddc8bfec3e48690aa984a09f1e05..8e78b173787d8d81c9178c68698074c604bf0f85 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz_congruent_2exp_p -- test congruence of mpz mod 2^n.
 
-Copyright 2001, 2002 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -28,10 +39,19 @@ mpz_congruent_2exp_p (mpz_srcptr a, mpz_srcptr c, mp_bitcnt_t d) __GMP_NOTHROW
   unsigned       dbits;
   mp_ptr         ap, cp;
   mp_limb_t      dmask, alimb, climb, sum;
-  mp_size_t      asize_signed, csize_signed, asize, csize;
+  mp_size_t      as, cs, asize, csize;
 
-  if (ABSIZ(a) < ABSIZ(c))
-    MPZ_SRCPTR_SWAP (a, c);
+  as = SIZ(a);
+  asize = ABS(as);
+
+  cs = SIZ(c);
+  csize = ABS(cs);
+
+  if (asize < csize)
+    {
+      MPZ_SRCPTR_SWAP (a, c);
+      MP_SIZE_T_SWAP (asize, csize);
+    }
 
   dlimbs = d / GMP_NUMB_BITS;
   dbits = d % GMP_NUMB_BITS;
@@ -40,16 +60,10 @@ mpz_congruent_2exp_p (mpz_srcptr a, mpz_srcptr c, mp_bitcnt_t d) __GMP_NOTHROW
   ap = PTR(a);
   cp = PTR(c);
 
-  asize_signed = SIZ(a);
-  asize = ABS(asize_signed);
-
-  csize_signed = SIZ(c);
-  csize = ABS(csize_signed);
-
-  if (csize_signed == 0)
+  if (csize == 0)
     goto a_zeros;
 
-  if ((asize_signed ^ csize_signed) >= 0)
+  if ((cs ^ as) >= 0)
     {
       /* same signs, direct comparison */
 
@@ -83,7 +97,7 @@ mpz_congruent_2exp_p (mpz_srcptr a, mpz_srcptr c, mp_bitcnt_t d) __GMP_NOTHROW
       /* common low zero limbs, stopping at first non-zeros, which must
         match twos complement */
       i = 0;
-      for (;;)
+      do
        {
          ASSERT (i < csize);  /* always have a non-zero limb on c */
          alimb = ap[i];
@@ -92,33 +106,25 @@ mpz_congruent_2exp_p (mpz_srcptr a, mpz_srcptr c, mp_bitcnt_t d) __GMP_NOTHROW
 
          if (i >= dlimbs)
            return (sum & dmask) == 0;
-         i++;
+         ++i;
 
          /* require both zero, or first non-zeros as twos-complements */
          if (sum != 0)
            return 0;
-
-         if (alimb != 0)
-           break;
-       }
+       } while (alimb == 0);
 
       /* further limbs matching as ones-complement */
-      for (;;)
+      for (; i < csize; ++i)
        {
-         if (i >= csize)
-           break;
-
          alimb = ap[i];
          climb = cp[i];
-         sum = (alimb + climb + 1) & GMP_NUMB_MASK;
+         sum = alimb ^ climb ^ GMP_NUMB_MASK;
 
          if (i >= dlimbs)
            return (sum & dmask) == 0;
 
          if (sum != 0)
            return 0;
-
-         i++;
        }
 
       /* no more c, so require all 1 bits in a */
index 539e95fe179e745b77c873a34068d091076045d0..a9729d9a85892a70b775e51de50d1437cf09347c 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz_congruent_ui_p -- test congruence of mpz and ulong.
 
-Copyright 2000, 2001, 2002, 2012 Free Software Foundation, Inc.
+Copyright 2000-2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 34f826dc3cd3c78a0ac3787a1ce5489312cde068..8a1b5a31ff887ca6c23a7779785379598422a81c 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 1069fc66625d67bb9df5bcd77675965490b73500..3cb181c31958f5866daa64bb071a7e9a46b18c76 100644 (file)
@@ -8,17 +8,28 @@ Copyright 2000, 2005, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 1e5c3ac3e2ae126bc60f7106eb7bc3f251fe8497..e935471529905846ebc4fd0d447e6e6a3fc97857 100644 (file)
@@ -1,24 +1,35 @@
 /* mpz_divexact -- finds quotient when known that quot * den == num && den != 0.
 
-Contributed to the GNU project by Niels Möller.
+Contributed to the GNU project by Niels Möller.
 
-Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2005,
-2006, 2007, 2009, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993-1998, 2000-2002, 2005-2007, 2009, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 78ac38f410fb6a4e90207cea7102f55017780283..cd9d406846bd8c4556ad458591166c897d405660 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 814037fdf23f4ee54920658950cf5de3013ebf9b..db6cfa443395de13930885c332f3f65ef530fb74 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 00d0d1f327ffed034aa2a400b4446f34f8c730db..41ff5f0b84efb20a713eba2af40b8ba52a5f689d 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz_divisible_ui_p -- mpz by ulong divisibility test.
 
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index c5656a776d5f59f61a089de188815e912847e386..282be34db708e1f2e7e00b25a63aa70cf13ff9c9 100644 (file)
@@ -5,22 +5,33 @@
    FUNCTION WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
 
 
-Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1999-2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <string.h> /* for strlen */
index 6173fb6ca6249f03a884c89524e5b6a994abeab9..bc4c4df976a5f3171122da6b68708cd3873fa599 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2002, 2003, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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"
index bb7a9c440a1a0e5efecf01fb978fa2c68635d3e1..e0932272ff6d83c1fa6bbfb6b90a671abbd5f6a9 100644 (file)
@@ -2,23 +2,33 @@
 
 Contributed to the GNU project by Marco Bodrato.
 
-Copyright 1991, 1993, 1994, 1995, 2000, 2001, 2002, 2003, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1991, 1993-1995, 2000-2003, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 6281b1ee6918b5f836a9de138912bf21c6d205f6..5713b905b2abc22d80eeff88fdc6e9d6732184c5 100644 (file)
@@ -1,23 +1,33 @@
 /* mpz_fdiv_q -- Division rounding the quotient towards -infinity.
    The remainder gets the same sign as the denominator.
 
-Copyright 1994, 1995, 1996, 2000, 2001, 2005, 2012 Free Software Foundation,
-Inc.
+Copyright 1994-1996, 2000, 2001, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 41fa8ab684291df2cc4dbf1eee4f24bed5c0ffe8..7899992d049ec5dfb4f336925f061c38e282da5f 100644 (file)
@@ -1,23 +1,34 @@
 /* mpz_fdiv_q_ui -- Division rounding the quotient towards -infinity.
    The remainder gets the same sign as the denominator.
 
-Copyright 1994, 1995, 1996, 1999, 2001, 2002, 2004, 2012 Free Software
-Foundation, Inc.
+Copyright 1994-1996, 1999, 2001, 2002, 2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index d48654776135ad9e28234f5ba1b5b6f1ca284dc1..36cfd367add1ae9cd10341eed04239a11c8d26b7 100644 (file)
@@ -1,23 +1,33 @@
 /* mpz_fdiv_qr -- Division rounding the quotient towards -infinity.
    The remainder gets the same sign as the denominator.
 
-Copyright 1994, 1995, 1996, 2000, 2001, 2005, 2012 Free Software Foundation,
-Inc.
+Copyright 1994-1996, 2000, 2001, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index a4e84eb40980d9bfa991d6bd85c5a629281ccd60..c8435a423c43e44ca561637fd7c85d0b648da6fd 100644 (file)
@@ -1,23 +1,34 @@
 /* mpz_fdiv_qr_ui -- Division rounding the quotient towards -infinity.
    The remainder gets the same sign as the denominator.
 
-Copyright 1994, 1995, 1996, 1999, 2001, 2002, 2004, 2012 Free Software Foundation,
+Copyright 1994-1996, 1999, 2001, 2002, 2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 706e49ec1aca308bbf9f09cb63de268ad35c671b..35f2789b14cb2a666c317e4006e18fbeb48e1c79 100644 (file)
@@ -1,22 +1,33 @@
 /* mpz_fdiv_r -- Division rounding the quotient towards -infinity.
    The remainder gets the same sign as the denominator.
 
-Copyright 1994, 1995, 1996, 2001, 2005, 2012 Free Software Foundation, Inc.
+Copyright 1994-1996, 2001, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 3d3a00e6225bb535cca64411b79c4146f5918217..98dd56c6f22a22f6c440ccd4ae5f0e6ac3148fa4 100644 (file)
@@ -1,23 +1,34 @@
 /* mpz_fdiv_r_ui -- Division rounding the quotient towards -infinity.
    The remainder gets the same sign as the denominator.
 
-Copyright 1994, 1995, 1996, 2001, 2002, 2004, 2005, 2012 Free Software Foundation,
+Copyright 1994-1996, 2001, 2002, 2004, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index c4f4ec962a26a020122116aa8709c6cf40d9556e..532ee2cbec5d180994e4b7a0c0daf92d980d0538 100644 (file)
@@ -1,23 +1,34 @@
 /* mpz_fdiv_ui -- Division rounding the quotient towards -infinity.
    The remainder gets the same sign as the denominator.
 
-Copyright 1994, 1995, 1996, 2001, 2002, 2004, 2005, 2012 Free Software
-Foundation, Inc.
+Copyright 1994-1996, 2001, 2002, 2004, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 1bd61d16e31d2cc588fe50b911e88d7df41219f1..122db8dd5193141ce6bc82629ca79af858bb43e5 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
index daa77bbd9f4368e414ab0ba0fe8f4f31107fc6df..c0f57a0dc92b4b49079413f81d8ca76af3d3bb63 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz_fib_ui -- calculate Fibonacci numbers.
 
-Copyright 2000, 2001, 2002, 2005, 2012 Free Software Foundation, Inc.
+Copyright 2000-2002, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
index d690c08df132cd5ddb4e55a23e32827abc6daa23..e7f21d1b2bd9e5099db5eb214ecce29bb0c93e32 100644 (file)
@@ -1,21 +1,32 @@
 /* int mpz_fits_X_p (mpz_t z) -- test whether z fits signed type X.
 
-Copyright 1997, 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1997, 2000-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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -33,7 +44,7 @@ FUNCTION (mpz_srcptr z) __GMP_NOTHROW
   if (n == 1)
     return limb <= MAXIMUM;
   if (n == -1)
-    return limb <= - (mp_limb_t) MINIMUM;
+    return limb <= NEG_CAST (mp_limb_t, MINIMUM);
 #if GMP_NAIL_BITS != 0
   {
     if ((p[1] >> GMP_NAIL_BITS) == 0)
@@ -42,7 +53,7 @@ FUNCTION (mpz_srcptr z) __GMP_NOTHROW
        if (n == 2)
          return limb <= MAXIMUM;
        if (n == -2)
-         return limb <= - (mp_limb_t) MINIMUM;
+         return limb <= NEG_CAST (mp_limb_t, MINIMUM);
       }
   }
 #endif
index 3ec3ef6ff172d2867d9f5982fa30e0bce8f7a780..d548c45b0d33b2a0877595a164b8ea9c5d7032db 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1997, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 FUNCTION  mpz_fits_sint_p
index e9c88e11e56710fbd5b02e107ac6d6c905452b83..9306a00c0f11eb4b3208ec43e9329d9102210fda 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1997, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 FUNCTION  mpz_fits_slong_p
index f973c417e1ba7296d337de53b65c4b80016f6ef3..431d6b06ce70e4940acc5f66bf3458901edbde42 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1997, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 FUNCTION  mpz_fits_sshort_p
index c2b95e5796c49f5ba44208adcf254718c189a851..a37e291b6edd6e8784fd176c4c252d0259bd9d2c 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1997, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpz_fits_uint_p 1
 
index 71013e0a56edde9026c7fb35527952b0919772f8..fa40eb567101eccc3354d392d5b3ed2e6e555022 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1997, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpz_fits_ulong_p 1
 
index 47d37cd24be7e54620fd6a991763867447dbaf51..7f6f907821b6ccd39bf1204a2065f241ad62208f 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1997, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpz_fits_ushort_p 1
 
index 688b7397d43de20f92b3b28b69978d8841f633d9..87c6a8f17b7ca8a269c0919fd737ba2c834df09f 100644 (file)
--- a/mpz/gcd.c
+++ b/mpz/gcd.c
@@ -1,22 +1,33 @@
 /* mpz/gcd.c:   Calculate the greatest common divisor of two integers.
 
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002, 2005, 2010 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000-2002, 2005, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index d1a7cece738a936405c4567a7ec4c85f78eefea0..e26d03f64a910b3ed0f44b1c3abb55fc7b54a0d1 100644 (file)
@@ -1,22 +1,32 @@
 /* mpz_gcd_ui -- Calculate the greatest common divisor of two integers.
 
-Copyright 1994, 1996, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
-Foundation, Inc.
+Copyright 1994, 1996, 1999-2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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"
index e284fbd7cd0f5f46ebbd31a62760c291698781f1..01b1f8379aed8291d5830b2f16b36276ec8dda7c 100644 (file)
@@ -1,23 +1,34 @@
 /* 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, 1994, 1995, 1996, 1997, 2000, 2001, 2005, 2011,
-2012 Free Software Foundation, Inc.
+Copyright 1991, 1993-1997, 2000, 2001, 2005, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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"
index 5643e2158f9d70d8d2ea3d51c982bcf51bb54bcf..ac653c5ba0127317256081960dc45743715cb9cb 100644 (file)
@@ -1,21 +1,32 @@
 /* double mpz_get_d (mpz_t src) -- Return the double approximation to SRC.
 
-Copyright 1996, 1997, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 1996, 1997, 2000-2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index b2e2e51ce48fdec15dc351091851ee6622e2cf5b..96314851bf89c63eb34ef2184b2fa0a76a7fd5c7 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2003, 2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index f609d483391b415fc251ed4d28e650c22991e2d7..6e9752636b269fef078585f650fa39015dfe0113 100644 (file)
@@ -1,22 +1,32 @@
 /* mpz_get_si(integer) -- Return the least significant digit from INTEGER.
 
-Copyright 1991, 1993, 1994, 1995, 2000, 2001, 2002, 2006, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993-1995, 2000-2002, 2006, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 70ad589cee4bbf4f884b88e7f30ea12a18a4eb96..08c7cd7371018f04cfc9a3e52ed713f7267298bb 100644 (file)
@@ -4,23 +4,34 @@
    result.  If STRING is not NULL, the caller must ensure enough space is
    available to store the result.
 
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002, 2005, 2012 Free Software
+Copyright 1991, 1993, 1994, 1996, 2000-2002, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+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"
index a94af633030c262fcacffd87ca2f69038bc3f9e4..ca97788b745988ed39884f871663e1c03956bb22 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz_get_ui(integer) -- Return the least significant digit from INTEGER.
 
-Copyright 1991, 1993, 1994, 1995, 2001 Free Software Foundation, Inc.
+Copyright 1991, 1993-1995, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpz_get_ui 1
 
index dc7771e355df8974d9ea67c42113dd86287af7ef..c531f7e61f6eb6e4f3519d223cc7e4479b8711c0 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz_getlimbn(integer,n) -- Return the N:th limb from INTEGER.
 
-Copyright 1993, 1994, 1995, 1996, 2001 Free Software Foundation, Inc.
+Copyright 1993-1996, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpz_getlimbn 1
 
index 5c62e0b40a01a0dbe9a3dd46afaffe6452b1c3bf..146769c39457896bf13111aaf7bbf9a6d15c4e87 100644 (file)
@@ -1,22 +1,32 @@
 /* mpz_hamdist -- calculate hamming distance.
 
-Copyright 1994, 1996, 2001, 2002, 2009, 2010, 2011 Free Software Foundation,
-Inc.
+Copyright 1994, 1996, 2001, 2002, 2009-2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 1585d67e188e95b77b3823e97c6b4a554007f940..9072830afee332fde83f3090b82f42f91731d107 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
@@ -46,8 +57,8 @@ mpz_import (mpz_ptr z, size_t count, int order,
   ASSERT (endian == 1 || endian == 0 || endian == -1);
   ASSERT (nail <= 8*size);
 
-  zsize = (count * (8*size - nail) + GMP_NUMB_BITS-1) / GMP_NUMB_BITS;
-  zp = MPZ_REALLOC (z, zsize);
+  zsize = BITS_TO_LIMBS (count * (8*size - nail));
+  zp = MPZ_NEWALLOC (z, zsize);
 
   if (endian == 0)
     endian = HOST_ENDIAN;
index 1ad55b4c69bc881d986b19bae5ac2c7b097c72b7..09df9df5c8668299befaf70ec0d4ffa04510ff94 100644 (file)
@@ -1,22 +1,32 @@
 /* mpz_init() -- Make a new multiple precision number with value 0.
 
-Copyright 1991, 1993, 1994, 1995, 2000, 2001, 2002, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993-1995, 2000-2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -25,7 +35,7 @@ void
 mpz_init (mpz_ptr x)
 {
   ALLOC (x) = 1;
-  PTR (x) = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
+  PTR (x) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
   SIZ (x) = 0;
 
 #ifdef __CHECKER__
index a516b0a5a71d5da19b901842cefd250b70939475..b942e499d625c937fcdd149f67ce145bed86da3f 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2002, 2008 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
 #include <stdio.h>
index 9ca0e8c4f987f905d733ca2a44ac7b9f4ec028a1..0488edaa44793ccab87d240812fe97d9c3485447 100644 (file)
@@ -5,47 +5,40 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>             /* for NULL */
 #include "gmp.h"
 #include "gmp-impl.h"
 
 void
-#if HAVE_STDARG
 mpz_inits (mpz_ptr x, ...)
-#else
-mpz_inits (va_alist)
-     va_dcl
-#endif
 {
   va_list  ap;
 
-#if HAVE_STDARG
   va_start (ap, x);
-#else
-  mpz_ptr x;
-  va_start (ap);
-  x = va_arg (ap, mpz_ptr);
-#endif
 
   while (x != NULL)
     {
index 0da0c61c0fcada6177ee516a55cab83c2e647d80..d95c19ede725ebb63e84a44c72e1b1f27e64722a 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2002, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
@@ -40,7 +51,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
     mp_limb_t  __limb;                                          \
     int        __i;                                             \
     __limb = 0;                                                 \
-    for (__i = 0; __i < BYTES_PER_MP_LIMB; __i++)               \
+    for (__i = 0; __i < GMP_LIMB_BYTES; __i++)               \
       __limb = (__limb << 8) | __p[__i];                        \
     (limb) = __limb;                                            \
   } while (0)
@@ -82,11 +93,11 @@ mpz_inp_raw (mpz_ptr x, FILE *fp)
   abs_csize = ABS (csize);
 
   /* round up to a multiple of limbs */
-  abs_xsize = (abs_csize*8 + GMP_NUMB_BITS-1) / GMP_NUMB_BITS;
+  abs_xsize = BITS_TO_LIMBS (abs_csize*8);
 
   if (abs_xsize != 0)
     {
-      xp = MPZ_REALLOC (x, abs_xsize);
+      xp = MPZ_NEWALLOC (x, abs_xsize);
 
       /* Get limb boundaries right in the read, for the benefit of the
         non-nails case.  */
index 4f5e46edaa6bdc41be2de43d0868d8c48fa98d69..474bc68435f48043358125804f2f0a5dc530b04d 100644 (file)
@@ -5,23 +5,34 @@
    REST ARE INTERNALS AND ARE ALMOST CERTAIN TO BE SUBJECT TO INCOMPATIBLE
    CHANGES OR DISAPPEAR COMPLETELY IN FUTURE GNU MP RELEASES.
 
-Copyright 1991, 1993, 1994, 1996, 1998, 2000, 2001, 2002, 2003, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1998, 2000-2003, 2011-2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <ctype.h>
@@ -72,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 += 224;
+      digit_value += 208;
       if (base > 62)
        return 0;               /* too large base */
     }
index 18bdff8f8f7b740a2163c474e5721665db7e0460..09cdd9a121a5988d05ef32cdeec22bdba10006cc 100644 (file)
@@ -2,23 +2,33 @@
    If X has an inverse, return non-zero and store inverse in INVERSE,
    otherwise, return 0 and put garbage in INVERSE.
 
-Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2005, 2012 Free Software
-Foundation, Inc.
+Copyright 1996-2001, 2005, 2012, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -33,11 +43,6 @@ mpz_invert (mpz_ptr inverse, mpz_srcptr x, mpz_srcptr n)
   xsize = ABSIZ (x);
   nsize = ABSIZ (n);
 
-  /* No inverse exists if the leftside operand is 0.  Likewise, no
-     inverse exists if the mod operand is 1.  */
-  if (xsize == 0 || (nsize == 1 && (PTR (n))[0] == 1))
-    return 0;
-
   size = MAX (xsize, nsize) + 1;
   TMP_MARK;
 
index 3df0f23e2808e9cb3da9795677483b7620297735..5c181f04c4c78598971122bce10f068b04552d99 100644 (file)
--- a/mpz/ior.c
+++ b/mpz/ior.c
@@ -6,17 +6,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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,10 +58,9 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
            {
              if (ALLOC(res) < op1_size)
                {
-                 _mpz_realloc (res, op1_size);
+                 res_ptr = 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)
@@ -64,10 +74,9 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
            {
              if (ALLOC(res) < op2_size)
                {
-                 _mpz_realloc (res, op2_size);
+                 res_ptr = 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)
@@ -91,7 +100,6 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
       if (op2_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)) =
@@ -120,17 +128,14 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
 
          if (res_size != 0)
            {
-             res_ptr = MPZ_REALLOC (res, res_size + 1);
+             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);
 
-             cy = mpn_add_1 (res_ptr, res_ptr, res_size, (mp_limb_t) 1);
-             if (cy)
-               {
-                 res_ptr[res_size] = cy;
-                 res_size++;
-               }
+             res_ptr[res_size] = 0;
+             MPN_INCR_U (res_ptr, res_size + 1, 1);
+             res_size += res_ptr[res_size];
            }
          else
            {
index 9c8c93462427cbd52e899eab84bcd344c4406019..b6fbf490fdb600880844a3a7a5532f3f2d74a4e6 100644 (file)
@@ -1,23 +1,34 @@
 /* mpz_init_set (src_integer) -- Make a new multiple precision number with
    a value copied from SRC_INTEGER.
 
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000-2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -32,7 +43,7 @@ mpz_init_set (mpz_ptr w, mpz_srcptr u)
   size = ABS (usize);
 
   ALLOC (w) = MAX (size, 1);
-  PTR (w) = (mp_ptr) (*__gmp_allocate_func) (ALLOC (w) * BYTES_PER_MP_LIMB);
+  PTR (w) = (mp_ptr) (*__gmp_allocate_func) ((size_t) ALLOC (w) * GMP_LIMB_BYTES);
 
   wp = PTR (w);
   up = PTR (u);
index 19c245e36f09edebfdf29fd64afc81a26751723b..a450abcb3e8ab5792ba39f7581d58665c9d013ee 100644 (file)
@@ -6,17 +6,28 @@ Copyright 1996, 2000, 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -25,7 +36,7 @@ void
 mpz_init_set_d (mpz_ptr dest, double val)
 {
   ALLOC (dest) = 1;
-  PTR (dest) = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
+  PTR (dest) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
   SIZ (dest) = 0;
   mpz_set_d (dest, val);
 }
index ab53e349d63080345442ff0db8c69d233d172526..107577795a1b0de9cc02daeefeeb41b70946a150 100644 (file)
@@ -1,23 +1,33 @@
 /* mpz_init_set_si(dest,val) -- Make a new multiple precision in DEST and
    assign VAL to the new number.
 
-Copyright 1991, 1993, 1994, 1995, 2000, 2001, 2002, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993-1995, 2000-2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -29,7 +39,7 @@ mpz_init_set_si (mpz_ptr dest, signed long int val)
   mp_limb_t vl;
 
   ALLOC (dest) = 1;
-  PTR (dest) = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
+  PTR (dest) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
 
   vl = (mp_limb_t) ABS_CAST (unsigned long int, val);
 
index 5a0ec7de0f1fda967da827c819d6bfdab52238e6..e31742ce65939cb7b73fa15b4a411cb9aabbf17e 100644 (file)
@@ -1,27 +1,35 @@
-/* mpz_init_set_str(string, base) -- Convert the \0-terminated string
-   STRING in base BASE to a multiple precision integer.  Return a MP_INT
-   structure representing the integer.  Allow white space in the
-   string.  If BASE == 0 determine the base in the C standard way,
-   i.e.  0xhh...h means base 16, 0oo...o means base 8, otherwise
-   assume base 10.
+/* mpz_init_set_str(string, base) -- Convert the \0-terminated string STRING in
+   base BASE to a multiple precision integer.  Allow white space in the string.
+   If BASE == 0 determine the base in the C standard way, i.e.  0xhh...h means
+   base 16, 0oo...o means base 8, otherwise assume base 10.
 
-Copyright 1991, 1993, 1994, 1995, 2000, 2001, 2002, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993-1995, 2000-2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -30,7 +38,7 @@ int
 mpz_init_set_str (mpz_ptr x, const char *str, int base)
 {
   ALLOC (x) = 1;
-  PTR (x) = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
+  PTR (x) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
 
   /* if str has no digits mpz_set_str leaves x->_mp_size unset */
   SIZ (x) = 0;
index 3090f0825b1e0d39e587c6ab4df7a66045370386..0d43c68411c9e6fe0f3d21d8c5ad246096293bc5 100644 (file)
@@ -1,23 +1,33 @@
 /* mpz_init_set_ui(dest,val) -- Make a new multiple precision in DEST and
    assign VAL to the new number.
 
-Copyright 1991, 1993, 1994, 1995, 2000, 2001, 2002, 2004, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993-1995, 2000-2002, 2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -31,7 +41,7 @@ mpz_init_set_ui (mpz_ptr dest, unsigned long int val)
   if (val > GMP_NUMB_MAX)
     {
       ALLOC (dest) = 2;
-      PTR (dest) = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB*2);
+      PTR (dest) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES*2);
       PTR (dest)[1] = val >> GMP_NUMB_BITS;
       size = 2;
     }
@@ -39,7 +49,7 @@ mpz_init_set_ui (mpz_ptr dest, unsigned long int val)
 #endif
     {
       ALLOC (dest) = 1;
-      PTR (dest) = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
+      PTR (dest) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
 
       size = val != 0;
     }
index 0a8fb29d54a8510f900671e82cbcd50b37afbc26..397fe11c9bbc739f41413814be72a124688a907c 100644 (file)
@@ -1,22 +1,32 @@
 /* mpz_jacobi, mpz_legendre, mpz_kronecker -- mpz/mpz Jacobi symbols.
 
-Copyright 2000, 2001, 2002, 2005, 2010, 2011, 2012 Free Software Foundation,
-Inc.
+Copyright 2000-2002, 2005, 2010-2012 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 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.
+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 Lesser General Public License
+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 a copy of the GNU Lesser General Public License along
-with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
index fd9c090957b79bf4d2a3f186d7965c42f9ceee85..12c8fbd0aa18f8f1f7447144985961755aa9c481 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz_si_kronecker -- long+mpz Kronecker/Jacobi symbol.
 
-Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index ece0bfb6e7b21768c40f2a2d591e4cc6dd6b5a97..ca88250de59bc5a38bc155b0eedf76395bfb4743 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz_ui_kronecker -- ulong+mpz Kronecker/Jacobi symbol.
 
-Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index d0f8117e3b2b6883357b4eb2f158bf9daa8aada2..695cd0f283e4dde62795764039ebe5d6154d53b2 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz_kronecker_si -- mpz+long Kronecker/Jacobi symbol.
 
-Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 9b0eb1ed14aa51c2b56c72251c50cc9032af3d81..f57f92e8ba13b8659fc1d2ba612de25cf2b656ee 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz_kronecker_ui -- mpz+ulong Kronecker/Jacobi symbol.
 
-Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index e871ca1fe32b00d7b2508e22256329588aa600ce..805f6710775004b053ac12cfe1f7734bb3be203a 100644 (file)
--- a/mpz/lcm.c
+++ b/mpz/lcm.c
@@ -5,17 +5,28 @@ Copyright 1996, 2000, 2001, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 2249aacf67580d27bf37fca7a880e323899403fe..362d183b428e93f22145cb9122f966ab55c022f5 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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/mpz/limbs_finish.c b/mpz/limbs_finish.c
new file mode 100644 (file)
index 0000000..ebf6dea
--- /dev/null
@@ -0,0 +1,40 @@
+/* mpz_finish_limbs -- Update mpz after writing to the limb array.
+
+Copyright 2013 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.h"
+#include "gmp-impl.h"
+
+void
+mpz_limbs_finish (mpz_ptr x, mp_size_t xs)
+{
+  mp_size_t xn = ABS(xs);
+  MPN_NORMALIZE (PTR (x), xn);
+  SIZ (x) = xs < 0 ? -xn : xn;
+}
diff --git a/mpz/limbs_modify.c b/mpz/limbs_modify.c
new file mode 100644 (file)
index 0000000..bafd7d8
--- /dev/null
@@ -0,0 +1,39 @@
+/* mpz_limbs_modify -- Read-and-modify access to the mpn-style limb array.
+
+Copyright 2013 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.h"
+#include "gmp-impl.h"
+
+mp_ptr
+mpz_limbs_modify (mpz_ptr x, mp_size_t n)
+{
+  ASSERT (n > 0);
+  return MPZ_REALLOC (x, n);
+}
diff --git a/mpz/limbs_read.c b/mpz/limbs_read.c
new file mode 100644 (file)
index 0000000..6c14f18
--- /dev/null
@@ -0,0 +1,38 @@
+/* mpz_limbs_read -- Read access to the mpn-style limb array.
+
+Copyright 2013 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.h"
+#include "gmp-impl.h"
+
+mp_srcptr
+mpz_limbs_read (mpz_srcptr x)
+{
+  return PTR(x);
+}
diff --git a/mpz/limbs_write.c b/mpz/limbs_write.c
new file mode 100644 (file)
index 0000000..605cb5e
--- /dev/null
@@ -0,0 +1,39 @@
+/* mpz_limbs_write -- Write access to the mpn-style limb array.
+
+Copyright 2013 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.h"
+#include "gmp-impl.h"
+
+mp_ptr
+mpz_limbs_write (mpz_ptr x, mp_size_t n)
+{
+  ASSERT (n > 0);
+  return MPZ_NEWALLOC (x, n);
+}
index fa09d5cac0dbb60d2067c7795cc62385e7cba7c7..f8e4fb356f0301527c48a1fea9c3c8b6378cc4d6 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2003, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
index cf0b7c5c67088c35cf78b33d30c3aceb10c2f85d..d1fe6b54cef2a761a24e1d521df8fb56f1a15747 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2003, 2005, 2011, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
index da392ab7f8136fa55a3c0d386b1e4464c6ee61f1..3ea36bce9d22285d2876e759a62eaf1ef0dc77da 100644 (file)
@@ -2,22 +2,33 @@
 
 Contributed to the GNU project by Marco Bodrato.
 
-Copyright 2012 Free Software Foundation, Inc.
+Copyright 2012, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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 +58,7 @@ mpz_mfac_uiui (mpz_ptr x, unsigned long n, unsigned long m)
   ASSERT (n <= GMP_NUMB_MAX);
   ASSERT (m != 0);
 
-  if (n < 3 || n - 3 < m - 1) { /* (n < 3 || n - 1 <= m || m == 0) */
+  if ((n < 3) | (n - 3 < m - 1)) { /* (n < 3 || n - 1 <= m || m == 0) */
     PTR (x)[0] = n + (n == 0);
     SIZ (x) = 1;
   } else { /* m < n - 1 < GMP_NUMB_MAX */
@@ -56,7 +67,7 @@ mpz_mfac_uiui (mpz_ptr x, unsigned long n, unsigned long m)
 
     sn = n;
     g = mpn_gcd_1 (&sn, 1, m);
-    if (g != 1) { n/=g; m/=g; }
+    if (g > 1) { n/=g; m/=g; }
 
     if (m <= 2) { /* fac or 2fac */
       if (m == 1) {
@@ -72,7 +83,7 @@ mpz_mfac_uiui (mpz_ptr x, unsigned long n, unsigned long m)
          return;
        }
       } else { /* m == 2 */
-       if (g != 1) {
+       if (g > 1) {
          mpz_init (t);
          mpz_2fac_ui (t, n);
          sn = n / 2 + 1;
@@ -93,8 +104,12 @@ mpz_mfac_uiui (mpz_ptr x, unsigned long n, unsigned long m)
       n -= m;
       max_prod = GMP_NUMB_MAX / n;
 
-      TMP_MARK;
-      factors = TMP_ALLOC_LIMBS (sn / log_n_max (n) + 2);
+      if (g > 1)
+       factors = MPZ_NEWALLOC (x, sn / log_n_max (n) + 2);
+      else {
+       TMP_MARK;
+       factors = TMP_ALLOC_LIMBS (sn / log_n_max (n) + 2);
+      }
 
       for (; n > m; n -= m)
        FACTOR_LIST_STORE (n, prod, max_prod, factors, j);
@@ -105,13 +120,14 @@ mpz_mfac_uiui (mpz_ptr x, unsigned long n, unsigned long m)
       if (g > 1) {
        mpz_init (t);
        mpz_prodlimbs (t, factors, j);
-      } else
+      } else {
        mpz_prodlimbs (x, factors, j);
-
-      TMP_FREE;
+       TMP_FREE;
+       return;
+      }
     }
 
-    if (g > 1) {
+    {
       mpz_t p;
 
       mpz_init (p);
index bf6a9a649d48e44f77707c984c2a6125c77f0b35..e1ce32c8937f9f0c1db7d081f53a0c5da7455db1 100644 (file)
@@ -9,23 +9,35 @@
    CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
    FUTURE GNU MP RELEASES.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2005 Free
-Software Foundation, Inc.  Contributed by John Amanatides.
+Copyright 1991, 1993, 1994, 1996-2002, 2005 Free Software Foundation, Inc.
+
+Contributed by John Amanatides.
 
 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index cf0fe26d96b47b4ece1703095d69095d74858244..f2de0f978317dd64e2d016a1a0d97e11e4c6857a 100644 (file)
--- a/mpz/mod.c
+++ b/mpz/mod.c
@@ -1,22 +1,33 @@
 /* mpz_mod -- The mathematical mod function.
 
-Copyright 1991, 1993, 1994, 1995, 1996, 2001, 2002, 2005, 2010, 2012
-Free Software Foundation, Inc.
+Copyright 1991, 1993-1996, 2001, 2002, 2005, 2010, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 71c62e06b976fb6e048c82739ed535ddb18bf017..59a279eca6d8d2f3fcc952347f74ad27b950905c 100644 (file)
--- a/mpz/mul.c
+++ b/mpz/mul.c
@@ -6,17 +6,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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"
@@ -99,10 +110,10 @@ mpz_mul (mpz_ptr w, mpz_srcptr u, mpz_srcptr v)
          free_me_size = ALLOC (w);
        }
       else
-       (*__gmp_free_func) (wp, ALLOC (w) * BYTES_PER_MP_LIMB);
+       (*__gmp_free_func) (wp, (size_t) ALLOC (w) * GMP_LIMB_BYTES);
 
       ALLOC (w) = wsize;
-      wp = (mp_ptr) (*__gmp_allocate_func) (wsize * BYTES_PER_MP_LIMB);
+      wp = (mp_ptr) (*__gmp_allocate_func) ((size_t) wsize * GMP_LIMB_BYTES);
       PTR (w) = wp;
     }
   else
@@ -141,6 +152,6 @@ mpz_mul (mpz_ptr w, mpz_srcptr u, mpz_srcptr v)
 
   SIZ (w) = sign_product < 0 ? -wsize : wsize;
   if (free_me != NULL)
-    (*__gmp_free_func) (free_me, free_me_size * BYTES_PER_MP_LIMB);
+    (*__gmp_free_func) (free_me, free_me_size * GMP_LIMB_BYTES);
   TMP_FREE;
 }
index 4e1f4e6bd5769b00ca8d404b746dd08c2083ab21..f02fef7ee2344b4caed17ffd618247cb8074f7dd 100644 (file)
@@ -6,17 +6,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 868c90d035622b870ab478b414142dac59b00801..486a8fd63e6f7ddcec33c61cfeb60f3396f5b163 100644 (file)
@@ -1,23 +1,34 @@
 /* mpz_mul_ui/si (product, multiplier, small_multiplicand) -- Set PRODUCT to
    MULTIPLICATOR times SMALL_MULTIPLICAND.
 
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002, 2005, 2008, 2012
-Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000-2002, 2005, 2008, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 86d5d31a3669a51c8a26aca272ece28b0d4ce7e5..9f29f601e2921c524e8194868c68e6eeb2965053 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 OPERATION_mul_si
index 96303519c92fdae612f7101641639cc36e091467..d398c4f6f1f0cc831bd3c2273afab6f043883747 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 OPERATION_mul_ui
index 1a457b63d66bdd12d2a53ebb9c19f2ee6a39375e..6c3febe23757688076502eb3de7bc36f3496abbe 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2001, 2002, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index caf2df5d4cefad7e6904572d077c54291d2cafbe..eb46ab7f785bff1854ddd74b0407cc610d0245ed 100644 (file)
--- a/mpz/neg.c
+++ b/mpz/neg.c
@@ -1,21 +1,32 @@
 /* mpz_neg(mpz_ptr dst, mpz_ptr src) -- Assign the negated value of SRC to DST.
 
-Copyright 1991, 1993, 1994, 1995, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993-1995, 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpz_neg 1
 
index c1af45ad0b2737f50f29f8318714e5209aa12ee4..1493054695cfb14b07f74c9412c347f6f903f7d5 100644 (file)
@@ -1,23 +1,34 @@
 /* mpz_nextprime(p,t) - compute the next prime > t and store that in p.
 
-Copyright 1999, 2000, 2001, 2008, 2009, 2012 Free Software Foundation, Inc.
+Copyright 1999-2001, 2008, 2009, 2012 Free Software Foundation, Inc.
 
-Contributed to the GNU project by Niels Möller and Torbjorn Granlund.
+Contributed to the GNU project by Niels Möller and Torbjorn Granlund.
 
 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index e1ce119a43440119cb07573ca3c9b917496b5544..cf0bff065057ecfc73b7c57d3bfebce16902e238 100644 (file)
@@ -7,22 +7,33 @@ 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, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2010-2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index ed3330af5b5e665629c36f9262805c2559783f13..3b6b0b7cb5d016befb13f59c58b4720909736181 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
@@ -40,8 +51,8 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
     mp_limb_t  __limb = (limb);                                         \
     char      *__p = (char *) (dst);                                    \
     int        __i;                                                     \
-    for (__i = 0; __i < BYTES_PER_MP_LIMB; __i++)                       \
-      __p[__i] = (char) (__limb >> ((BYTES_PER_MP_LIMB-1 - __i) * 8));  \
+    for (__i = 0; __i < GMP_LIMB_BYTES; __i++)                       \
+      __p[__i] = (char) (__limb >> ((GMP_LIMB_BYTES-1 - __i) * 8));  \
   } while (0)
 #endif
 
@@ -59,10 +70,10 @@ mpz_out_raw (FILE *fp, mpz_srcptr x)
   xsize = SIZ(x);
   abs_xsize = ABS (xsize);
   bytes = (abs_xsize * GMP_NUMB_BITS + 7) / 8;
-  tsize = ROUND_UP_MULTIPLE ((unsigned) 4, BYTES_PER_MP_LIMB) + bytes;
+  tsize = ROUND_UP_MULTIPLE ((unsigned) 4, GMP_LIMB_BYTES) + bytes;
 
   tp = __GMP_ALLOCATE_FUNC_TYPE (tsize, char);
-  bp = tp + ROUND_UP_MULTIPLE ((unsigned) 4, BYTES_PER_MP_LIMB);
+  bp = tp + ROUND_UP_MULTIPLE ((unsigned) 4, GMP_LIMB_BYTES);
 
   if (bytes != 0)
     {
@@ -78,7 +89,7 @@ mpz_out_raw (FILE *fp, mpz_srcptr x)
 #endif
          do
            {
-             bp -= BYTES_PER_MP_LIMB;
+             bp -= GMP_LIMB_BYTES;
              xlimb = *xp;
              HTON_LIMB_STORE ((mp_ptr) bp, xlimb);
              xp++;
index 3fd0666e6d1b036b20c7db28373c789cd24ce81b..6c97039c64b4e741fed23c11bfd85a29306bcd00 100644 (file)
@@ -7,17 +7,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
index 81c8884aa53463f90895f5156821fe147164180b..72ff3c89ac487ba9176d012151d87226ba7744e7 100644 (file)
@@ -1,23 +1,33 @@
 /* mpz_perfect_power_p(arg) -- Return non-zero if ARG is a perfect power,
    zero otherwise.
 
-Copyright 1998, 1999, 2000, 2001, 2005, 2008, 2009 Free Software Foundation,
-Inc.
+Copyright 1998-2001, 2005, 2008, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index b4853b57037164c97f8ca825c958ea4bd525a86a..534f10ff563bf2ab3cc250f4aaf1131380445f58 100644 (file)
@@ -6,17 +6,28 @@ Copyright 1991, 1993, 1994, 1996, 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpz_perfect_square_p 1
 
index c8d9bec1e0a0bf4bccc55dc73bdd8ac362b9f89f..06f0f0b3a26c44e05db38093d27f7c288f0921c0 100644 (file)
@@ -6,17 +6,28 @@ Copyright 1994, 1996, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpz_popcount 1
 
index ae0307d2c25d642b87a12c4bfe62543c86f1dda7..4891e9787742dc185204a15b73db872e65016c3c 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2008 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 6e33da12dc001f9e6b0736e9ee4df82325ec9b2f..4d13da7396f28caf38cf24bffb985cd912415e7b 100644 (file)
@@ -2,23 +2,34 @@
 
    Contributed to the GNU project by Torbjorn Granlund.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2005, 2008,
-2009, 2011, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2005, 2008, 2009, 2011, 2012
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
index 895ca8913fb97bde768cb74730b1ce0e43e97048..98644ca4963dd2c8f4a401c5d88dbfb6fa50ed33 100644 (file)
@@ -2,23 +2,34 @@
 
    Contributed to the GNU project by Torbjorn Granlund.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2005, 2008, 2009,
-2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2005, 2008, 2009, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
@@ -54,19 +65,25 @@ mpz_powm_sec (mpz_ptr r, mpz_srcptr b, mpz_srcptr e, mpz_srcptr m)
        }
       DIVIDE_BY_ZERO;
     }
-
   en = es;
+
   bn = ABSIZ(b);
 
+  if (UNLIKELY (bn == 0))
+    {
+      SIZ(r) = 0;
+      return;
+    }
+
   TMP_MARK;
-  tp = TMP_ALLOC_LIMBS (n + mpn_powm_sec_itch (bn, en, n));
+  tp = TMP_ALLOC_LIMBS (n + mpn_sec_powm_itch (bn, en * GMP_NUMB_BITS, n));
 
   rp = tp;  tp += n;
 
   bp = PTR(b);
   ep = PTR(e);
 
-  mpn_powm_sec (rp, bp, bn, ep, en, mp, n, tp);
+  mpn_sec_powm (rp, bp, bn, ep, en * GMP_NUMB_BITS, mp, n, tp);
 
   rn = n;
 
index b8f81000b9c468375457dea7df62a88a337e897b..46e770ce7ec14fb99316a9d31b53541db416b2eb 100644 (file)
@@ -1,24 +1,35 @@
-/* mpz_powm_ui(res,base,exp,mod) -- Set R to (U^E) mod M.
+/* mpz_powm_ui(res,base,exp,mod) -- Set R to (B^E) mod M.
 
-   Contributed to the GNU project by Torbjorn Granlund.
+   Contributed to the GNU project by Torbjörn Granlund.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2005, 2008, 2009,
-2011, 2012, 2013 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2005, 2008, 2009, 2011-2013
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 #include "gmp.h"
@@ -55,12 +66,18 @@ mod (mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, gmp_pi1_t *dinv, mp_pt
   qp = tp;
 
   if (dn == 1)
-    np[0] = mpn_divrem_1 (qp, (mp_size_t) 0, np, nn, dp[0]);
+    {
+      np[0] = mpn_divrem_1 (qp, (mp_size_t) 0, np, nn, dp[0]);
+    }
   else if (dn == 2)
-    mpn_div_qr_2n_pi1 (qp, np, np, nn, dp[1], dp[0], dinv->inv32);
+    {
+      mpn_div_qr_2n_pi1 (qp, np, np, nn, dp[1], dp[0], dinv->inv32);
+    }
   else if (BELOW_THRESHOLD (dn, DC_DIV_QR_THRESHOLD) ||
           BELOW_THRESHOLD (nn - dn, DC_DIV_QR_THRESHOLD))
-    mpn_sbpi1_div_qr (qp, np, nn, dp, dn, dinv->inv32);
+    {
+      mpn_sbpi1_div_qr (qp, np, nn, dp, dn, dinv->inv32);
+    }
   else if (BELOW_THRESHOLD (dn, MUPI_DIV_QR_THRESHOLD) ||   /* fast condition */
           BELOW_THRESHOLD (nn, 2 * MU_DIV_QR_THRESHOLD) || /* fast condition */
           (double) (2 * (MU_DIV_QR_THRESHOLD - MUPI_DIV_QR_THRESHOLD)) * dn /* slow... */
@@ -73,9 +90,9 @@ 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_ALLOC_LIMBS (dn);
+      mp_ptr rp = TMP_BALLOC_LIMBS (dn);
       mp_size_t itch = mpn_mu_div_qr_itch (nn, dn, 0);
-      mp_ptr scratch = TMP_ALLOC_LIMBS (itch);
+      mp_ptr scratch = TMP_BALLOC_LIMBS (itch);
       mpn_mu_div_qr (qp, rp, np, nn, dp, dn, scratch);
       MPN_COPY (np, rp, dn);
     }
index 8a642df00b3c0c4878cadef97046fc2f467e1a81..f3d38a08210ebb09a7df61a079965b7def4a7576 100644 (file)
@@ -6,23 +6,33 @@
    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, 1997, 1998, 1999, 2000, 2001, 2002, 2005 Free
-Software Foundation, Inc.  Miller-Rabin code contributed by John Amanatides.
+Copyright 1991, 1993, 1994, 1996-2002, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 13c562f675bd105e0ed0123ffe457c6b24f24c60..f322edf549935480431c2de89b471b1253497336 100644 (file)
@@ -7,17 +7,28 @@ Copyright 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -116,7 +127,7 @@ mpz_primorial_ui (mpz_ptr x, unsigned long n)
 
       size = 1 + n / GMP_NUMB_BITS + n / (2*GMP_NUMB_BITS);
       ASSERT (size >= primesieve_size (n));
-      sieve = MPZ_REALLOC (x, size);
+      sieve = MPZ_NEWALLOC (x, size);
       size = (gmp_primesieve (sieve, n) + 1) / log_n_max (n) + 1;
 
       TMP_MARK;
@@ -137,7 +148,7 @@ mpz_primorial_ui (mpz_ptr x, unsigned long n)
        LOOP_ON_SIEVE_END;
       }
 
-      if (j != 0)
+      if (LIKELY (j != 0))
        {
          factors[j++] = prod;
          mpz_prodlimbs (x, factors, j);
index 8676887550944ae5df81f5130c456f8aaf14a759..8d84bcb4353afa42bf9ae40d08bad0605a4dabf4 100644 (file)
@@ -1,4 +1,4 @@
-/* mpz_prodlimps(RESULT, V, LEN) -- Set RESULT to V[0]*V[1]*...*V[LEN-1].
+/* mpz_prodlimbs(RESULT, V, LEN) -- Set RESULT to V[0]*V[1]*...*V[LEN-1].
 
 Contributed to the GNU project by Marco Bodrato.
 
@@ -7,22 +7,33 @@ 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, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2010-2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -38,7 +49,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 /* Computes the product of the j>1 limbs pointed by factors, puts the
  * result in x. It assumes that all limbs are non-zero. Above
- * Karatsuba's threshold it uses a binary splitting startegy, to gain
+ * Karatsuba's threshold it uses a binary splitting strategy, to gain
  * speed by the asymptotically fast multiplication algorithms.
  *
  * The list in  {factors, j} is overwritten.
index 8bf2a369fa59b8a8e4b49fcbffb43d75530c275c..1dca3a93cddbf478d9758d8d7dc117e0c987938c 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index cc4cfef3126f6b1249fe1070518f7632784c70f4..7f9e5f28e8b3daeb2ff5d3c173134e7f406cdec9 100644 (file)
@@ -7,17 +7,28 @@ Copyright 1991, 1993, 1994, 1996, 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 0a6d1638a50cc15769dc153df3a781d0429be18f..3d2755ca0a1c8a2c1cf858d04d0c1b29c283e460 100644 (file)
@@ -1,22 +1,32 @@
 /* _mpz_realloc -- make the mpz_t have NEW_ALLOC digits allocated.
 
-Copyright 1991, 1993, 1994, 1995, 2000, 2001, 2008 Free Software Foundation,
-Inc.
+Copyright 1991, 1993-1995, 2000, 2001, 2008 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
 #include <stdio.h>
index 84295f6c57d2cd441fbb5ee1b60471572fde7384..3ccfaab1f066154a186621fa606998a3aa9da891 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 2002, 2008 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
 #include <stdio.h>
index 52afdec8252f456b84230d3501243f3711d84359..3d293587383112bde2edadf2953d3106390888a2 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz_remove -- divide out a factor and return its multiplicity.
 
-Copyright 1998, 1999, 2000, 2001, 2002, 2012 Free Software Foundation, Inc.
+Copyright 1998-2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -65,49 +76,68 @@ mpz_remove (mpz_ptr dest, mpz_srcptr src, mpz_srcptr f)
     }
   else
     { /* f != +-2 */
-      mpz_t fpow[GMP_LIMB_BITS];               /* Really MP_SIZE_T_BITS */
       mpz_t x, rem;
-      int p;
-
-      /* We could perhaps compute mpz_scan1(src,0)/mpz_scan1(f,0).  It is an
-        upper bound of the result we're seeking.  We could also shift down the
-        operands so that they become odd, to make intermediate values
-        smaller.  */
 
       mpz_init (rem);
       mpz_init (x);
 
       pwr = 0;
-      mpz_init_set (fpow[0], f);
-      mpz_set (dest, src);
-
-      /* Divide by f, f^2 ... f^(2^k) until we get a remainder for f^(2^k).  */
-      for (p = 0;; p++)
+      mpz_tdiv_qr (x, rem, src, f);
+      if (SIZ (rem) == 0)
        {
-         mpz_tdiv_qr (x, rem, dest, fpow[p]);
-         if (SIZ (rem) != 0)
-           break;
-         mpz_init (fpow[p + 1]);
-         mpz_mul (fpow[p + 1], fpow[p], fpow[p]);
-         mpz_set (dest, x);
-       }
+         mpz_t fpow[GMP_LIMB_BITS];            /* Really MP_SIZE_T_BITS */
+         int p;
 
-      pwr = ((mp_bitcnt_t)1 << p) - 1;
+#if WANT_ORIGINAL_DEST
+         mp_ptr dp;
+         dp = PTR (dest);
+#endif
+      /* We could perhaps compute mpz_scan1(src,0)/mpz_scan1(f,0).  It is an
+        upper bound of the result we're seeking.  We could also shift down the
+        operands so that they become odd, to make intermediate values
+        smaller.  */
+         mpz_init_set (fpow[0], f);
+         mpz_swap (dest, x);
 
-      mpz_clear (fpow[p]);
+         p = 1;
+      /* Divide by f, f^2 ... f^(2^k) until we get a remainder for f^(2^k).  */
+         while (ABSIZ (dest) >= 2 * ABSIZ (fpow[p - 1]) - 1)
+           {
+             mpz_init (fpow[p]);
+             mpz_mul (fpow[p], fpow[p - 1], fpow[p - 1]);
+             mpz_tdiv_qr (x, rem, dest, fpow[p]);
+             if (SIZ (rem) != 0) {
+               mpz_clear (fpow[p]);
+               break;
+             }
+             mpz_swap (dest, x);
+             p++;
+           }
+
+         pwr = ((mp_bitcnt_t)1 << p) - 1;
 
       /* Divide by f^(2^(k-1)), f^(2^(k-2)), ..., f for all divisors that give
         a zero remainder.  */
-      while (--p >= 0)
-       {
-         mpz_tdiv_qr (x, rem, dest, fpow[p]);
-         if (SIZ (rem) == 0)
+         while (--p >= 0)
            {
-             pwr += (mp_bitcnt_t)1 << p;
-             mpz_set (dest, x);
+             mpz_tdiv_qr (x, rem, dest, fpow[p]);
+             if (SIZ (rem) == 0)
+               {
+                 pwr += (mp_bitcnt_t)1 << p;
+                 mpz_swap (dest, x);
+               }
+             mpz_clear (fpow[p]);
            }
-         mpz_clear (fpow[p]);
+
+#if WANT_ORIGINAL_DEST
+         if (PTR (x) == dp) {
+           mpz_swap (dest, x);
+           mpz_set (dest, x);
+         }
+#endif
        }
+      else
+       mpz_set (dest, src);
 
       mpz_clear (x);
       mpz_clear (rem);
diff --git a/mpz/roinit_n.c b/mpz/roinit_n.c
new file mode 100644 (file)
index 0000000..137dbda
--- /dev/null
@@ -0,0 +1,44 @@
+/* mpz_roinit_n -- Initialize mpz with read-only limb array.
+
+Copyright 2013 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.h"
+#include "gmp-impl.h"
+
+mpz_srcptr
+mpz_roinit_n (mpz_ptr x, mp_srcptr xp, mp_size_t xs)
+{
+  mp_size_t xn = ABS(xs);
+  MPN_NORMALIZE (xp, xn);
+
+  ALLOC (x) = 0;
+  SIZ (x) = xs < 0 ? -xn : xn;
+  PTR (x) = (mp_ptr) xp;
+  return x;
+}
index 90c228f8825f54d8c5e5359c7a48e8024ed71549..31eb440b4f2aee0fdf7800c104be5e151dcfe2ad 100644 (file)
@@ -1,22 +1,33 @@
 /* mpz_root(root, u, nth) --  Set ROOT to floor(U^(1/nth)).
    Return an indication if the result is exact.
 
-Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2012 Free Software Foundation, Inc.
+Copyright 1999-2003, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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"
index 267fb33277cc9af1ec1c667f4fe417b7fb57e787..ac4a1e030af80ecffe505793f8fe258839a0680f 100644 (file)
@@ -1,22 +1,33 @@
 /* mpz_rootrem(root, rem, u, nth) --  Set ROOT to trunc(U^(1/nth)) and
    set REM to the remainder.
 
-Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2012 Free Software Foundation, Inc.
+Copyright 1999-2003, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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"
index 3e06e2c70c649ed0e7db48154d4d0cd91aa51131..8b1803c6baae9850324c3eb4eb3a68cbb3cb26af 100644 (file)
@@ -2,22 +2,33 @@
    long runs of consecutive ones and zeros in the binary representation.
    Meant for testing of other MP routines.
 
-Copyright 2000, 2001, 2002, 2004, 2012 Free Software Foundation, Inc.
+Copyright 2000-2002, 2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -30,10 +41,10 @@ mpz_rrandomb (mpz_ptr x, gmp_randstate_t rstate, mp_bitcnt_t nbits)
   mp_size_t nl;
   mp_ptr xp;
 
-  nl = (nbits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
+  nl = BITS_TO_LIMBS (nbits);
   if (nbits != 0)
     {
-      xp = MPZ_REALLOC (x, nl);
+      xp = MPZ_NEWALLOC (x, nl);
       gmp_rrandomb (xp, rstate, nbits);
     }
 
@@ -58,7 +69,7 @@ gmp_rrandomb (mp_ptr rp, gmp_randstate_t rstate, mp_bitcnt_t nbits)
   mp_size_t i;
 
   /* Set entire result to 111..1  */
-  i = (nbits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS - 1;
+  i = BITS_TO_LIMBS (nbits) - 1;
   rp[i] = GMP_NUMB_MAX >> (GMP_NUMB_BITS - (nbits % GMP_NUMB_BITS)) % GMP_NUMB_BITS;
   for (i = i - 1; i >= 0; i--)
     rp[i] = GMP_NUMB_MAX;
index ac081a6a2074f3367f4d205e8fd927698ae1000d..de24595cfe916013922db567b10e6c07ab6a92af 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz_scan0 -- search for a 0 bit.
 
-Copyright 2000, 2001, 2002, 2004, 2012 Free Software Foundation, Inc.
+Copyright 2000-2002, 2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index e9bfacaa07a1a23f90994cde8075baf3ebb484ca..c9309de6913233ec8f07e8e417a38ab1a2212e34 100644 (file)
@@ -1,21 +1,32 @@
 /* mpz_scan1 -- search for a 1 bit.
 
-Copyright 2000, 2001, 2002, 2004, 2012 Free Software Foundation, Inc.
+Copyright 2000-2002, 2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 20140609f67bec7fbfcaab7b510e7574ae5d52d6..9d7d58c8d03c4bb78fc1367a6be69f2daa2a091d 100644 (file)
--- a/mpz/set.c
+++ b/mpz/set.c
@@ -1,21 +1,32 @@
 /* mpz_set (dest_integer, src_integer) -- Assign DEST_INTEGER from SRC_INTEGER.
 
-Copyright 1991, 1993, 1994, 1995, 2000, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993-1995, 2000, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index b5f3b9385ce2e3f50cf40df85c3cb1aa38cb273f..d40ee726d236d5fcd8142358c33340d603602524 100644 (file)
@@ -1,22 +1,32 @@
 /* mpz_set_d(integer, val) -- Assign INTEGER with a double value VAL.
 
-Copyright 1995, 1996, 2000, 2001, 2002, 2003, 2006 Free Software Foundation,
-Inc.
+Copyright 1995, 1996, 2000-2003, 2006 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 3ea14e31269f3ca872cdc81bf43c6f02520fddbe..4eb98198371e450dfd7bf8faf7fa3c88e0e4387c 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1996, 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -52,7 +63,7 @@ mpz_set_f (mpz_ptr w, mpf_srcptr u)
     }
   else
     {
-      /* exp<=size, trucate to the high "exp" many limbs */
+      /* exp<=size, truncate to the high "exp" many limbs */
       up += (size - exp);
       size = exp;
     }
index 13e59ae44ad9002254780cb07d638c4440a7c5b1..2627e8229805a06315ef17e25c38ec45ca59fa1e 100644 (file)
@@ -6,17 +6,28 @@ Copyright 1996, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpz_set_q 1
 
index 7dcc5b93dd4219cab6c77a292453b1710377aa43..1370368332e24920803810554c491e98da92e9b2 100644 (file)
@@ -1,22 +1,32 @@
 /* mpz_set_si(dest,val) -- Assign DEST with a small value VAL.
 
-Copyright 1991, 1993, 1994, 1995, 2000, 2001, 2002, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993-1995, 2000-2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index f7ccd775ff9788e7f15e467df74d7a2dc8a43674..848d2136a0a6babe5a7011b1702fe385143232d0 100644 (file)
@@ -4,23 +4,34 @@
    the base in the C standard way, i.e.  0xhh...h means base 16,
    0oo...o means base 8, otherwise assume base 10.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005,
-2011, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996-1998, 2000-2003, 2005, 2011-2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include <string.h>
 #include <ctype.h>
@@ -47,7 +58,7 @@ mpz_set_str (mpz_ptr x, const char *str, int base)
     {
       /* For bases > 36, use the collating sequence
         0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.  */
-      digit_value += 224;
+      digit_value += 208;
       if (base > 62)
        return -1;              /* too large base */
     }
index 3c1931176b3a53f8f07bf29cb640968d7a05dddf..f36754cd59bcf618f4b87daa7c1cd6ea2832b4a1 100644 (file)
@@ -1,22 +1,33 @@
 /* mpz_set_ui(integer, val) -- Assign INTEGER with a small value VAL.
 
-Copyright 1991, 1993, 1994, 1995, 2001, 2002, 2004, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993-1995, 2001, 2002, 2004, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 63c86da6f0b0abfdeb3b821d04232472882349a0..3c2c139f987a24e3f8ae9f7f45ff11e728483e08 100644 (file)
@@ -1,22 +1,33 @@
 /* mpz_setbit -- set a specified bit.
 
-Copyright 1991, 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2012 Free Software
+Copyright 1991, 1993-1995, 1997, 1999, 2001, 2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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,8 +60,6 @@ mpz_setbit (mpz_ptr d, mp_bitcnt_t bit_idx)
     }
   else
     {
-      mp_size_t zero_bound;
-
       /* Simulate two's complement arithmetic, i.e. simulate
         1. Set OP = ~(OP - 1) [with infinitely many leading ones].
         2. Set the bit.
@@ -58,40 +67,39 @@ mpz_setbit (mpz_ptr d, mp_bitcnt_t bit_idx)
 
       dsize = -dsize;
 
-      /* No index upper bound on this loop, we're sure there's a non-zero limb
-        sooner or later.  */
-      zero_bound = 0;
-      while (dp[zero_bound] == 0)
-       zero_bound++;
-
-      if (limb_idx > zero_bound)
+      if (limb_idx < dsize)
        {
-         if (limb_idx < dsize)
+         mp_size_t zero_bound;
+         /* No index upper bound on this loop, we're sure there's a non-zero limb
+            sooner or later.  */
+         zero_bound = 0;
+         while (dp[zero_bound] == 0)
+           zero_bound++;
+
+         if (limb_idx > zero_bound)
            {
              mp_limb_t  dlimb;
              dlimb = dp[limb_idx] & ~mask;
              dp[limb_idx] = dlimb;
 
-             if (UNLIKELY (dlimb == 0 && limb_idx == dsize-1))
+             if (UNLIKELY ((dlimb == 0) + limb_idx == dsize)) /* dsize == limb_idx + 1 */
                {
                  /* high limb became zero, must normalize */
-                 do {
-                   dsize--;
-                 } while (dsize > 0 && dp[dsize-1] == 0);
-                 SIZ (d) = -dsize;
+                 MPN_NORMALIZE (dp, limb_idx);
+                 SIZ (d) = -limb_idx;
                }
            }
-       }
-      else if (limb_idx == zero_bound)
-       {
-         dp[limb_idx] = ((dp[limb_idx] - 1) & ~mask) + 1;
-         ASSERT (dp[limb_idx] != 0);
-       }
-      else
-       {
-         MPN_DECR_U (dp + limb_idx, dsize - limb_idx, mask);
-         dsize -= dp[dsize - 1] == 0;
-         SIZ (d) = -dsize;
+         else if (limb_idx == zero_bound)
+           {
+             dp[limb_idx] = ((dp[limb_idx] - 1) & ~mask) + 1;
+             ASSERT (dp[limb_idx] != 0);
+           }
+         else
+           {
+             MPN_DECR_U (dp + limb_idx, dsize - limb_idx, mask);
+             dsize -= dp[dsize - 1] == 0;
+             SIZ (d) = -dsize;
+           }
        }
     }
 }
index b310228e9dd67124c0663fd7d1d1c54fd91a982d..2b324c342301216fa0ca417e6701e15b76c0bee0 100644 (file)
@@ -1,22 +1,33 @@
 /* mpz_size(x) -- return the number of lims currently used by the
    value of integer X.
 
-Copyright 1991, 1993, 1994, 1995, 2001 Free Software Foundation, Inc.
+Copyright 1991, 1993-1995, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_FORCE_mpz_size 1
 
index d70e87832c80b5887a299aea044ba1bfbcb4137b..0f3851ea861f87a20978002fbff3550723e785af 100644 (file)
@@ -2,22 +2,33 @@
    character the integer X would have printed in base BASE.  The
    approximation is never too small.
 
-Copyright 1991, 1993, 1994, 1995, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1991, 1993-1995, 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 9a4f8cbc150161e06748baf0f1a25e9132e14a24..d906cfd59e89d72cd15107cd1bde23fe31bf68c8 100644 (file)
@@ -6,17 +6,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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"
index 76abdc0c29de41a1afd3afc947820eccddcab264..99685354d6e989192e6ac9dd0abd920a039c410a 100644 (file)
@@ -7,17 +7,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 1b7ac49fd230bff53bdb6c3e120926d97898eda0..7cb022e069272d783aeb569d1048b0ebd1a7ef20 100644 (file)
--- a/mpz/sub.c
+++ b/mpz/sub.c
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 OPERATION_sub
index d0fe3698c5b67edfdc89d490b23399312d762a6d..3ce23d3555f6468ca8fd910f20106896a1e5ddb8 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 OPERATION_sub_ui
index 73348fe16d029f5e0c19e4631128c0487b210501..0fc11fb9e1a488b2e151f9a527de4c9cff31b398 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1997, 1998, 2001, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 6c6b65c8529883089747e98850a69f222c032ca1..38528f35bfb9761556725d51b1ae6850dc02aa55 100644 (file)
@@ -6,17 +6,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 88c4deda503b8e1216d1fe78dab18ea8547bab60..9ffcaf2bbbe37df125d483593e4349bc9d64688b 100644 (file)
@@ -7,17 +7,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 6d287943dc2832c025a240f4f917076f88b75c5f..88e90825290a430fa14bcee13efecb44aff27c4b 100644 (file)
@@ -7,17 +7,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index cfbc7d9bf21ac1326d4a255372f797bd50777b7a..ab9a37dae9c47b19640488aa844bbffccac97755 100644 (file)
@@ -7,17 +7,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 361e5a485c51d0e1929aea44b48aab8d7fedab91..4f667abe07d9320649f7babc3a201cb37a861bcb 100644 (file)
@@ -8,17 +8,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 13de14b1a829e46c3b13d6f4213361ab38a0c7db..d9cb38c3232f7b748fe83a219fd2a18f7663a13a 100644 (file)
@@ -6,17 +6,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 5ed9de8931241769902fda54ba73bf67f57fa989..e21d90fecd5af36a7c2b48b6e2e85a2612a69deb 100644 (file)
@@ -1,22 +1,32 @@
 /* mpz_tdiv_r_2exp -- Divide an integer by 2**CNT and produce a remainder.
 
-Copyright 1991, 1993, 1994, 1995, 2001, 2002, 2012 Free Software Foundation,
-Inc.
+Copyright 1991, 1993-1995, 2001, 2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index a206811bf65b1af37bf2c74924ea50c8d6792d07..30addd6db7986cefc597d955ab033d5c619ed5bc 100644 (file)
@@ -7,17 +7,28 @@ 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 6d834fc4e57b0f968511414074a69bffa02530fc..328d67fdf88cda8b97d48996ff1362371da259e0 100644 (file)
@@ -1,22 +1,33 @@
 /* mpz_tdiv_ui(dividend, divisor_limb) -- Return DIVDEND mod DIVISOR_LIMB.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 1998, 2001, 2002, 2004, 2005, 2012
-Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996-1998, 2001, 2002, 2004, 2005, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 595a7b72114cc0b06d309570f53366aa0b94345c..db3d75a64f985c5354144c11bc738c95d65b4546 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2000, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 4a0f7bd58fbfd917a10e24df3e34cb44db6a9397..a4f23c565556970cac42c103d2c3f4eee7a939d3 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 76d4b823087b5f03042a9d242d9624d82d43914d..579a30079541e90d95482d3ea6abb4a52afe922b 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index fc7ec55cec47e5188c027e7d02e958242943f3b8..f1295699b3fcb7eab133c4637005cb6ac1eb5208 100644 (file)
@@ -7,17 +7,28 @@ Copyright 1999, 2000, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -29,7 +40,7 @@ mpz_urandomb (mpz_ptr rop, gmp_randstate_t rstate, mp_bitcnt_t nbits)
   mp_size_t size;
 
   size = BITS_TO_LIMBS (nbits);
-  rp = MPZ_REALLOC (rop, size);
+  rp = MPZ_NEWALLOC (rop, size);
 
   _gmp_rand (rp, rstate, nbits);
   MPN_NORMALIZE (rp, size);
index 6bf74603e9fb831462ca7776a5b022ca71e2b978..434359cdd766f140a6ddb44c631d644878e7f746 100644 (file)
@@ -7,17 +7,28 @@ Copyright 2000, 2002, 2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 66ff1c0fb4f679d37910873e58f1d280f897120d..cd701000d56143778dbf746fb886ae021478f647 100644 (file)
--- a/mpz/xor.c
+++ b/mpz/xor.c
@@ -1,22 +1,33 @@
 /* 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 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index f0b01d625d3cf0b98ba8473ad9641c17d7dc96fa..dd9ded58739cc45097e1e15bfdcee9031ea18161 100644 (file)
@@ -13,17 +13,28 @@ Copyright 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /*
   Optimisation ideas:
index d1bf5a1617f521c518b583d4e95d1c5a2e13509b..569e4cecea9183790b19060f9ff352fbd193b4c8 100644 (file)
@@ -7,22 +7,33 @@ 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, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2010-2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index c4aead79beaf50cbc2168ba16af596fa33a1d897..c8e3c78c6c80ea69ee2c360aca7b4d9a0274ea15 100644 (file)
@@ -2,20 +2,31 @@
 
 # Copyright 2001, 2002 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
index 9702b8073b338a9771bb711c71ee10a797e98ccf..ff4bdfb37c130e4fd25a25616b70b824ed5a71f3 100644 (file)
 
 # Copyright 2001, 2002 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 VPATH = @srcdir@
 am__make_dryrun = \
index e2edef6ee418105e8438831a6005a2e08012c09a..b35d9b10c82d7dfa23adc5651f8d90f44dfacf53 100644 (file)
@@ -5,50 +5,42 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
 
 #include "gmp.h"
 #include "gmp-impl.h"
 
 
 int
-#if HAVE_STDARG
 gmp_asprintf (char **result, const char *fmt, ...)
-#else
-gmp_asprintf (va_alist)
-     va_dcl
-#endif
 {
   va_list  ap;
   int      ret;
 
-#if HAVE_STDARG
   va_start (ap, fmt);
-#else
-  char       **result;
-  const char *fmt;
-  va_start (ap);
-  result = va_arg (ap, char **);
-  fmt = va_arg (ap, const char *);
-#endif
 
   ret = gmp_vasprintf (result, fmt, ap);
   va_end (ap);
index 1a2b9e1e14b872a6bde7e1fc17c9b5bfdc025876..c141b7a99e0551e36a6bfa5d8d952af7bd13b2fb 100644 (file)
@@ -5,31 +5,35 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /* These routines are in a separate file so that the mpz_t, mpq_t and mpf_t
    operator<< routines can avoid dragging vsnprintf into the link (via
    __gmp_asprintf_format).  */
 
-#include "config.h"
-
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index c1ee0a2ae20e1b34deb38baeff57010d0d47e25a..5220feee206601ed31d282bac53472682f00da10 100644 (file)
@@ -4,33 +4,39 @@
    CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
    FUTURE GNU MP RELEASES.
 
-Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2001-2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 _GNU_SOURCE    /* for DECIMAL_POINT in glibc langinfo.h */
 
-#include "config.h"
+#include "config.h"    /* needed for the HAVE_, could also move gmp incls */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <ctype.h>     /* for isdigit */
 #include <stddef.h>    /* for ptrdiff_t */
 #include <string.h>
@@ -94,7 +100,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
    In GMP 4.1.1 we documented "ll" and "L" as being equivalent, but in C99
    in fact "ll" is just for long long and "L" just for long double.
-   Apparentely GLIBC allows "L" for long long though.  This doesn't affect
+   Apparently GLIBC allows "L" for long long though.  This doesn't affect
    us as such, since both are passed through to the C library.  To be
    consistent with what we said before, the two are treated equivalently
    here, and it's left to the C library to do what it thinks with them.
@@ -182,7 +188,7 @@ __gmp_doprnt (const struct doprnt_funs_t *funs, void *data,
 #endif
   alloc_fmt = __GMP_ALLOCATE_FUNC_TYPE (alloc_fmt_size, char);
   fmt = alloc_fmt;
-  strcpy (fmt, orig_fmt);
+  memcpy (fmt, orig_fmt, alloc_fmt_size);
 
   /* last_fmt and last_ap are just after the last output, and hence where
      the next output will begin, when that's done */
index 49e701304d20e0e03429478a8fe10b4283bbb56e..c501e8d06b2fe00bfbf19cb524ee4208336a738b 100644 (file)
@@ -9,26 +9,30 @@ Copyright 2001, 2002, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#include "config.h"
-
-#if HAVE_STDARG
 #include <stdarg.h>    /* for va_list and hence doprnt_funs_t */
-#else
-#include <varargs.h>
-#endif
-
 #include <ctype.h>
 #include <string.h>
 #include <stdio.h>
index df474df3e2bf0658b26663d8d198a5661aa3cb1c..c4cb9c8da8deb4ba3f798fee6459bb14df351b03 100644 (file)
@@ -9,26 +9,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>    /* for va_list and hence doprnt_funs_t */
-#else
-#include <varargs.h>
-#endif
-
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
index dba30b90fc34ac99b4bcad30d3c05d9baa8cfe5b..2d8187d7cfc7ee45b833a1d92d079196259f7261 100644 (file)
@@ -5,26 +5,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>
 
 #include "gmp.h"
@@ -32,25 +36,12 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
 int
-#if HAVE_STDARG
 gmp_fprintf (FILE *fp, const char *fmt, ...)
-#else
-gmp_fprintf (va_alist)
-     va_dcl
-#endif
 {
   va_list  ap;
   int      ret;
 
-#if HAVE_STDARG
   va_start (ap, fmt);
-#else
-  FILE       *fp;
-  const char *fmt;
-  va_start (ap);
-  fp = va_arg (ap, FILE *);
-  fmt = va_arg (ap, const char *);
-#endif
 
   ret = __gmp_doprnt (&__gmp_fprintf_funs, fp, fmt, ap);
   va_end (ap);
index 51ad703b387af4e290dd500b965f4a2c6cdfd496..fbf3ea768f7d8c49af0a6169631c84cf949bb2fe 100644 (file)
@@ -5,28 +5,34 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
 #if HAVE_OBSTACK_VPRINTF
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <obstack.h>
 #include <string.h>
 
@@ -35,25 +41,12 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
 int
-#if HAVE_STDARG
 gmp_obstack_printf (struct obstack *ob, const char *fmt, ...)
-#else
-gmp_obstack_printf (va_alist)
-     va_dcl
-#endif
 {
   va_list  ap;
   int      ret;
 
-#if HAVE_STDARG
   va_start (ap, fmt);
-#else
-  struct obstack *ob;
-  const char     *fmt;
-  va_start (ap);
-  ob = va_arg (ap, struct obstack *);
-  fmt = va_arg (ap, const char *);
-#endif
 
   ASSERT (! MEM_OVERLAP_P (obstack_base(ob), obstack_object_size(ob),
                            fmt, strlen(fmt)+1));
index 092e6cca21ba6887a7c3963648192f187be25240..4cd1a91dec5251d9d745476dee1e43c7d0672a51 100644 (file)
@@ -10,17 +10,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
@@ -28,12 +39,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 #define _GNU_SOURCE   /* ask glibc <stdio.h> for obstack_vprintf */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>    /* for obstack_vprintf */
 #include <string.h>
 #include <obstack.h>
index 4e3712f24729384c2f841e403e734f2a8fc96ca7..31eddbdf2a673aeb6ad63632b36782755dd26975 100644 (file)
@@ -5,28 +5,34 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
 #if HAVE_OBSTACK_VPRINTF
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <obstack.h>
 #include <string.h>
 
index bcb0acbb86b007b6cf5796efd81b276399a3b502..7ac7b62faea61fcc28ca595695719b03afd1ca86 100644 (file)
@@ -5,26 +5,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>
 
 #include "gmp.h"
@@ -32,23 +36,12 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
 int
-#if HAVE_STDARG
 gmp_printf (const char *fmt, ...)
-#else
-gmp_printf (va_alist)
-     va_dcl
-#endif
 {
   va_list  ap;
   int      ret;
 
-#if HAVE_STDARG
   va_start (ap, fmt);
-#else
-  const char *fmt;
-  va_start (ap);
-  fmt = va_arg (ap, const char *);
-#endif
 
   ret = __gmp_doprnt (&__gmp_fprintf_funs, stdout, fmt, ap);
   va_end (ap);
index 89c9589fce51a837b10f80ace80a980732653496..058c6b9d8bc237676785480ed33852b01572566a 100644 (file)
@@ -9,26 +9,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#include "config.h"
-
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>
 #include <string.h>
 
index 06809dcb82d9aaf4b7901edaffca4bcb19d87f61..a95003baa62e0d2b65d3e1d9dc9e4f15a2d74433 100644 (file)
@@ -10,17 +10,28 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
@@ -29,12 +40,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 #define _GNU_SOURCE    /* for strnlen prototype */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <ctype.h>     /* for isdigit */
 #include <stddef.h>    /* for ptrdiff_t */
 #include <string.h>
@@ -266,6 +272,7 @@ __gmp_replacement_vsnprintf (char *buf, size_t buf_size,
          case 'L':  /* long long or long double */
          case 'q':  /* quad_t */
          case 't':  /* ptrdiff_t */
+         case 'z':  /* size_t */
          set_type:
            type = fchar;
            break;
index 88afc32b8f114d4db84b258efe766933be1878a5..fde5c806ebefd347c7907a6061c8dffa1b598a51 100644 (file)
@@ -5,26 +5,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#include "config.h"
-
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <string.h>    /* for strlen */
 
 #include "gmp.h"
@@ -32,30 +36,16 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
 int
-#if HAVE_STDARG
 gmp_snprintf (char *buf, size_t size, const char *fmt, ...)
-#else
-gmp_snprintf (va_alist)
-     va_dcl
-#endif
 {
   struct gmp_snprintf_t d;
   va_list  ap;
   int      ret;
 
-#if HAVE_STDARG
   va_start (ap, fmt);
   d.buf = buf;
   d.size = size;
 
-#else
-  const char *fmt;
-  va_start (ap);
-  d.buf = va_arg (ap, char *);
-  d.size = va_arg (ap, size_t);
-  fmt = va_arg (ap, const char *);
-#endif
-
   ASSERT (! MEM_OVERLAP_P (buf, size, fmt, strlen(fmt)+1));
 
   ret = __gmp_doprnt (&__gmp_snprintf_funs, &d, fmt, ap);
index 340ee051a71179751d332634fd8bc802a480e17a..41a7670c6da21d965501f13564c367850dff3f39 100644 (file)
@@ -9,26 +9,30 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#include "config.h"
-
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>
 #include <string.h>
 
index 0a3294d8ea101bba2d385b4e73413e879ffcca96..052a2655c9ed08c9b4f2dd75fd492ac24c359e46 100644 (file)
@@ -5,26 +5,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <string.h>    /* for strlen */
 
 #include "gmp.h"
@@ -32,12 +36,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
 int
-#if HAVE_STDARG
 gmp_sprintf (char *buf, const char *fmt, ...)
-#else
-gmp_sprintf (va_alist)
-     va_dcl
-#endif
 {
 #if WANT_ASSERT
   int      fmtlen = strlen(fmt);
@@ -45,15 +44,7 @@ gmp_sprintf (va_alist)
   va_list  ap;
   int      ret;
 
-#if HAVE_STDARG
   va_start (ap, fmt);
-#else
-  char       *buf;
-  const char *fmt;
-  va_start (ap);
-  buf = va_arg (ap, char *);
-  fmt = va_arg (ap, const char *);
-#endif
 
   ret = __gmp_doprnt (&__gmp_sprintf_funs, &buf, fmt, ap);
   va_end (ap);
index 01fb3c98e6f24aced722155f446b7b41590beb90..40374e1a07ed31da3e24b9707e5a517613e5b01e 100644 (file)
@@ -9,26 +9,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 4ed4c5dbe2809f3a5b765ebeb045e694ad3550f0..44785dae2a72e51cd28cce4003865afa2e089a0e 100644 (file)
@@ -5,26 +5,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#include "config.h"
-
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 8bed6775acf860b9ba7c7271e586daada7aaaf80..839f133d9dbbaaf4c3beee9d04c0d2aa4fe619aa 100644 (file)
@@ -5,26 +5,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>
 
 #include "gmp.h"
index f8da0efbd1ae6a802085cbf6720dfe50a1f16195..8e768978f56e25a29dc487af260d2090f26e8215 100644 (file)
@@ -5,26 +5,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>
 
 #include "gmp.h"
index 565fdfd8dd1057c590d14f9b6d4a7eca83cabca3..ed6f99885dd0798b5e5f06d7bfb5941019e25083 100644 (file)
@@ -5,26 +5,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <string.h>    /* for strlen */
 
 #include "gmp.h"
index b1a30456277759b174fd0661652974e4f2ac215a..099455d32544ec58d57286c0a7e7940b32c883ab 100644 (file)
@@ -5,26 +5,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#include "config.h"
-
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <string.h>    /* for strlen */
 
 #include "gmp.h"
index 844bd81e8c52e5a6fddd663cc5ffec2c08f4da49..0cee1a76235f49f343fa65cd12360ac8262c3298 100644 (file)
@@ -2,20 +2,31 @@
 
 # Copyright 2001, 2002, 2010 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
index b47b4b89349b2b3aba45ddbde96dfdd892258c63..9d033e1259a6eec053c9ea8615f6a9b3e95a4934 100644 (file)
 
 # Copyright 2001, 2002, 2010 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 VPATH = @srcdir@
 am__make_dryrun = \
index 31969b2981879e44a88ff42ff197fea080974280..09e3b765bcd6f795a228d8cefeb8d3f4d50ef005 100644 (file)
@@ -1,55 +1,43 @@
 /* gmp_randinit (state, algorithm, ...) -- Initialize a random state.
 
-Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+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 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.
+it under the terms of either:
 
-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 Lesser General Public
-License for more details.
+  * 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
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+  * 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.
 
-#include "config.h"
+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.
 
-#include <stdio.h> /* for NULL */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
 
 #include "gmp.h"
 #include "gmp-impl.h"
 
 void
-#if HAVE_STDARG
-gmp_randinit (gmp_randstate_t rstate,
-             gmp_randalg_t alg,
-             ...)
-#else
-gmp_randinit (va_alist)
-     va_dcl
-#endif
+gmp_randinit (gmp_randstate_t rstate, gmp_randalg_t alg, ...)
 {
   va_list ap;
-#if HAVE_STDARG
   va_start (ap, alg);
-#else
-  __gmp_randstate_struct *rstate;
-  gmp_randalg_t alg;
-  va_start (ap);
-  rstate = va_arg (ap, __gmp_randstate_struct *);
-  alg = va_arg (ap, gmp_randalg_t);
-#endif
 
   switch (alg) {
   case GMP_RAND_ALG_LC:
index 5fc49b27d30cbd039f1ffbbd29b36029dbac8414..619ab91bd15822793222c5236723faadb847f07a 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2003, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index a4e82426f046cdbcb61b65e97037c22a207ae2b9..fb3798b73dec81d3d52a1851dd633ad88b04aaa2 100644 (file)
@@ -1,21 +1,32 @@
 /* gmp_randclear (state) -- Clear and deallocate random state STATE.
 
-Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 171a0bd87eac099f4f9e67ed931a8be1a455f361..7d173f9364c2ebcc6a327c85336e41046ba3b8b0 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index f140a330beb8abc8ff5a6ace80a75a5a81939be4..66f4bc49033c4b08b02e7a6e6ed7445af87f3450 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 4dcde73a2a5f70c18c0ddfd9a074b0fb5d4bc1ac..013e877286d9ae1ab6d03c975e16c9fff5accb7b 100644 (file)
@@ -1,22 +1,33 @@
 /* gmp_randinit_lc_2exp_size -- initialize a random state with a linear
    congruential generator of a requested size.
 
-Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1999-2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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"
index de89a7802d1941484a60df76b126c61e8969985b..195f759327a6a21de70d732c4316d7be01032bdb 100644 (file)
@@ -1,21 +1,32 @@
 /* Linear Congruential pseudo-random number generator functions.
 
-Copyright 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+Copyright 1999-2003, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 3137bb54f20e6589bb6b50aaaffb4ecf8b478df9..f3cdc66662635248ec3e476c8238a93b1339b1e8 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2002, 2003, 2006 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 */
 
@@ -347,7 +358,7 @@ void
 __gmp_randclear_mt (gmp_randstate_t rstate)
 {
   (*__gmp_free_func) ((void *) RNG_STATE (rstate),
-                     ALLOC (rstate->_mp_seed) * BYTES_PER_MP_LIMB);
+                     ALLOC (rstate->_mp_seed) * GMP_LIMB_BYTES);
 }
 
 void __gmp_randiset_mt (gmp_randstate_ptr, gmp_randstate_srcptr);
@@ -362,7 +373,7 @@ static const gmp_randfnptr_t Mersenne_Twister_Generator_Noseed = {
 void
 __gmp_randiset_mt (gmp_randstate_ptr dst, gmp_randstate_srcptr src)
 {
-  const mp_size_t sz = ((sizeof (gmp_rand_mt_struct) - 1) / BYTES_PER_MP_LIMB) + 1;
+  const mp_size_t sz = ((sizeof (gmp_rand_mt_struct) - 1) / GMP_LIMB_BYTES) + 1;
   gmp_rand_mt_struct *dstp, *srcp;
   mp_size_t i;
 
@@ -385,7 +396,7 @@ __gmp_randiset_mt (gmp_randstate_ptr dst, gmp_randstate_srcptr src)
 void
 __gmp_randinit_mt_noseed (gmp_randstate_ptr dst)
 {
-  const mp_size_t sz = ((sizeof (gmp_rand_mt_struct) - 1) / BYTES_PER_MP_LIMB) + 1;
+  const mp_size_t sz = ((sizeof (gmp_rand_mt_struct) - 1) / GMP_LIMB_BYTES) + 1;
   gmp_rand_mt_struct *dstp;
   mp_size_t i;
 
index 2f26956a5bcc5d45e83e00f73e07a4fdc52e7fcb..d64ff59548db76b38c10efbde6f99260d225221f 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2002, 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /* Number of extractions used to warm the buffer up.  */
index e3b03388569ef51c6b13aced83fe3143f7cfd3f8..1db7855141c985f4700ea194be22253e81f66c7c 100644 (file)
@@ -1,21 +1,32 @@
 /* Mersenne Twister pseudo-random number generator functions.
 
-Copyright 2002, 2003 Free Software Foundation, Inc.
+Copyright 2002, 2003, 2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -25,16 +36,15 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 /* Calculate (b^e) mod (2^n-k) for e=1074888996, n=19937 and k=20023,
    needed by the seeding function below.  */
 static void
-mangle_seed (mpz_ptr r, mpz_srcptr b_orig)
+mangle_seed (mpz_ptr r)
 {
   mpz_t          t, b;
   unsigned long  e = 0x40118124;
   unsigned long  bit = 0x20000000;
 
-  mpz_init (t);
-  mpz_init_set (b, b_orig);  /* in case r==b_orig */
+  mpz_init2 (t, 19937L);
+  mpz_init_set (b, r);
 
-  mpz_set (r, b);
   do
     {
       mpz_mul (r, r, r);
@@ -43,7 +53,7 @@ mangle_seed (mpz_ptr r, mpz_srcptr b_orig)
       for (;;)
         {
           mpz_tdiv_q_2exp (t, r, 19937L);
-          if (mpz_sgn (t) == 0)
+          if (SIZ (t) == 0)
             break;
           mpz_tdiv_r_2exp (r, r, 19937L);
           mpz_addmul_ui (r, t, 20023L);
@@ -51,7 +61,7 @@ mangle_seed (mpz_ptr r, mpz_srcptr b_orig)
 
       if ((e & bit) != 0)
         {
-          e &= ~bit;
+          e ^= bit;
           mpz_mul (r, r, b);
           goto reduce;
         }
@@ -107,15 +117,15 @@ randseed_mt (gmp_randstate_t rstate, mpz_srcptr seed)
 
   p = (gmp_rand_mt_struct *) RNG_STATE (rstate);
 
-  mpz_init (mod);
-  mpz_init (seed1);
+  mpz_init2 (mod, 19937L);
+  mpz_init2 (seed1, 19937L);
 
-  mpz_set_ui (mod, 0L);
   mpz_setbit (mod, 19937L);
   mpz_sub_ui (mod, mod, 20027L);
   mpz_mod (seed1, seed, mod);  /* Reduce `seed' modulo `mod'.  */
+  mpz_clear (mod);
   mpz_add_ui (seed1, seed1, 2L);       /* seed1 is now ready.  */
-  mangle_seed (seed1, seed1);  /* Perform the mangling by powering.  */
+  mangle_seed (seed1); /* Perform the mangling by powering.  */
 
   /* Copy the last bit into bit 31 of mt[0] and clear it.  */
   p->mt[0] = (mpz_tstbit (seed1, 19936L) != 0) ? 0x80000000 : 0;
@@ -124,14 +134,12 @@ randseed_mt (gmp_randstate_t rstate, mpz_srcptr seed)
   /* Split seed1 into N-1 32-bit chunks.  */
   mpz_export (&p->mt[1], &cnt, -1, sizeof (p->mt[1]), 0,
               8 * sizeof (p->mt[1]) - 32, seed1);
+  mpz_clear (seed1);
   cnt++;
   ASSERT (cnt <= N);
   while (cnt < N)
     p->mt[cnt++] = 0;
 
-  mpz_clear (mod);
-  mpz_clear (seed1);
-
   /* Warm the generator up if necessary.  */
   if (WARM_UP != 0)
     for (i = 0; i < WARM_UP / N; i++)
index f349d3593766377f537ab874ee9b2ab6981b98ac..2d4ef86aa324f7a8752b5281895edbc156edd6a8 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2003, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 93eb3e70cb184e3a970c9d3ab78b317656e68a25..1701da7a2c0c9bbc27bbb52a356eddc393319b1f 100644 (file)
@@ -10,17 +10,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 077382eeaed63469f29b1b0488871f5f4c0cfc01..1214d000d53c76b94affe85f13355285967d9151 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2000, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 9039edab24b0c0da447b33268c9352772944721d..1c97232e30e8dc1ef695a64bd4861e3a5be8d0c8 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2000, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 5359b5e5e6efab83db8a23ddd721d4ff09063120..b5e01482224b5d546e5cf99defe9ebc68725f3a6 100644 (file)
@@ -2,20 +2,31 @@
 
 # Copyright 2001, 2002 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
index 3f42a08c230ceeeeaac03c3c7c0983b614f6c6d0..718a2c5bebc93562d7885d65aab13d85d0e61bae 100644 (file)
 
 # Copyright 2001, 2002 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 VPATH = @srcdir@
 am__make_dryrun = \
index 2c5b1d9876722bd4f823cd52010214a764d512ab..47b22706cede1f10a273531b753e05f4d165dff1 100644 (file)
@@ -4,33 +4,39 @@
    CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
    FUTURE GNU MP RELEASES.
 
-Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2001-2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 _GNU_SOURCE    /* for DECIMAL_POINT in langinfo.h */
 
-#include "config.h"
+#include "config.h"    /* needed for the HAVE_, could also move gmp incls */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <ctype.h>
 #include <stddef.h>    /* for ptrdiff_t */
 #include <stdio.h>
index 596571eeb43f49c4fa27c71ab61c6868f67ebda6..83f46169eda6c35abe52dabe0044021c83c39347 100644 (file)
@@ -5,26 +5,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>
 
 #include "gmp.h"
@@ -32,24 +36,11 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
 int
-#if HAVE_STDARG
 gmp_fscanf (FILE *fp, const char *fmt, ...)
-#else
-gmp_fscanf (va_alist)
-     va_dcl
-#endif
 {
   va_list  ap;
   int      ret;
-#if HAVE_STDARG
   va_start (ap, fmt);
-#else
-  FILE       *fp;
-  const char *fmt;
-  va_start (ap);
-  fp = va_arg (ap, FILE *);
-  fmt = va_arg (ap, const char *);
-#endif
 
   ret = __gmp_doscan (&__gmp_fscanf_funs, fp, fmt, ap);
   va_end (ap);
index 74590232d7bb6f2de381c6bb8ae6097d83cdca47..396e9a175f71ef13e30c6a55af4285b6e2209b55 100644 (file)
@@ -9,17 +9,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
index b4840d1f5ac68b56a935e8ca8ff14a0df3a72944..a944a7c029cf5320956aaf596681ce2f82c843b0 100644 (file)
@@ -5,26 +5,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>
 
 #include "gmp.h"
@@ -32,22 +36,11 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
 int
-#if HAVE_STDARG
 gmp_scanf (const char *fmt, ...)
-#else
-gmp_scanf (va_alist)
-     va_dcl
-#endif
 {
   va_list  ap;
   int      ret;
-#if HAVE_STDARG
   va_start (ap, fmt);
-#else
-  const char *fmt;
-  va_start (ap);
-  fmt = va_arg (ap, const char *);
-#endif
 
   ret = __gmp_doscan (&__gmp_fscanf_funs, stdin, fmt, ap);
   va_end (ap);
index 3eb10ee3895b7e8845e98bdac99c13c022c65f13..b3d12dcda6401d96233d2c4e585aaa8b4f8e3fec 100644 (file)
@@ -5,26 +5,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>
 
 #include "gmp.h"
@@ -32,24 +36,11 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
 int
-#if HAVE_STDARG
 gmp_sscanf (const char *s, const char *fmt, ...)
-#else
-gmp_sscanf (va_alist)
-     va_dcl
-#endif
 {
   va_list  ap;
   int      ret;
-#if HAVE_STDARG
   va_start (ap, fmt);
-#else
-  const char *s;
-  const char *fmt;
-  va_start (ap);
-  s = va_arg (ap, const char *);
-  fmt = va_arg (ap, const char *);
-#endif
 
 #if SSCANF_WRITABLE_INPUT
   /* let gmp_vsscanf handle the copying */
index 008bad7014590b070ca508cb41bdba847b53875b..ed5bdf57d346332ac8f2f3c43d9d08e8383833f5 100644 (file)
@@ -4,22 +4,33 @@
    CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
    FUTURE GNU MP RELEASES.
 
-Copyright 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+Copyright 2001-2003, 2009 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <stdarg.h>
index 2f8684cdd8737fa3e9da370660bd2552d3358e7d..8011b557549aa7c71d4f3c4b460673dea6699399 100644 (file)
@@ -5,26 +5,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stdio.h>
 
 #include "gmp.h"
index a411a7c5d4a948302abea437910a642957f4da28..51feebf72ef4c8a1caedea03a6fca28b582f20b4 100644 (file)
@@ -5,25 +5,30 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-#include "config.h"
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
 
 #include <stdio.h>
 
index 160e62dce7752b46b5a0b5eabb1ba3f6a2823189..6fb043dce25cf455d6c19633b28759bce23af5d6 100644 (file)
@@ -5,25 +5,30 @@ Copyright 2001, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
-#include "config.h"
-
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
 
 #include <string.h>
 
index 7e0917fe6fb69fc41bdf09e3255a962ab95465ab..35912af360c53403ee1d068a15ad4f9d3789b436 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2000, 2001, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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 <stdlib.h>
index 662d4ea197a0777bf1c7bacde4c949e151b454db..ed162e552b3b6bacc13bc33e0303dbdbae68dd19 100644 (file)
@@ -1,22 +1,33 @@
 /* Stack allocation routines.  This is intended for machines without support
    for the `alloca' function.
 
-Copyright 1996, 1997, 1999, 2000, 2001, 2006 Free Software Foundation, Inc.
+Copyright 1996, 1997, 1999-2001, 2006 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 87da7f3c8e654fb27ba6579588ae6a4e605e8f3d..92f516b5ff3d08b8290aab8ca636dc0152f459b3 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2000, 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
index dc85df36ca69305e0bc6592acf11194dbb2e7ece..aa3c6c579ffe831168eeebc1105d31bd9c2da1e2 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 2000, 2001, 2002, 2003, 2004, 2013 Free Software Foundation, Inc.
+# Copyright 2000-2004, 2013 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
@@ -15,7 +15,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 
 
 SUBDIRS = . devel mpn mpz mpq mpf rand misc cxx
index bf49e60c9e207f931f394027a156c3bc7691a396..28ff1f45228fbf7cee6f17b9cfd9b40f5e468e5b 100644 (file)
@@ -15,7 +15,7 @@
 
 @SET_MAKE@
 
-# Copyright 2000, 2001, 2002, 2003, 2004, 2013 Free Software Foundation, Inc.
+# Copyright 2000-2004, 2013 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 
-# Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
-# Inc.
+# Copyright 1996, 1998-2002 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 VPATH = @srcdir@
 am__make_dryrun = \
   { \
index 05daceb8aa72bcdb90aca39c8c25429d53c79f52..dad77630282c1fde6ca2dc4d9fc8e7497bb15f28 100644 (file)
@@ -16,7 +16,7 @@ dnl  Public License for more details.
 
 dnl  You should have received a copy of the GNU General Public License along
 dnl  with the GNU MP Library test suite.  If not, see
-dnl  http://www.gnu.org/licenses/.
+dnl  https://www.gnu.org/licenses/.
 
 
 dnl  The current version of the code attempts to keep the call/return
@@ -30,7 +30,7 @@ C
 C Execute an fldcw, setting the x87 control word to cw.
 
 PROLOGUE(x86_fldcw)
-       movq    %rdi, -8(%rsp)
+       mov     %rdi, -8(%rsp)
        fldcw   -8(%rsp)
        ret
 EPILOGUE()
@@ -43,7 +43,7 @@ C Execute an fstcw, returning the current x87 control word.
 PROLOGUE(x86_fstcw)
        movq    $0, -8(%rsp)
        fstcw   -8(%rsp)
-       movq    -8(%rsp), %rax
+       mov     -8(%rsp), %rax
        ret
 EPILOGUE()
 
@@ -101,52 +101,52 @@ m4_assert_numargs(1)
        TEXT
        ALIGN(32)
 PROLOGUE(calling_conventions)
-       movq    G(calling_conventions_values)@GOTPCREL(%rip), %rax
-       popq    RETADDR(%rax)
+       mov     G(calling_conventions_values)@GOTPCREL(%rip), %rax
+       pop     RETADDR(%rax)
 
-       movq    %rbx, SAVE_RBX(%rax)
-       movq    %rbp, SAVE_RBP(%rax)
-       movq    %r12, SAVE_R12(%rax)
-       movq    %r13, SAVE_R13(%rax)
-       movq    %r14, SAVE_R14(%rax)
-       movq    %r15, SAVE_R15(%rax)
+       mov     %rbx, SAVE_RBX(%rax)
+       mov     %rbp, SAVE_RBP(%rax)
+       mov     %r12, SAVE_R12(%rax)
+       mov     %r13, SAVE_R13(%rax)
+       mov     %r14, SAVE_R14(%rax)
+       mov     %r15, SAVE_R15(%rax)
 
        C Values we expect to see unchanged, as per amd64check.c
-       movq    WANT_RBX(%rax), %rbx
-       movq    WANT_RBP(%rax), %rbp
-       movq    WANT_R12(%rax), %r12
-       movq    WANT_R13(%rax), %r13
-       movq    WANT_R14(%rax), %r14
-       movq    WANT_R15(%rax), %r15
+       mov     WANT_RBX(%rax), %rbx
+       mov     WANT_RBP(%rax), %rbp
+       mov     WANT_R12(%rax), %r12
+       mov     WANT_R13(%rax), %r13
+       mov     WANT_R14(%rax), %r14
+       mov     WANT_R15(%rax), %r15
 
        C Try to provoke a problem by starting with junk in the caller-saves
        C registers, especially %rax which will be the return value.
-C      movq    JUNK_RAX(%rax), %rax            C overwritten below anyway
-       movq    JUNK_R10(%rax), %r10
-       movq    JUNK_R11(%rax), %r11
+C      mov     JUNK_RAX(%rax), %rax            C overwritten below anyway
+       mov     JUNK_R10(%rax), %r10
+       mov     JUNK_R11(%rax), %r11
 
-       movq    G(calling_conventions_function)@GOTPCREL(%rip), %rax
+       mov     G(calling_conventions_function)@GOTPCREL(%rip), %rax
        call    *(%rax)
 
-       movq    G(calling_conventions_values)@GOTPCREL(%rip), %rcx
+       mov     G(calling_conventions_values)@GOTPCREL(%rip), %rcx
 
-       movq    %rbx, RBX(%rcx)
-       movq    %rbp, RBP(%rcx)
-       movq    %r12, R12(%rcx)
-       movq    %r13, R13(%rcx)
-       movq    %r14, R14(%rcx)
-       movq    %r15, R15(%rcx)
+       mov     %rbx, RBX(%rcx)
+       mov     %rbp, RBP(%rcx)
+       mov     %r12, R12(%rcx)
+       mov     %r13, R13(%rcx)
+       mov     %r14, R14(%rcx)
+       mov     %r15, R15(%rcx)
 
-       pushfq
-       popq    %rbx
-       movq    %rbx, RFLAGS(%rcx)
+       pushf
+       pop     %rbx
+       mov     %rbx, RFLAGS(%rcx)
 
-       movq    SAVE_RBX(%rcx), %rbx
-       movq    SAVE_RBP(%rcx), %rbp
-       movq    SAVE_R12(%rcx), %r12
-       movq    SAVE_R13(%rcx), %r13
-       movq    SAVE_R14(%rcx), %r14
-       movq    SAVE_R15(%rcx), %r15
+       mov     SAVE_RBX(%rcx), %rbx
+       mov     SAVE_RBP(%rcx), %rbp
+       mov     SAVE_R12(%rcx), %r12
+       mov     SAVE_R13(%rcx), %r13
+       mov     SAVE_R14(%rcx), %r14
+       mov     SAVE_R15(%rcx), %r15
 
        C Overwrite parameter registers
 C      mov     JUNK_R9(%rcx), %r9
@@ -156,9 +156,9 @@ C   mov     JUNK_RDX(%rcx), %rdx
 C      mov     JUNK_RSI(%rcx), %rsi
 C      mov     JUNK_RDI(%rcx), %rdi
 
-       pushq   RETADDR(%rcx)
+       push    RETADDR(%rcx)
 
-       movq    G(calling_conventions_fenv)@GOTPCREL(%rip), %rcx
+       mov     G(calling_conventions_fenv)@GOTPCREL(%rip), %rcx
        fstenv  (%rcx)
        finit
 
index 7c313f3d3b168ac82b102166f53d92406bbd05cb..1b28d8c7ae0fcb591db2edcbdad350f667f252c1 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include "gmp.h"
index 167ee9bddb7e6dbca2c39864532336cb73aca758..e689c5a4f0fd8cd72186970fe5920341a7d44a51 100644 (file)
@@ -17,7 +17,7 @@ dnl  Public License for more details.
 
 dnl  You should have received a copy of the GNU General Public License along
 dnl  with the GNU MP Library test suite.  If not, see
-dnl  http://www.gnu.org/licenses/.
+dnl  https://www.gnu.org/licenses/.
 
 
 dnl  The current version of the code attempts to keep the call/return
index 5e8f837916715ca4c3cc55706563e4f3a6ea4574..f4bf06684cf9348d68aa99cf2a4ef7fc998bcc27 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include "gmp.h"
index dfcb1ea343f6c58fc954135318aaf47cb99afdb2..a5428d5d76dad87ef3bbb6df5a5ecdd803062472 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 2001-2004 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
@@ -15,7 +15,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 
 
 # LDADD has an explicit -L of $(top_builddir)/.libs for the benefit of gcc
index 9b56844618f5ba84e15a56cd381c9f1b1c3a5598..04e7520854e8db376b4641dec54c5680cfb84d14 100644 (file)
@@ -15,7 +15,7 @@
 
 @SET_MAKE@
 
-# Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 2001-2004 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
@@ -30,7 +30,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 VPATH = @srcdir@
 am__make_dryrun = \
   { \
index 9e93280b909e743b144ebc497db23ce512001ad7..1bd6ed2f148ccc08a598c726609c57130a70ff1b 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 2127b567999a64b0a1756b6d426eecb12d836c6d..ad10edd8a8adf429c9e23948ed8ca7125147d5ee 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mp*_class assignment operators.
 
-Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2001-2003 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 04c4627f726db43ba31a26276e85fbc96dc08e08..09d202b22656d2411b1920e05c2b66cdf0939c15 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mp*_class binary expressions.
 
-Copyright 2001, 2002, 2003, 2008, 2012 Free Software Foundation, Inc.
+Copyright 2001-2003, 2008, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index a546d6bb8ed7f704f3ac9cbd9a2e931c36909d22..117fd87b80284f3b9b5cadb0dc29c1ab97da208d 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmpxx.h"
index 261005d8676acbcf774b27b3d1cc796071739984..7a87f3cb04898cc22d3922363920111b8f0d60c8 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mp*_class constructors.
 
-Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2001-2003 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index c9ae822e330d21a32931b66ae29fbf4dd5f751c4..758f016386250e3e9fbd19fdd312017e65e77b1b 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 7244c320d5761a34c1ee2b7ea9a5b0847b964372..341a818b75f9e450b2cfd45eea589afaa1110318 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdexcept>
 
index 19be2014e34e9e51716b0e026cb0e9b02378a213..35f7a25c26f1a1fe2062929657bf3c04843369f9 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "gmpxx.h"
 
index 1fe83b3ea7339fe446509bc9576b427df7425cec..92bd917a973d7e9d3826bdaeb67610120de4749c 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <sstream>
 
index 6cd806bbd0d7e14854efdac34dfdbe8f7462f5d6..f04ae083f8012b7e8768dfeb431d94509d50bfb5 100644 (file)
@@ -1,6 +1,6 @@
 /* Test istream formatted input.
 
-Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright 2001-2004 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <iostream>
 #include <cstdlib>
index b649d95577f556ce62e3c2de68f8a8a016d0561f..01eacda9f23067f981f7848eadbded63dd0b6a80 100644 (file)
@@ -1,6 +1,6 @@
 /* Test locale support in C++ functions.
 
-Copyright 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
+Copyright 2001-2003, 2007 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <clocale>
 #include <iostream>
@@ -105,7 +105,7 @@ check_input (void)
                   cout << "  point " << point[i] << "\n";
                   cout << "  str   \"" << str << "\"\n";
                   cout << "  localeconv point \""
-                       << localeconv()->decimal_point << "\"\n";
+                       << GMP_DECIMAL_POINT << "\"\n";
                   abort ();
                 }
 
@@ -120,7 +120,7 @@ check_input (void)
                   cout << "  got   " << got << "\n";
                   cout << "  want  " << want << "\n";
                   cout << "  localeconv point \""
-                       << localeconv()->decimal_point << "\"\n";
+                       << GMP_DECIMAL_POINT << "\"\n";
                   abort ();
                 }
             }
index 08a34c1ce391d36b7c14029ae1bb8e7733184ae6..07079880e7a9f25097b5ed7d064c6b9ab23a5a53 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 /* Note that we don't use <climits> for LONG_MIN, but instead our own
index 5ac3b496cba1498b82f14bab0815b2f33cfa9f17..aeb6f675890d537bd5e4c818b8de061a7ecf88ee 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index f9563fff26f13ac7f8ee6ada88eab2fe1d47ad25..b1bf0dc4d8a9d6ffb053abf8f4d43f7c19413d5b 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mp*_class operators and functions.
 
-Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2001-2003 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 3fc472b6feb0186d3fb9160d16b7214956915c20..3a25442aafb0eb66f2f165bc21e904957fc8699f 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
@@ -129,6 +129,9 @@ void checkz (){
   ASSERT_ALWAYS(sgn(mpz_class(0))==0);
   ASSERT_ALWAYS(sgn(mpz_class(9))==1);
   ASSERT_ALWAYS(sgn(mpz_class(-17))==-1);
+  ASSERT_ALWAYS(mpz_class(1)+DBL_MAX>2);
+  ASSERT_ALWAYS(mpz_class(1)+DBL_MIN<2);
+  ASSERT_ALWAYS(mpz_class(1)+std::numeric_limits<double>::denorm_min()<2);
 }
 
 template<class T>
@@ -175,6 +178,11 @@ void checkqf (){
   ASSERT_ALWAYS(sgn(T(0))==0);
   ASSERT_ALWAYS(sgn(T(9))==1);
   ASSERT_ALWAYS(sgn(T(-17))==-1);
+  ASSERT_ALWAYS(T(1)+DBL_MAX>2);
+  ASSERT_ALWAYS(T(1)+DBL_MIN>1);
+  ASSERT_ALWAYS(T(1)+DBL_MIN<1.001);
+  ASSERT_ALWAYS(T(1)+std::numeric_limits<double>::denorm_min()>1);
+  ASSERT_ALWAYS(T(1)+std::numeric_limits<double>::denorm_min()<1.001);
 }
 
 void checkf (){
@@ -182,7 +190,7 @@ void checkf (){
   ASSERT_ALWAYS(sqrt(mpf_class(7))<2.65);
   ASSERT_ALWAYS(sqrt(mpf_class(0))==0);
   // TODO: add some consistency checks, as described in
-  // http://gmplib.org/list-archives/gmp-bugs/2013-February/002940.html
+  // https://gmplib.org/list-archives/gmp-bugs/2013-February/002940.html
   CHECK1(mpf_class,1.9,trunc);
   CHECK1(mpf_class,1.9,floor);
   CHECK1(mpf_class,1.9,ceil);
@@ -236,6 +244,8 @@ main (void)
 {
   tests_start();
 
+  // Enough precision for 1 + denorm_min
+  mpf_set_default_prec(DBL_MANT_DIG-DBL_MIN_EXP+42);
   checkz();
   checkqf<mpq_class>();
   checkqf<mpf_class>();
index b5273c5dcbc66b890359849ff67e91548e546b0f..cb6a2efc7d58ecf55bc4be532011f4ca64899ab8 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 9899f5fcbae57d51081a288c0723d007337d5f55..9b4f5e7dd741ccd09dc68206253019b9396a6978 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <iostream>
 #include <cstdlib>
index 28d68d47e2ae5fb734337aa10b3940cb20dad9bd..8039219f21dbc1c2028d5c582f00ea8ef4aacddc 100644 (file)
@@ -1,6 +1,6 @@
 /* Test precision of mpf_class expressions.
 
-Copyright 2001, 2002, 2003, 2008 Free Software Foundation, Inc.
+Copyright 2001-2003, 2008 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 5fd8cf72f4c12827159614b747155eb60118fc60..b71c49627b502c9ee88307551c24f8eb985ac771 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmpxx.h"
index c2152cc76568fd2873521395692d28fe532bc457..405f6f4981db04a268a26abf03ae7a0ae789466a 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mp*_class ternary expressions.
 
-Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2001-2003 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 4c4aa24adf6cd2e3298e5f42a49dfcb08a570465..d33b995d217bc7db678cdd939dba8be0eb0d8263 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mp*_class unary expressions.
 
-Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2001-2003 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 6eb362d6ad3ae1783aa84d975ddc4279c8be6377..7d62115bc35156d88f117d57aa0f45da21c89c43 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright 2000-2002 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
@@ -15,7 +15,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 
 
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
index d70849ad09bbbcdf2a2d07318168b0e3dfc2a11a..28a68c050bdf91136d11db513104e3ad9af5e99a 100644 (file)
@@ -15,7 +15,7 @@
 
 @SET_MAKE@
 
-# Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright 2000-2002 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
@@ -30,7 +30,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 VPATH = @srcdir@
 am__make_dryrun = \
   { \
index 2ae30102507a3e969b16411880ffa08f04b09d8d..77fa65dba3f2e67252a395db19768ce01ee6fb51 100644 (file)
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 
 
 
index 65d766d2b54a258deac1bc7abd82114ff0940841..79807b0ce51086dd24b035c6973c71c39f490f1d 100644 (file)
@@ -1,6 +1,5 @@
 /*
-Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006, 2007, 2008
-Free Software Foundation, Inc.
+Copyright 1996-2002, 2004, 2006-2008 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
 #include <string.h>
index 978a769a0b54dfac6b09b54c3c49f3a8c4db728f..5112d0a8d94f54188825185049798d3612aceb28 100644 (file)
@@ -1,6 +1,5 @@
 /*
-Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2011
-Free Software Foundation, Inc.
+Copyright 1996-2004, 2009, 2011 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
 #include <string.h>
index 88b56b5de204e97d162149634e42e50a36c12c4e..1f951f5389d732c2cc598a6e12f71c59d9c4832a 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright 1999, 2000, 2001, 2004, 2009, 2011 Free Software Foundation, Inc.
+Copyright 1999-2001, 2004, 2009, 2011 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
 #include <string.h>
index 6426913108333f7762f201e6112a5494dcfabca6..54eaf36d9651430a870eb61a9f1e8d478b4564ce 100644 (file)
@@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 62e0955264766f566a0114baa1b9d672eb95123b..858078907836ef22e2f8d032a1f91a77c9e46150 100644 (file)
@@ -1,6 +1,5 @@
 /*
-Copyright 1996, 1997, 1998, 2000, 2001, 2007, 2009 Free Software Foundation,
-Inc.
+Copyright 1996-1998, 2000, 2001, 2007, 2009 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index ef21c1dac55ee3534a300ea3b4ebecb18b6d2b70..be53336cf5f7f152404c448dbbeb87c3285febcd 100644 (file)
@@ -1,6 +1,5 @@
 /*
-Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009 Free
-Software Foundation, Inc.
+Copyright 1996-2004, 2009 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
 #include <stdio.h>
index 0a575e3f9bebf16e156a22f5365fefe47717e950..611a7767765b48d559da5cbcf209ea71606b6dbc 100644 (file)
@@ -1,6 +1,6 @@
 /*
-Copyright 1996, 1998, 1999, 2000, 2001, 2004, 2007, 2009, 2011 Free Software
-Foundation, Inc.
+Copyright 1996, 1998-2001, 2004, 2007, 2009, 2011 Free Software Foundation,
+Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
 #include <string.h>
index a4101cb1c54db6c2ddc13120fdd670bf683b98e6..3911bc009175cf5cdc6f96a5ac897d43514232a5 100644 (file)
@@ -3,8 +3,7 @@
    THIS IS A TEST PROGRAM USED ONLY FOR DEVELOPMENT.  IT'S ALMOST CERTAIN TO
    BE SUBJECT TO INCOMPATIBLE CHANGES IN FUTURE VERSIONS OF GMP.
 
-Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 2000-2006, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -19,7 +18,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 /* Usage: try [options] <function>...
@@ -211,11 +210,11 @@ int  option_data = DATA_TRAND;
 
 
 mp_size_t  pagesize;
-#define PAGESIZE_LIMBS  (pagesize / BYTES_PER_MP_LIMB)
+#define PAGESIZE_LIMBS  (pagesize / GMP_LIMB_BYTES)
 
 /* must be a multiple of the page size */
 #define REDZONE_BYTES   (pagesize * 16)
-#define REDZONE_LIMBS   (REDZONE_BYTES / BYTES_PER_MP_LIMB)
+#define REDZONE_LIMBS   (REDZONE_BYTES / GMP_LIMB_BYTES)
 
 
 #define MAX3(x,y,z)   (MAX (x, MAX (y, z)))
@@ -362,6 +361,7 @@ struct try_t {
 #define DATA_SRC1_HIGHBIT     7
 #define DATA_MULTIPLE_DIVISOR 8
 #define DATA_UDIV_QRNND       9
+#define DATA_DIV_QR_1        10
   char  data;
 
 /* Default is allow full overlap. */
@@ -540,6 +540,40 @@ validate_modexact_1_odd (void)
   validate_modexact_1c_odd ();
 }
 
+void
+validate_div_qr_1_pi1 (void)
+{
+  mp_srcptr up = ref.s[0].p;
+  mp_size_t un = size;
+  mp_size_t uh = ref.s[1].p[0];
+  mp_srcptr qp = fun.d[0].p;
+  mp_limb_t r = fun.retval;
+  mp_limb_t cy;
+  int cmp;
+  mp_ptr tp;
+  if (r >= divisor)
+    {
+      gmp_printf ("Bad remainder %Md, d = %Md\n", r, divisor);
+      validate_fail ();
+    }
+  tp = refmpn_malloc_limbs (un);
+  cy = refmpn_mul_1 (tp, qp, un, divisor);
+  cy += refmpn_add_1 (tp, tp, un, r);
+  if (cy != uh || refmpn_cmp (tp, up, un) != 0)
+    {
+      gmp_printf ("Incorrect result, size %ld.\n"
+                 "d = %Mx, u = %Mx, %Nx\n"
+                 "got: r = %Mx, q = %Nx\n"
+                 "q d + r = %Mx, %Nx",
+                 (long) un,
+                 divisor, uh, up, un,
+                 r, qp, un,
+                 cy, tp, un);
+      validate_fail ();
+    }
+  free (tp);
+}
+
 
 void
 validate_sqrtrem (void)
@@ -626,6 +660,7 @@ enum {
 
   TYPE_MOD_1, TYPE_MOD_1C, TYPE_DIVMOD_1, TYPE_DIVMOD_1C, TYPE_DIVREM_1,
   TYPE_DIVREM_1C, TYPE_PREINV_DIVREM_1, TYPE_DIVREM_2, TYPE_PREINV_MOD_1,
+  TYPE_DIV_QR_1N_PI1,
   TYPE_MOD_34LSUB1, TYPE_UDIV_QRNND, TYPE_UDIV_QRNND_R,
 
   TYPE_DIVEXACT_1, TYPE_BDIV_Q_1, TYPE_DIVEXACT_BY3, TYPE_DIVEXACT_BY3C,
@@ -747,12 +782,12 @@ param_init (void)
   p = &param[TYPE_ADDCND_N];
   COPY (TYPE_ADD_N);
   p->carry = CARRY_BIT;
-  REFERENCE (refmpn_addcnd_n);
+  REFERENCE (refmpn_cnd_add_n);
 
   p = &param[TYPE_SUBCND_N];
   COPY (TYPE_ADD_N);
   p->carry = CARRY_BIT;
-  REFERENCE (refmpn_subcnd_n);
+  REFERENCE (refmpn_cnd_sub_n);
 
 
   p = &param[TYPE_MUL_1];
@@ -1107,6 +1142,17 @@ param_init (void)
   p->size = SIZE_YES; /* ie. no size==0 */
   REFERENCE (refmpn_preinv_divrem_1);
 
+  p = &param[TYPE_DIV_QR_1N_PI1];
+  p->retval = 1;
+  p->src[0] = 1;
+  p->src[1] = 1;
+  /* SIZE_1 not supported. Always uses low limb only. */
+  p->size2 = 1;
+  p->dst[0] = 1;
+  p->divisor = DIVISOR_NORM;
+  p->data = DATA_DIV_QR_1;
+  VALIDATE (validate_div_qr_1_pi1);
+
   p = &param[TYPE_PREINV_MOD_1];
   p->retval = 1;
   p->src[0] = 1;
@@ -1716,12 +1762,12 @@ const struct choice_t choice_array[] = {
   { TRY(mpn_copyd), TYPE_COPYD },
 #endif
 
-  { TRY(mpn_addcnd_n), TYPE_ADDCND_N },
-  { TRY(mpn_subcnd_n), TYPE_SUBCND_N },
-#if HAVE_NATIVE_mpn_addlsh1_n
+  { TRY(mpn_cnd_add_n), TYPE_ADDCND_N },
+  { TRY(mpn_cnd_sub_n), TYPE_SUBCND_N },
+#if HAVE_NATIVE_mpn_addlsh1_n == 1
   { TRY(mpn_addlsh1_n), TYPE_ADDLSH1_N },
 #endif
-#if HAVE_NATIVE_mpn_addlsh2_n
+#if HAVE_NATIVE_mpn_addlsh2_n == 1
   { TRY(mpn_addlsh2_n), TYPE_ADDLSH2_N },
 #endif
 #if HAVE_NATIVE_mpn_addlsh_n
@@ -1745,10 +1791,10 @@ const struct choice_t choice_array[] = {
 #if HAVE_NATIVE_mpn_addlsh_n_ip2
   { TRY_FUNFUN(mpn_addlsh_n_ip2), TYPE_ADDLSH_N_IP2 },
 #endif
-#if HAVE_NATIVE_mpn_sublsh1_n
+#if HAVE_NATIVE_mpn_sublsh1_n == 1
   { TRY(mpn_sublsh1_n), TYPE_SUBLSH1_N },
 #endif
-#if HAVE_NATIVE_mpn_sublsh2_n
+#if HAVE_NATIVE_mpn_sublsh2_n == 1
   { TRY(mpn_sublsh2_n), TYPE_SUBLSH2_N },
 #endif
 #if HAVE_NATIVE_mpn_sublsh_n
@@ -1763,10 +1809,10 @@ const struct choice_t choice_array[] = {
 #if HAVE_NATIVE_mpn_sublsh_n_ip1
   { TRY_FUNFUN(mpn_sublsh_n_ip1), TYPE_SUBLSH_N_IP1 },
 #endif
-#if HAVE_NATIVE_mpn_rsblsh1_n
+#if HAVE_NATIVE_mpn_rsblsh1_n == 1
   { TRY(mpn_rsblsh1_n), TYPE_RSBLSH1_N },
 #endif
-#if HAVE_NATIVE_mpn_rsblsh2_n
+#if HAVE_NATIVE_mpn_rsblsh2_n == 1
   { TRY(mpn_rsblsh2_n), TYPE_RSBLSH2_N },
 #endif
 #if HAVE_NATIVE_mpn_rsblsh_n
@@ -1830,6 +1876,7 @@ const struct choice_t choice_array[] = {
 #if HAVE_NATIVE_mpn_mod_1c
   { TRY(mpn_mod_1c),       TYPE_MOD_1C },
 #endif
+  { TRY(mpn_div_qr_1n_pi1), TYPE_DIV_QR_1N_PI1 },
 #if GMP_NUMB_BITS % 4 == 0
   { TRY(mpn_mod_34lsub1),  TYPE_MOD_34LSUB1 },
 #endif
@@ -1993,12 +2040,12 @@ malloc_region (struct region_t *r, mp_size_t n)
   mp_ptr  p;
   size_t  nbytes;
 
-  ASSERT ((pagesize % BYTES_PER_MP_LIMB) == 0);
+  ASSERT ((pagesize % GMP_LIMB_BYTES) == 0);
 
   n = round_up_multiple (n, PAGESIZE_LIMBS);
   r->size = n;
 
-  nbytes = n*BYTES_PER_MP_LIMB + 2*REDZONE_BYTES + pagesize;
+  nbytes = n*GMP_LIMB_BYTES + 2*REDZONE_BYTES + pagesize;
 
 #if defined (MAP_ANONYMOUS) && ! defined (MAP_ANON)
 #define MAP_ANON  MAP_ANONYMOUS
@@ -2409,10 +2456,13 @@ call (struct each_t *e, tryfun_t function)
   case TYPE_RSBLSH2_NC:
   case TYPE_ADD_NC:
   case TYPE_SUB_NC:
+    e->retval = CALLING_CONVENTIONS (function)
+      (e->d[0].p, e->s[0].p, e->s[1].p, size, carry);
+    break;
   case TYPE_ADDCND_N:
   case TYPE_SUBCND_N:
     e->retval = CALLING_CONVENTIONS (function)
-      (e->d[0].p, e->s[0].p, e->s[1].p, size, carry);
+      (carry, e->d[0].p, e->s[0].p, e->s[1].p, size);
     break;
   case TYPE_ADD_ERR1_N:
   case TYPE_SUB_ERR1_N:
@@ -2551,6 +2601,14 @@ call (struct each_t *e, tryfun_t function)
     e->retval = CALLING_CONVENTIONS (function)
       (e->s[0].p, size, divisor, refmpn_invert_limb (divisor));
     break;
+  case TYPE_DIV_QR_1N_PI1:
+    {
+      mp_limb_t dinv = refmpn_invert_limb (divisor);
+      e->retval = CALLING_CONVENTIONS (function)
+       (e->d[0].p, e->s[0].p, size, e->s[1].p[0], divisor, dinv);
+      break;
+    }
+
   case TYPE_MOD_34LSUB1:
     e->retval = CALLING_CONVENTIONS (function) (e->s[0].p, size);
     break;
@@ -3075,6 +3133,10 @@ try_one (void)
       case DATA_UDIV_QRNND:
        s[i].p[1] %= divisor;
        break;
+      case DATA_DIV_QR_1:
+       if (i == 1)
+         s[i].p[0] %= divisor;
+       break;
       }
 
       mprotect_region (&s[i].region, PROT_READ);
@@ -3336,7 +3398,7 @@ Error, error, cannot get page size
        printf ("s[%d] %p to %p (0x%lX bytes)\n",
                i, (void *) (s[i].region.ptr),
                (void *) (s[i].region.ptr + s[i].region.size),
-               (long) s[i].region.size * BYTES_PER_MP_LIMB);
+               (long) s[i].region.size * GMP_LIMB_BYTES);
       }
 
 #define INIT_EACH(e,es)                                                 \
@@ -3346,7 +3408,7 @@ Error, error, cannot get page size
        printf ("%s d[%d] %p to %p (0x%lX bytes)\n",                    \
                es, i, (void *) (e.d[i].region.ptr),                    \
                (void *)  (e.d[i].region.ptr + e.d[i].region.size),     \
-               (long) e.d[i].region.size * BYTES_PER_MP_LIMB);         \
+               (long) e.d[i].region.size * GMP_LIMB_BYTES);         \
       }
 
     INIT_EACH(ref, "ref");
index 37d7f06d53d87dd1da30622050f8889d3eec3a60..50aa3a73b397016800c59ef3c4534253f7638986 100644 (file)
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -60,10 +60,10 @@ main (int argc, char **argv)
     }
 
   alloc_size = max_size + 32;
-  s1 = malloc (alloc_size * BYTES_PER_MP_LIMB);
-  s2 = malloc (alloc_size * BYTES_PER_MP_LIMB);
-  dx = malloc (alloc_size * BYTES_PER_MP_LIMB);
-  dy = malloc (alloc_size * BYTES_PER_MP_LIMB);
+  s1 = malloc (alloc_size * GMP_LIMB_BYTES);
+  s2 = malloc (alloc_size * GMP_LIMB_BYTES);
+  dx = malloc (alloc_size * GMP_LIMB_BYTES);
+  dy = malloc (alloc_size * GMP_LIMB_BYTES);
 
   cumul_size = 0;
   for (pass = 0; pass < n_passes; pass++)
index 1a723fe3bf6bd3ad953ebb1af58df723be7b1f3a..c91813ea08213eeabcde419d72131430c479d093 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>            /* for abort */
index 31b1e152c0f5c33b1868dc4f46ddb26f960a333b..59920c2726ec67a7e3aed181693d6c6fdc0e1a5d 100644 (file)
@@ -1,6 +1,6 @@
 /* Miscellaneous test program support routines.
 
-Copyright 2000, 2001, 2002, 2003, 2005, 2013 Free Software Foundation, Inc.
+Copyright 2000-2003, 2005, 2013 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 6a96ec3bb7590630e2da6b0074eb835ef87f7f16..24f87673492b8869540e746612704f24c7722fb1 100644 (file)
@@ -15,7 +15,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 
 
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
index 3acb88af4607a711952ec2b1bdafd86024ac3817..07ff68475af63483d2dd6113f1aa1c8b9b95b0ba 100644 (file)
@@ -30,7 +30,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 VPATH = @srcdir@
 am__make_dryrun = \
   { \
index 724b01070665890362bd1bc40a75c465be180cfe..5979e27955f516f1ebcc39c9ed29bff98e9ad812 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #define _GNU_SOURCE    /* for DECIMAL_POINT in glibc langinfo.h */
 
index 25b016179dbf54aae72d425094d19e70415720a3..8853dcc0ffdc8c6db0a6f7bdb64e9da985dfcbef 100644 (file)
@@ -1,6 +1,6 @@
 /* Test gmp_printf and related functions.
 
-Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2001-2003 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 /* Usage: t-printf [-s]
@@ -25,14 +25,9 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
        faulty or strange.  */
 
 
-#include "config.h"
+#include "config.h"    /* needed for the HAVE_, could also move gmp incls */
 
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #include <stddef.h>    /* for ptrdiff_t */
 #include <stdio.h>
 #include <stdlib.h>
@@ -73,12 +68,7 @@ FILE  *check_vfprintf_fp;
 
 
 void
-#if HAVE_STDARG
 check_plain (const char *want, const char *fmt_orig, ...)
-#else
-check_plain (va_alist)
-     va_dcl
-#endif
 {
   char        got[MAX_OUTPUT];
   int         got_len, want_len;
@@ -86,15 +76,7 @@ check_plain (va_alist)
   char        *fmt, *q;
   const char  *p;
   va_list     ap;
-#if HAVE_STDARG
   va_start (ap, fmt_orig);
-#else
-  const char  *want;
-  const char  *fmt_orig;
-  va_start (ap);
-  want = va_arg (ap, const char *);
-  fmt_orig = va_arg (ap, const char *);
-#endif
 
   if (! option_check_printf)
     return;
@@ -318,23 +300,10 @@ check_obstack_vprintf (const char *want, const char *fmt, va_list ap)
 
 
 void
-#if HAVE_STDARG
 check_one (const char *want, const char *fmt, ...)
-#else
-check_one (va_alist)
-     va_dcl
-#endif
 {
   va_list ap;
-#if HAVE_STDARG
   va_start (ap, fmt);
-#else
-  const char  *want;
-  const char  *fmt;
-  va_start (ap);
-  want = va_arg (ap, const char *);
-  fmt = va_arg (ap, const char *);
-#endif
 
   /* simplest first */
   check_vsprintf (want, fmt, ap);
index b8d833867f2344a2aafc4108910c02f0a47b04ec..46c0a5f77c8837774903b557937f56a4276bd089 100644 (file)
@@ -1,6 +1,6 @@
 /* Test gmp_scanf and related functions.
 
-Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright 2001-2004 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 /* Usage: t-scanf [-s]
@@ -29,13 +29,7 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
    seem like too much trouble. */
 
 
-#include "config.h"
-
-#if HAVE_STDARG
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
 
 #include <stddef.h>    /* for ptrdiff_t */
 #include <stdio.h>
@@ -129,25 +123,12 @@ int   fromstring_next_c;
 
 /* Call gmp_fscanf, reading the "input" string data provided. */
 int
-#if HAVE_STDARG
 fromstring_gmp_fscanf (const char *input, const char *fmt, ...)
-#else
-fromstring_gmp_fscanf (va_alist)
-     va_dcl
-#endif
 {
   va_list  ap;
   FILE     *fp;
   int      ret;
-#if HAVE_STDARG
   va_start (ap, fmt);
-#else
-  const char    *input;
-  const char    *fmt;
-  va_start (ap);
-  input = va_arg (ap, const char *);
-  fmt = va_arg (ap, const char *);
-#endif
 
   fp = fopen (TEMPFILE, "w+");
   ASSERT_ALWAYS (fp != NULL);
index 05e9812844e0aa5fd081413915f88ea844b5b81f..71bccf1a29f97505a4cd3de5c2a9d664c3fe6774 100644 (file)
@@ -1,7 +1,6 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 1996, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
-# Foundation, Inc.
+# Copyright 1996, 1999-2004 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
@@ -16,7 +15,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 
 
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
index e451aa5e20bdcee5bfd1877ef88b713d4b905868..cbc7bef05b4c2706c5b3d973f0b34e57215ff7e7 100644 (file)
@@ -15,8 +15,7 @@
 
 @SET_MAKE@
 
-# Copyright 1996, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
-# Foundation, Inc.
+# Copyright 1996, 1999-2004 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
@@ -31,7 +30,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 VPATH = @srcdir@
 am__make_dryrun = \
   { \
index 53f973c2fbb1d73e90aea37d2c0244f6407ff9af..3a382530b604372ec9ab5c73fc94d11046257c35 100644 (file)
@@ -1,6 +1,6 @@
 /* Test that routines allow reusing a source variable as destination.
 
-Copyright 1996, 2000, 2001, 2002, 2012 Free Software Foundation, Inc.
+Copyright 1996, 2000-2002, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -148,14 +148,22 @@ main (int argc, char **argv)
       in2i = urandom ();
       for (i = 0; i < sizeof (dsi_funcs) / sizeof (dsi_func); i++)
        {
+         unsigned long this_in2i = in2i;
+
          /* Don't divide by 0.  */
-         if (strcmp (dsi_func_names[i], "mpf_div_ui") == 0 && in2i == 0)
+         if (dsi_funcs[i] == mpf_div_ui && this_in2i == 0)
            continue;
 
-         (dsi_funcs[i]) (res1, in1, in2i);
+         /* Avoid overflow/underflow in the exponent.  */
+         if (dsi_funcs[i] == mpf_mul_2exp || dsi_funcs[i] == mpf_div_2exp)
+           this_in2i %= 0x100000;
+         else if (dsi_funcs[i] == mpf_pow_ui)
+           this_in2i %= 0x1000;
+
+         (dsi_funcs[i]) (res1, in1, this_in2i);
 
          mpf_set (out1, in1);
-         (dsi_funcs[i]) (out1, out1, in2i);
+         (dsi_funcs[i]) (out1, out1, this_in2i);
          mpf_set (res2, out1);
 
          if (mpf_cmp (res1, res2) != 0)
@@ -166,7 +174,7 @@ main (int argc, char **argv)
       for (i = 0; i < sizeof (dis_funcs) / sizeof (dis_func); i++)
        {
          /* Don't divide by 0.  */
-         if (strcmp (dis_func_names[i], "mpf_ui_div") == 0
+         if (dis_funcs[i] == mpf_ui_div
              && mpf_cmp_ui (in2, 0) == 0)
            continue;
 
index bb19de813e9c30d37a48a9f86996362ac754de0d..dacc6382e44d3c4456c81c1880011c8f0dedfceb 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index dd3920e3710f3261faf5e3878ccc207651c6e5a9..a1cbbadb17201f04b5a4f932f9be96755099fc59 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index e328541b71513419057eab23a9fee979e5435424..3bf016ff28307af494d41d96d41f5c4aed9d3225 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 74ddb7c6d65054f8a7e6808f78cc3827cfd31c8e..3b4786606116bc64a3888bdd1dca0d772602a0ef 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 00fd76e0989eea6fed834b8c55658d2e9b1787e0..2f34eabaca2aff51407e493bd4479a3d5ba45e8a 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index e6a09d9001123ec07e22893b3333af4e1d856431..90e4c18f16553a134cd163b3f7d7877ac9c5c082 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 8e645b690a340f04cfd8102fdc7db6661c149e7b..359fec9316a0eb07b3a8d1906adb3f28164ee468 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -86,7 +86,7 @@ check_data (void)
 
       if (got != got_swapped || got != data[i].want)
        {
-         printf ("check_data() wrong reault at data[%d]\n", i);
+         printf ("check_data() wrong result at data[%d]\n", i);
          mpf_trace ("x   ", x);
          mpf_trace ("y   ", y);
          printf ("got         %d\n", got);
index 0f473c90e6b4a1ca1be5fd1d667f0294d51643ee..4b0e7c56ba3ec3fbc18aaece9638d275b57c26d4 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mpf_fits_*_p
 
-Copyright 2001, 2002 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2013 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -205,7 +205,7 @@ main (void)
 
   mpf_set_si (f, (long) SHRT_MIN);
   mpf_sub_ui (f, f, 1L);
-  expr = "SHRT_MIN + 1";
+  expr = "SHRT_MIN - 1";
   EXPECT (mpf_fits_sshort_p, 0);
 
 
@@ -222,7 +222,7 @@ main (void)
 
   mpf_set_si (f, (long) INT_MIN);
   mpf_sub_ui (f, f, 1L);
-  expr = "INT_MIN + 1";
+  expr = "INT_MIN - 1";
   EXPECT (mpf_fits_sint_p, 0);
 
 
@@ -237,7 +237,7 @@ main (void)
 
   mpf_set_si (f, LONG_MIN);
   mpf_sub_ui (f, f, 1L);
-  expr = "LONG_MIN + 1";
+  expr = "LONG_MIN - 1";
   EXPECT (mpf_fits_slong_p, 0);
 
 
@@ -252,6 +252,15 @@ main (void)
 
   mpf_set_str_or_abort (f, "-0.5", 10);
   expr = "-0.5";
+  EXPECT (mpf_fits_ulong_p, 1);
+  EXPECT (mpf_fits_uint_p, 1);
+  EXPECT (mpf_fits_ushort_p, 1);
+  EXPECT (mpf_fits_slong_p, 1);
+  EXPECT (mpf_fits_sint_p, 1);
+  EXPECT (mpf_fits_sshort_p, 1);
+
+  mpf_set_str_or_abort (f, "-1.5", 10);
+  expr = "-1.5";
   EXPECT (mpf_fits_ulong_p, 0);
   EXPECT (mpf_fits_uint_p, 0);
   EXPECT (mpf_fits_ushort_p, 0);
index c86a87a18ce05144fdae47aad71319f12e67e9bc..66b9623f9057cd6f27255af4469af5eaaf211e1a 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mpf_get_d and mpf_set_d.
 
-Copyright 1996, 1999, 2000, 2001, 2009 Free Software Foundation, Inc.
+Copyright 1996, 1999-2001, 2009 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 8de1bbbeea53d122bbda81ee1afb9294d85dbaf2..891e51d5a5cef97ac651859892aa0729a043f491 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 785d22bb5608fafedecf750a5b506720c23da947..80362616d7152dc2d110ff25983b2d8bbe910020 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 1a4428ab55f130dfe2c1c39408f69f0d016e0822..2950cadaa51c94a775fc164f262d3f897fe3b910 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index cb5df4fc7af98c031f33fcd51a1a4cce0b9f9b3b..5a7615fc261e37a1a597ac18f43929a8cbb8e69d 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 72d9b1553dd89e4b2781c357e75d161cb104dd47..38b54e6a0da05f3ce7f9c9e2d4059cab42f1bcc4 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index c9b6ee0b9257f5e9cdc0381774a4ce43ebea4e1a..ea07668a1dfb73f8d60224af59560462289ea591 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 41cf5e7d14d69505cebd01d1f45b76d866016c1c..6a25c794777bdb0e89b759237de5b72e3b6b4f42 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 10762c92234930e5932f681d2905f8c26d286f5d..2751bb9dad99f136f2ce0efdcdb53f99ff6ebab4 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 21013a4c40272f812770acda0b0351472bbaf18e..3846d501a1cbbfa8cd7427032b286c5040886538 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 56eb75e072b30b0fcb88db53b2fe514eb3abe466..2c48b277da1685554cb8f03acef9d47469808038 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index e89d6c5a49843494d1d3f2395df9bb99c5b095c3..8975be7bedb825347bc4570ac510a9a8b39360d7 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index c931228f8596afd6460b57d4ec700468d8383a82..8c49e91e67994d0856eab516b606f309d72ace4d 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index fb1b85bb69b37da94aeb5d4060fb43381d176b33..16a823d9a4de59310d52cd23f2d71caf9e3f236d 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 0e19a44a400d5ffa083c1f57201be4ef76c6c937..c9233da29ce54dc6af0d2173f7093dd60cfa0d00 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 8cd1e2c1ba6284c51e48ea35c1b92e67027dfa8e..66281f424320f7e7ac98882fad31846d3d3beddf 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -179,7 +179,7 @@ check_data (void)
 
           if (mpf_cmp (got, want) != 0)
             {
-              printf ("check_data() wrong reault at data[%d] (operands%s swapped)\n", i, swap ? "" : " not");
+              printf ("check_data() wrong result at data[%d] (operands%s swapped)\n", i, swap ? "" : " not");
               mpf_trace ("x   ", x);
               mpf_trace ("y   ", y);
               mpf_trace ("got ", got);
index 0a23b63ab71ae05e3f6655d2cd8d3e3784afaabc..2eef414b00d3428ed2129f1ce13cf89c2513d66b 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index e23f91d8f197061c814156aab7b8b07cedd6fe17..3024efdbc424057ebaacd1ab566b828dcb465594 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index d0541e33e50325dd72d4222ed092112607fe8ec4..180c58692c6c1b3edb42dc82a16157dd9b663c02 100644 (file)
@@ -1,7 +1,6 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 2001, 2002, 2003, 2009, 2010, 2011, 2012 Free Software Foundation,
-# Inc.
+# Copyright 2001-2003, 2009-2014 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
@@ -16,7 +15,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 
 
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
@@ -29,7 +28,7 @@ check_PROGRAMS = t-asmtype t-aors_1 t-divrem_1 t-mod_1 t-fat t-get_d  \
   t-toom2-sqr t-toom3-sqr t-toom4-sqr t-toom6-sqr t-toom8-sqr          \
   t-mul t-mullo t-mulmod_bnm1 t-sqrmod_bnm1 t-mulmid                   \
   t-hgcd t-hgcd_appr t-matrix22 t-invert t-div t-bdiv                  \
-  t-broot t-brootinv
+  t-broot t-brootinv t-minvert t-sizeinbase
 
 EXTRA_DIST = toom-shared.h toom-sqr-shared.h
 
index 71ee9b1d1b259f4feae12f98ad38d2c8c49c20aa..5db22d4f0c8932edc1c13dbcf29bf5cd30190a6f 100644 (file)
@@ -15,8 +15,7 @@
 
 @SET_MAKE@
 
-# Copyright 2001, 2002, 2003, 2009, 2010, 2011, 2012 Free Software Foundation,
-# Inc.
+# Copyright 2001-2003, 2009-2014 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
@@ -31,7 +30,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 VPATH = @srcdir@
 am__make_dryrun = \
   { \
@@ -82,7 +81,8 @@ check_PROGRAMS = t-asmtype$(EXEEXT) t-aors_1$(EXEEXT) \
        t-mulmod_bnm1$(EXEEXT) t-sqrmod_bnm1$(EXEEXT) \
        t-mulmid$(EXEEXT) t-hgcd$(EXEEXT) t-hgcd_appr$(EXEEXT) \
        t-matrix22$(EXEEXT) t-invert$(EXEEXT) t-div$(EXEEXT) \
-       t-bdiv$(EXEEXT) t-broot$(EXEEXT) t-brootinv$(EXEEXT)
+       t-bdiv$(EXEEXT) t-broot$(EXEEXT) t-brootinv$(EXEEXT) \
+       t-minvert$(EXEEXT) t-sizeinbase$(EXEEXT)
 subdir = tests/mpn
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -174,6 +174,11 @@ t_matrix22_OBJECTS = t-matrix22.$(OBJEXT)
 t_matrix22_LDADD = $(LDADD)
 t_matrix22_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
        $(top_builddir)/libgmp.la
+t_minvert_SOURCES = t-minvert.c
+t_minvert_OBJECTS = t-minvert.$(OBJEXT)
+t_minvert_LDADD = $(LDADD)
+t_minvert_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+       $(top_builddir)/libgmp.la
 t_mod_1_SOURCES = t-mod_1.c
 t_mod_1_OBJECTS = t-mod_1.$(OBJEXT)
 t_mod_1_LDADD = $(LDADD)
@@ -214,6 +219,11 @@ t_scan_OBJECTS = t-scan.$(OBJEXT)
 t_scan_LDADD = $(LDADD)
 t_scan_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
        $(top_builddir)/libgmp.la
+t_sizeinbase_SOURCES = t-sizeinbase.c
+t_sizeinbase_OBJECTS = t-sizeinbase.$(OBJEXT)
+t_sizeinbase_LDADD = $(LDADD)
+t_sizeinbase_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+       $(top_builddir)/libgmp.la
 t_sqrmod_bnm1_SOURCES = t-sqrmod_bnm1.c
 t_sqrmod_bnm1_OBJECTS = t-sqrmod_bnm1.$(OBJEXT)
 t_sqrmod_bnm1_LDADD = $(LDADD)
@@ -324,21 +334,23 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 SOURCES = logic.c t-aors_1.c t-asmtype.c t-bdiv.c t-broot.c \
        t-brootinv.c t-div.c t-divrem_1.c t-fat.c t-get_d.c t-hgcd.c \
        t-hgcd_appr.c t-instrument.c t-invert.c t-iord_u.c \
-       t-matrix22.c t-mod_1.c t-mp_bases.c t-mul.c t-mullo.c \
-       t-mulmid.c t-mulmod_bnm1.c t-perfsqr.c t-scan.c \
-       t-sqrmod_bnm1.c t-toom2-sqr.c t-toom22.c t-toom3-sqr.c \
-       t-toom32.c t-toom33.c t-toom4-sqr.c t-toom42.c t-toom43.c \
-       t-toom44.c t-toom52.c t-toom53.c t-toom54.c t-toom6-sqr.c \
-       t-toom62.c t-toom63.c t-toom6h.c t-toom8-sqr.c t-toom8h.c
+       t-matrix22.c t-minvert.c t-mod_1.c t-mp_bases.c t-mul.c \
+       t-mullo.c t-mulmid.c t-mulmod_bnm1.c t-perfsqr.c t-scan.c \
+       t-sizeinbase.c t-sqrmod_bnm1.c t-toom2-sqr.c t-toom22.c \
+       t-toom3-sqr.c t-toom32.c t-toom33.c t-toom4-sqr.c t-toom42.c \
+       t-toom43.c t-toom44.c t-toom52.c t-toom53.c t-toom54.c \
+       t-toom6-sqr.c t-toom62.c t-toom63.c t-toom6h.c t-toom8-sqr.c \
+       t-toom8h.c
 DIST_SOURCES = logic.c t-aors_1.c t-asmtype.c t-bdiv.c t-broot.c \
        t-brootinv.c t-div.c t-divrem_1.c t-fat.c t-get_d.c t-hgcd.c \
        t-hgcd_appr.c t-instrument.c t-invert.c t-iord_u.c \
-       t-matrix22.c t-mod_1.c t-mp_bases.c t-mul.c t-mullo.c \
-       t-mulmid.c t-mulmod_bnm1.c t-perfsqr.c t-scan.c \
-       t-sqrmod_bnm1.c t-toom2-sqr.c t-toom22.c t-toom3-sqr.c \
-       t-toom32.c t-toom33.c t-toom4-sqr.c t-toom42.c t-toom43.c \
-       t-toom44.c t-toom52.c t-toom53.c t-toom54.c t-toom6-sqr.c \
-       t-toom62.c t-toom63.c t-toom6h.c t-toom8-sqr.c t-toom8h.c
+       t-matrix22.c t-minvert.c t-mod_1.c t-mp_bases.c t-mul.c \
+       t-mullo.c t-mulmid.c t-mulmod_bnm1.c t-perfsqr.c t-scan.c \
+       t-sizeinbase.c t-sqrmod_bnm1.c t-toom2-sqr.c t-toom22.c \
+       t-toom3-sqr.c t-toom32.c t-toom33.c t-toom4-sqr.c t-toom42.c \
+       t-toom43.c t-toom44.c t-toom52.c t-toom53.c t-toom54.c \
+       t-toom6-sqr.c t-toom62.c t-toom63.c t-toom6h.c t-toom8-sqr.c \
+       t-toom8h.c
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -603,6 +615,9 @@ t-iord_u$(EXEEXT): $(t_iord_u_OBJECTS) $(t_iord_u_DEPENDENCIES) $(EXTRA_t_iord_u
 t-matrix22$(EXEEXT): $(t_matrix22_OBJECTS) $(t_matrix22_DEPENDENCIES) $(EXTRA_t_matrix22_DEPENDENCIES) 
        @rm -f t-matrix22$(EXEEXT)
        $(LINK) $(t_matrix22_OBJECTS) $(t_matrix22_LDADD) $(LIBS)
+t-minvert$(EXEEXT): $(t_minvert_OBJECTS) $(t_minvert_DEPENDENCIES) $(EXTRA_t_minvert_DEPENDENCIES) 
+       @rm -f t-minvert$(EXEEXT)
+       $(LINK) $(t_minvert_OBJECTS) $(t_minvert_LDADD) $(LIBS)
 t-mod_1$(EXEEXT): $(t_mod_1_OBJECTS) $(t_mod_1_DEPENDENCIES) $(EXTRA_t_mod_1_DEPENDENCIES) 
        @rm -f t-mod_1$(EXEEXT)
        $(LINK) $(t_mod_1_OBJECTS) $(t_mod_1_LDADD) $(LIBS)
@@ -627,6 +642,9 @@ t-perfsqr$(EXEEXT): $(t_perfsqr_OBJECTS) $(t_perfsqr_DEPENDENCIES) $(EXTRA_t_per
 t-scan$(EXEEXT): $(t_scan_OBJECTS) $(t_scan_DEPENDENCIES) $(EXTRA_t_scan_DEPENDENCIES) 
        @rm -f t-scan$(EXEEXT)
        $(LINK) $(t_scan_OBJECTS) $(t_scan_LDADD) $(LIBS)
+t-sizeinbase$(EXEEXT): $(t_sizeinbase_OBJECTS) $(t_sizeinbase_DEPENDENCIES) $(EXTRA_t_sizeinbase_DEPENDENCIES) 
+       @rm -f t-sizeinbase$(EXEEXT)
+       $(LINK) $(t_sizeinbase_OBJECTS) $(t_sizeinbase_LDADD) $(LIBS)
 t-sqrmod_bnm1$(EXEEXT): $(t_sqrmod_bnm1_OBJECTS) $(t_sqrmod_bnm1_DEPENDENCIES) $(EXTRA_t_sqrmod_bnm1_DEPENDENCIES) 
        @rm -f t-sqrmod_bnm1$(EXEEXT)
        $(LINK) $(t_sqrmod_bnm1_OBJECTS) $(t_sqrmod_bnm1_LDADD) $(LIBS)
index 3077a75d88d0b6785c342a2abbd34264887ce62a..75b5dca1fc6456bf249de6365947f2537091038e 100644 (file)
@@ -1,7 +1,7 @@
 /* Test mpn_and, mpn_ior, mpn_xor, mpn_andn, mpn_iorn, mpn_xnor, mpn_nand, and
    mpn_nior.
 
-Copyright 2011, 2012, 2013 Free Software Foundation, Inc.
+Copyright 2011-2013 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdlib.h>
@@ -57,8 +57,9 @@ check_one (mp_srcptr refp, mp_srcptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n
 int
 main (int argc, char **argv)
 {
+  mpz_t a, b;
   mp_ptr ap, bp, rp, refp;
-  mp_size_t max_n, n;
+  mp_size_t max_n, n, i;
   gmp_randstate_ptr rands;
   long test, reps = 1000;
   TMP_SDECL;
@@ -67,21 +68,26 @@ main (int argc, char **argv)
   tests_start ();
   TESTS_REPS (reps, argv, argc);
 
-  rands = RANDS;
+  mpz_inits (a, b, NULL);
 
-  max_n = 32;
+  rands = RANDS;               /* FIXME: not used */
 
-  ap = TMP_SALLOC_LIMBS (max_n);
-  bp = TMP_SALLOC_LIMBS (max_n);
-  rp = TMP_SALLOC_LIMBS (max_n);
-  refp = TMP_SALLOC_LIMBS (max_n);
+  max_n = 100;
+
+  rp = TMP_SALLOC_LIMBS (1 + max_n * 8 / GMP_LIMB_BITS);
+  refp = TMP_SALLOC_LIMBS (1 + max_n * 8 / GMP_LIMB_BITS);
 
   for (test = 0; test < reps; test++)
     {
-      for (n = 1; n <= max_n; n++)
+      for (i = 1; i <= max_n; i++)
        {
-         mpn_random2 (ap, n);
-         mpn_random2 (bp, n);
+         mpz_rrandomb (a, rands, i * 8);
+         mpz_rrandomb (b, rands, i * 8);
+         mpz_setbit (a, i * 8 - 1);
+         mpz_setbit (b, i * 8 - 1);
+         ap = PTR(a);
+         bp = PTR(b);
+         n = SIZ(a);
 
          refmpn_and_n (refp, ap, bp, n);
          mpn_and_n (rp, ap, bp, n);
@@ -122,6 +128,7 @@ main (int argc, char **argv)
     }
 
   TMP_SFREE;
+  mpz_clears (a, b, NULL);
   tests_end ();
   return 0;
 }
index 422f9c40e166bc754b906e99b578a902f76d0c89..6a946f2d572aa2adba26a450ce7e7e107d13fc24 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -133,6 +133,8 @@ check_add_1 (void)
 
   mp_limb_t  got[ASIZE];
   mp_limb_t  got_c;
+  /* mpn_sec_add_a_itch(n) <= n */
+  mp_limb_t  scratch[ASIZE];
   int        i;
 
   for (i = 0; i < numberof (data); i++)
@@ -145,6 +147,16 @@ check_add_1 (void)
       got_c = mpn_add_1 (got, got, data[i].size, data[i].n);
       VERIFY ("check_add_1 (in-place)");
 
+      SETUP ();
+      scratch [mpn_sec_add_1_itch(data[i].size)] = MAGIC;
+      got_c = mpn_sec_add_1 (got, data[i].src, data[i].size, data[i].n, scratch);
+      got_c ^= scratch [mpn_sec_add_1_itch(data[i].size)] ^ MAGIC;
+      VERIFY ("check_sec_add_1 (separate)");
+
+      SETUP_INPLACE ();
+      got_c = mpn_sec_add_1 (got, got, data[i].size, data[i].n, scratch);
+      VERIFY ("check_sec_add_1 (in-place)");
+
       if (data[i].n == 1)
         {
           SETUP ();
@@ -154,6 +166,16 @@ check_add_1 (void)
           SETUP_INPLACE ();
           got_c = mpn_add_1 (got, got, data[i].size, CNST_LIMB(1));
           VERIFY ("check_add_1 (in-place, const 1)");
+
+          SETUP ();
+          got_c = mpn_sec_add_1 (got, data[i].src, data[i].size,
+                                CNST_LIMB(1), scratch);
+          VERIFY ("check_sec_add_1 (separate, const 1)");
+
+          SETUP_INPLACE ();
+          got_c = mpn_sec_add_1 (got, got, data[i].size,
+                                CNST_LIMB(1), scratch);
+          VERIFY ("check_sec_add_1 (in-place, const 1)");
         }
 
       /* Same again on functions, not inlines. */
@@ -212,6 +234,8 @@ check_sub_1 (void)
 
   mp_limb_t  got[ASIZE];
   mp_limb_t  got_c;
+  /* mpn_sec_sub_1_itch(n) <= n */
+  mp_limb_t  scratch[ASIZE];
   int        i;
 
   for (i = 0; i < numberof (data); i++)
@@ -224,6 +248,16 @@ check_sub_1 (void)
       got_c = mpn_sub_1 (got, got, data[i].size, data[i].n);
       VERIFY ("check_sub_1 (in-place)");
 
+      SETUP ();
+      scratch [mpn_sec_sub_1_itch(data[i].size)] = MAGIC;
+      got_c = mpn_sec_sub_1 (got, data[i].src, data[i].size, data[i].n, scratch);
+      got_c ^= scratch [mpn_sec_sub_1_itch(data[i].size)] ^ MAGIC;
+      VERIFY ("check_sec_sub_1 (separate)");
+
+      SETUP_INPLACE ();
+      got_c = mpn_sec_sub_1 (got, got, data[i].size, data[i].n, scratch);
+      VERIFY ("check_sec_sub_1 (in-place)");
+
       if (data[i].n == 1)
         {
           SETUP ();
@@ -233,6 +267,16 @@ check_sub_1 (void)
           SETUP_INPLACE ();
           got_c = mpn_sub_1 (got, got, data[i].size, CNST_LIMB(1));
           VERIFY ("check_sub_1 (in-place, const 1)");
+
+          SETUP ();
+          got_c = mpn_sec_sub_1 (got, data[i].src, data[i].size,
+                                CNST_LIMB(1), scratch);
+          VERIFY ("check_sec_sub_1 (separate, const 1)");
+
+          SETUP_INPLACE ();
+          got_c = mpn_sec_sub_1 (got, got, data[i].size,
+                                CNST_LIMB(1), scratch);
+          VERIFY ("check_sec_sub_1 (in-place, const 1)");
         }
 
       /* Same again on functions, not inlines. */
index 56444fb6c6ac843a5a4946d6cb54eb268b4c9198..93960f7aef11cecda15ca976434d79247644433e 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 0feca7e3d604562362af6304abbba37b2e7b6f19..0056ca9e383009024123c5f5473e23f5ea9c69d5 100644 (file)
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdlib.h>            /* for strtol */
index beb99733a51e29e0b9697140948c3bc63c86ae4d..1aa43319eca798e0c6d5e6538c6101671368b32c 100644 (file)
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdlib.h>            /* for strtol */
index 78b25151e646ca5e7ed049a9047459494c063026..11f40b9543d70f98727aa50f1115b38de742b6c5 100644 (file)
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdlib.h>            /* for strtol */
@@ -63,7 +63,6 @@ main (int argc, char **argv)
     {
       mp_size_t n;
       mp_limb_t k;
-      int c;
 
       n = 1 + gmp_urandomm_ui (rands, MAX_LIMBS);
 
index a497244560d2fe9a54942b6189b59b4a25551d18..9dbe0f8185ac6c8cccb43e343f4aee8abcb98d4f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright 2006, 2007, 2009, 2010, 2013 Free Software Foundation, Inc.
+/* Copyright 2006, 2007, 2009, 2010, 2013, 2014 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdlib.h>            /* for strtol */
@@ -122,21 +122,6 @@ check_one (mp_ptr qp, mp_srcptr rp,
 
 #define COUNT 200
 
-mp_limb_t
-random_word (gmp_randstate_ptr rs)
-{
-  mpz_t x;
-  mp_limb_t r;
-  TMP_DECL;
-  TMP_MARK;
-
-  MPZ_TMP_INIT (x, 2);
-  mpz_urandomb (x, rs, 32);
-  r = mpz_get_ui (x);
-  TMP_FREE;
-  return r;
-}
-
 int
 main (int argc, char **argv)
 {
@@ -192,12 +177,12 @@ main (int argc, char **argv)
 
   for (test = -300; test < count; test++)
     {
-      nbits = random_word (rands) % (maxnbits - GMP_NUMB_BITS) + 2 * GMP_NUMB_BITS;
+      nbits = urandom () % (maxnbits - GMP_NUMB_BITS) + 2 * GMP_NUMB_BITS;
 
       if (test < 0)
        dbits = (test + 300) % (nbits - 1) + 1;
       else
-       dbits = random_word (rands) % (nbits - 1) % maxdbits + 1;
+       dbits = urandom () % (nbits - 1) % maxdbits + 1;
 
 #if RAND_UNIFORM
 #define RANDFUNC mpz_urandomb
@@ -223,8 +208,8 @@ main (int argc, char **argv)
        {
          do
            {
-             RANDFUNC (q, rands, random_word (rands) % (nbits - dbits + 1));
-             RANDFUNC (r, rands, random_word (rands) % mpz_sizeinbase (d, 2));
+             RANDFUNC (q, rands, urandom () % (nbits - dbits + 1));
+             RANDFUNC (r, rands, urandom () % mpz_sizeinbase (d, 2));
              mpz_mul (n, q, d);
              mpz_add (n, n, r);
              nn = SIZ (n);
@@ -252,31 +237,31 @@ main (int argc, char **argv)
       switch ((int) t % 16)
        {
        case 0:
-         clearn = random_word (rands) % nn;
+         clearn = urandom () % nn;
          for (i = clearn; i < nn; i++)
            np[i] = 0;
          break;
        case 1:
-         mpn_sub_1 (np + nn - dn, dnp, dn, random_word (rands));
+         mpn_sub_1 (np + nn - dn, dnp, dn, urandom ());
          break;
        case 2:
-         mpn_add_1 (np + nn - dn, dnp, dn, random_word (rands));
+         mpn_add_1 (np + nn - dn, dnp, dn, urandom ());
          break;
        }
 
       if (dn >= 2)
        invert_pi1 (dinv, dnp[dn - 1], dnp[dn - 2]);
 
-      rran0 = random_word (rands);
-      rran1 = random_word (rands);
-      qran0 = random_word (rands);
-      qran1 = random_word (rands);
+      rran0 = urandom ();
+      rran1 = urandom ();
+      qran0 = urandom ();
+      qran1 = urandom ();
 
       qp[-1] = qran0;
       qp[nn - dn + 1] = qran1;
       rp[-1] = rran0;
 
-      ran = random_word (rands);
+      ran = urandom ();
 
       if ((double) (nn - dn) * dn < 1e5)
        {
@@ -310,8 +295,8 @@ main (int argc, char **argv)
              check_one (qp, NULL, np, nn, dnp, dn, "mpn_sbpi1_div_q", 0);
            }
 
-         /* Test mpn_sb_div_qr_sec */
-         itch = 3 * nn + 4;
+         /* Test mpn_sec_div_qr */
+         itch = mpn_sec_div_qr_itch (nn, dn);
          if (itch + 1 > alloc)
            {
              scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
@@ -321,12 +306,12 @@ main (int argc, char **argv)
          MPN_COPY (rp, np, nn);
          if (nn >= dn)
            MPN_COPY (qp, junkp, nn - dn + 1);
-         mpn_sb_div_qr_sec (qp, rp, nn, dup, dn, scratch);
+         qp[nn - dn] = mpn_sec_div_qr (qp, rp, nn, dup, dn, scratch);
          ASSERT_ALWAYS (ran == scratch[itch]);
-         check_one (qp, rp, np, nn, dup, dn, "mpn_sb_div_qr_sec", 0);
+         check_one (qp, rp, np, nn, dup, dn, "mpn_sec_div_qr (unnorm)", 0);
 
-         /* Test mpn_sb_div_r_sec */
-         itch = nn + 2 * dn + 2;
+         /* Test mpn_sec_div_r */
+         itch = mpn_sec_div_r_itch (nn, dn);
          if (itch + 1 > alloc)
            {
              scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
@@ -334,11 +319,32 @@ main (int argc, char **argv)
            }
          scratch[itch] = ran;
          MPN_COPY (rp, np, nn);
-         mpn_sb_div_r_sec (rp, nn, dup, dn, scratch);
+         mpn_sec_div_r (rp, nn, dup, dn, scratch);
          ASSERT_ALWAYS (ran == scratch[itch]);
-         /* Note: Since check_one cannot cope with random-only functions, we
-            pass qp[] from the previous function, mpn_sb_div_qr_sec.  */
-         check_one (qp, rp, np, nn, dup, dn, "mpn_sb_div_r_sec", 0);
+         /* Note: Since check_one cannot cope with remainder-only functions, we
+            pass qp[] from the previous function, mpn_sec_div_qr.  */
+         check_one (qp, rp, np, nn, dup, dn, "mpn_sec_div_r (unnorm)", 0);
+
+         /* Normalised case, mpn_sec_div_qr */
+         itch = mpn_sec_div_qr_itch (nn, dn);
+         scratch[itch] = ran;
+
+         MPN_COPY (rp, np, nn);
+         if (nn >= dn)
+           MPN_COPY (qp, junkp, nn - dn + 1);
+         qp[nn - dn] = mpn_sec_div_qr (qp, rp, nn, dnp, dn, scratch);
+         ASSERT_ALWAYS (ran == scratch[itch]);
+         check_one (qp, rp, np, nn, dnp, dn, "mpn_sec_div_qr (norm)", 0);
+
+         /* Normalised case, mpn_sec_div_r */
+         itch = mpn_sec_div_r_itch (nn, dn);
+         scratch[itch] = ran;
+         MPN_COPY (rp, np, nn);
+         mpn_sec_div_r (rp, nn, dnp, dn, scratch);
+         ASSERT_ALWAYS (ran == scratch[itch]);
+         /* Note: Since check_one cannot cope with remainder-only functions, we
+            pass qp[] from the previous function, mpn_sec_div_qr.  */
+         check_one (qp, rp, np, nn, dnp, dn, "mpn_sec_div_r (norm)", 0);
        }
 
       /* Test mpn_dcpi1_div_qr */
@@ -471,6 +477,16 @@ main (int argc, char **argv)
          qp[nn - 2] = qh;
          check_one (qp, rp, np, nn, dup + dn - 2, 2, "mpn_div_qr_2", 0);
        }
+      if (dn >= 1 && nn >= 1)
+       {
+         /* mpn_div_qr_1 */
+         mp_limb_t qh;
+         qp[nn-1] = qran1;
+         rp[0] = mpn_div_qr_1 (qp, &qh, np, nn, dnp[dn - 1]);
+         ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - 1] == qran1);
+         qp[nn - 1] = qh;
+         check_one (qp, rp, np, nn,  dnp + dn - 1, 1, "mpn_div_qr_1", 0);
+       }
     }
 
   __GMP_FREE_FUNC_LIMBS (scratch, alloc);
index 745b177df5e41d6a407ca0ec0fccbcce91abb3f9..9ffe90548f8c11bc02c1061a7d44f3aeb3a8aaa5 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index fd71e891e7c9e048923f340a85c40b6a57c296f0..abb288e4b003ed1224cc3770f715020b1c1d6f20 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index a98472fad8bb7ce8c479f7e34c1c8705f5840632..1499391e0671ee8239becbf2d84869824c545c74 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mpn_get_d.
 
-Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright 2002-2004 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,13 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
-
-/* Note that we don't use <limits.h> for LONG_MIN, but instead our own
-   definition in gmp-impl.h.  In gcc 2.95.4 (debian 3.0) under
-   -mcpu=ultrasparc, limits.h sees __sparc_v9__ defined and assumes that
-   means long is 64-bit long, but it's only 32-bits, causing fatal compile
-   errors.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 99357eb5611e1771e2b8735f44a1922a2f33e759..64d33ef0061ce3437265b68f077c813194bd632e 100644 (file)
@@ -1,7 +1,7 @@
 /* Test mpn_hgcd.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2003, 2004 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2004 Free Software Foundation,
+Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 186dfabe2ab9c42bcabf30ed48bff79ec95fe396..23ffbf0b768ccc230de0bd0654d00dacf9ad1e96 100644 (file)
@@ -1,7 +1,7 @@
 /* Test mpn_hgcd_appr.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2011 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2004, 2011 Free Software
+Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -157,9 +157,6 @@ debug_mp (mpz_t x, int base)
   mpz_out_str (stderr, base, x); fputc ('\n', stderr);
 }
 
-static int
-mpz_mpn_equal (const mpz_t a, mp_srcptr bp, mp_size_t bsize);
-
 static mp_size_t
 one_test (mpz_t a, mpz_t b, int i)
 {
@@ -383,16 +380,6 @@ hgcd_ref (struct hgcd_ref *hgcd, mpz_t a, mpz_t b)
   return 1;
 }
 
-static int
-mpz_mpn_equal (const mpz_t a, mp_srcptr bp, mp_size_t bsize)
-{
-  mp_srcptr ap = a->_mp_d;
-  mp_size_t asize = a->_mp_size;
-
-  MPN_NORMALIZE (bp, bsize);
-  return asize == bsize && mpn_cmp (ap, bp, asize) == 0;
-}
-
 static int
 hgcd_ref_equal (const struct hgcd_ref *A, const struct hgcd_ref *B)
 {
@@ -525,7 +512,7 @@ hgcd_appr_valid_p (mpz_t a, mpz_t b, mp_size_t res0,
     fprintf (stderr, "n = %u: sbits = %u: ref #(r0-r1): %u, appr #(r0-r1): %u excess: %d, margin: %u\n",
             (unsigned) n, (unsigned) s*GMP_NUMB_BITS,
             (unsigned) dbits, (unsigned) abits,
-            (int) abits - s * GMP_NUMB_BITS, (unsigned) margin);
+            (int) (abits - s * GMP_NUMB_BITS), (unsigned) margin);
 
   if (abits > s*GMP_NUMB_BITS + margin)
     {
index cf0aae1542c857427caf8e5066d51ece75aab10f..338fef17736126ace3d7c1af0426e616c2d0b2f0 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 0bd8d102a4f4ceb04448d6f4712fe9076d150545..c9b0080b7648969f20e56867ae744488208741db 100644 (file)
@@ -17,7 +17,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdlib.h>
@@ -59,7 +59,7 @@ invert_valid (mp_srcptr ip, mp_srcptr dp, mp_size_t n)
 }
 
 /*
-  Chech the result of the mpn_invert function in the library.
+  Check the result of the mpn_invert function in the library.
 */
 
 int
index 17188d272a3e644a4a30c28614ac5e2ee2a53be9..93e68c5c3fbccb7beb1c892a606180c16aad1de2 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 44832e4e7d47bb39dd05c11936064790be2bb187..e63cbe27bb86d657787579765b7fc8b4dc032b59 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tests/mpn/t-minvert.c b/tests/mpn/t-minvert.c
new file mode 100644 (file)
index 0000000..ade61a1
--- /dev/null
@@ -0,0 +1,179 @@
+/* Copyright 2013, 2014 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite 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 a copy of the GNU General Public License along with
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
+
+#include <stdio.h>
+#include <stdlib.h>            /* for strtol */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests/tests.h"
+
+#define MAX_SIZE 50
+
+#define COUNT 200
+
+static void
+mpz_to_mpn (mp_ptr ap, mp_size_t an, const mpz_t b)
+{
+  mp_size_t bn = mpz_size (b);
+  ASSERT_ALWAYS (bn <= an);
+  MPN_COPY_INCR (ap, mpz_limbs_read (b), bn);
+  MPN_ZERO (ap + bn, an - bn);
+}
+
+int
+mpz_eq_mpn (mp_ptr ap, mp_size_t an, const mpz_t b)
+{
+  mp_size_t bn = mpz_size (b);
+
+  return (bn >= 0 && bn <= an
+         && mpn_cmp (ap, mpz_limbs_read (b), bn) == 0
+         && mpn_zero_p (ap + bn, an - bn));
+}
+
+static mp_bitcnt_t
+bit_size (mp_srcptr xp, mp_size_t n)
+{
+  MPN_NORMALIZE (xp, n);
+  return n > 0 ? mpn_sizeinbase (xp, n, 2) : 0;
+}
+
+int
+main (int argc, char **argv)
+{
+  gmp_randstate_ptr rands;
+  long count = COUNT;
+  mp_ptr mp;
+  mp_ptr ap;
+  mp_ptr vp;
+  mp_ptr tp;
+  mp_ptr scratch;
+  mpz_t m, a, r, g;
+  int test;
+  mp_limb_t ran;
+  mp_size_t itch;
+  TMP_DECL;
+
+  tests_start ();
+  rands = RANDS;
+
+
+  TMP_MARK;
+  mpz_init (m);
+  mpz_init (a);
+  mpz_init (r);
+  mpz_init (g);
+
+  if (argc > 1)
+    {
+      char *end;
+      count = strtol (argv[1], &end, 0);
+      if (*end || count <= 0)
+       {
+         fprintf (stderr, "Invalid test count: %s.\n", argv[1]);
+         return 1;
+       }
+    }
+
+  mp = TMP_ALLOC_LIMBS (MAX_SIZE);
+  ap = TMP_ALLOC_LIMBS (MAX_SIZE);
+  vp = TMP_ALLOC_LIMBS (MAX_SIZE);
+  tp = TMP_ALLOC_LIMBS (MAX_SIZE);
+  scratch = TMP_ALLOC_LIMBS (mpn_sec_invert_itch (MAX_SIZE) + 1);
+
+  for (test = 0; test < count; test++)
+    {
+      mp_bitcnt_t bits;
+      int rres, tres;
+      mp_size_t n;
+
+      bits = urandom () % (GMP_NUMB_BITS * MAX_SIZE) + 1;
+
+      if (test & 1)
+       mpz_rrandomb (m, rands, bits);
+      else
+       mpz_urandomb (m, rands, bits);
+      if (test & 2)
+       mpz_rrandomb (a, rands, bits);
+      else
+       mpz_urandomb (a, rands, bits);
+
+      mpz_setbit (m, 0);
+      if (test & 4)
+       {
+         /* Ensure it really is invertible */
+         if (mpz_sgn (a) == 0)
+           mpz_set_ui (a, 1);
+         else
+           for (;;)
+             {
+               mpz_gcd (g, a, m);
+               if (mpz_cmp_ui (g, 1) == 0)
+                 break;
+               mpz_remove (a, a, g);
+             }
+       }
+
+      rres = mpz_invert (r, a, m);
+      if ( (test & 4) && !rres)
+       {
+         gmp_fprintf (stderr, "test %d: Not invertible!\n"
+                      "m = %Zd\n"
+                      "a = %Zd\n", test, m, a);
+         abort ();
+       }
+      ASSERT_ALWAYS (! (test & 4) || rres);
+
+      n = (bits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
+      ASSERT_ALWAYS (n <= MAX_SIZE);
+      itch = mpn_sec_invert_itch (n);
+      scratch[itch] = ran = urandom ();
+
+      mpz_to_mpn (ap, n, a);
+      mpz_to_mpn (mp, n, m);
+      tres = mpn_sec_invert (tp, ap, mp, n,
+                            bit_size (ap, n) + bit_size (mp, n),
+                            scratch);
+
+      if (rres != tres || (rres == 1 && !mpz_eq_mpn (tp, n, r)) || ran != scratch[itch])
+       {
+         gmp_fprintf (stderr, "Test %d failed.\n"
+                      "m = %Zd\n"
+                      "a = %Zd\n", test, m, a);
+         fprintf (stderr, "ref ret: %d\n"
+                 "got ret: %d\n", rres, tres);
+         if (rres)
+           gmp_fprintf (stderr, "ref: %Zd\n", r);
+         if (tres)
+           gmp_fprintf (stderr, "got: %Nd\n", tp, n);
+         if (ran != scratch[itch])
+           fprintf (stderr, "scratch[itch] changed.\n");
+         abort ();
+       }
+    }
+
+  TMP_FREE;
+
+  mpz_clear (m);
+  mpz_clear (a);
+  mpz_clear (r);
+  mpz_clear (g);
+
+  tests_end ();
+  return 0;
+}
index 100211a076ae98353f39b7b25bdc27dd0afe9b80..3d08a9018ff07fe5504c91f3d6df35525bc83c7f 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index c7863a0cc244adece1535f8e23f372b870ec40a2..c0b228825a89136603133814dbcde0299fa2c25d 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 63664ad55b46be63fd5086a1715ccc74fa04d813..26e4227334600f0ee09b335ac1baada06c0c3104 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdlib.h>
index 1a3172898b0b8ad2689e9ce8f86de492b3f30fd3..d4789976ac000988d7c65edd70331ef2b00dbb0c 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdlib.h>
index be29f77b4e41ac2abc1c5b6ddd2bdb0234b4a87f..8978c4c1fd8d2b38b212c6bcc52845c7e73379f6 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdlib.h>
@@ -78,7 +78,7 @@ main (int argc, char **argv)
       if (mpn_cmp (refp, rp, rn))
        {
          printf ("ERROR in test %d, an = %d, bn = %d, rn = %d\n",
-                 test, an, bn, rn);
+                 test, (int) an, (int) bn, (int) rn);
          printf("a: "); mpn_dump (ap, an);
          printf("b: "); mpn_dump (bp, bn);
          printf("r:   "); mpn_dump (rp, rn);
index 469a9eb4b07f69bfb214645af50320a0a7277f76..374b722c6b6cdd47413ba4fd8a2e0c41e2063991 100644 (file)
@@ -17,7 +17,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdlib.h>
index 0a585a0869422a2eecd5db0ab32aaa7730bc91ec..322ab6c3a4c878d85c18e07a18351fcf9edd3461 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index ba96846471513b49ba1e8eee034d7fcaeeeb7bc2..f4478af33535f9f39a00381c4e53cf64ab28687d 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tests/mpn/t-sizeinbase.c b/tests/mpn/t-sizeinbase.c
new file mode 100644 (file)
index 0000000..0887815
--- /dev/null
@@ -0,0 +1,108 @@
+/* Test for sizeinbase function.
+
+Copyright 2014 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite 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 a copy of the GNU General Public License along with
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "tests.h"
+
+/* Exponents up to 2^SIZE_LOG */
+#ifndef SIZE_LOG
+#define SIZE_LOG 13
+#endif
+
+#ifndef COUNT
+#define COUNT 30
+#endif
+
+#define MAX_N (1<<SIZE_LOG)
+
+int
+main (int argc, char **argv)
+{
+  mp_limb_t a;
+  mp_ptr pp, scratch;
+  mp_limb_t max_b;
+  int count = COUNT;
+  int test;
+  gmp_randstate_ptr rands;
+  TMP_DECL;
+
+  if (argc > 1)
+    {
+      char *end;
+      count = strtol (argv[1], &end, 0);
+      if (*end || count <= 0)
+       {
+         fprintf (stderr, "Invalid test count: %s.\n", argv[1]);
+         return 1;
+       }
+    }
+
+  tests_start ();
+  TMP_MARK;
+  rands = RANDS;
+
+  pp = TMP_ALLOC_LIMBS (MAX_N);
+  scratch = TMP_ALLOC_LIMBS (MAX_N);
+  max_b = numberof (mp_bases);
+
+  ASSERT_ALWAYS (max_b > 62);
+  ASSERT_ALWAYS (max_b < GMP_NUMB_MAX);
+
+  for (a = 2; a < max_b; ++a)
+    for (test = 0; test < count; ++test)
+      {
+       mp_size_t pn;
+       mp_limb_t exp;
+       mp_bitcnt_t res;
+
+       exp = gmp_urandomm_ui (rands, MAX_N);
+
+       pn = mpn_pow_1 (pp, &a, 1, exp, scratch);
+
+       res = mpn_sizeinbase (pp, pn, a) - 1;
+
+       if ((res < exp) || (res > exp + 1))
+         {
+           printf ("ERROR in test %d, base = %d, exp = %d, res = %d\n",
+                   test, (int) a, (int) exp, (int) res);
+           abort();
+         }
+
+       mpn_sub_1 (pp, pp, pn, CNST_LIMB(1));
+       pn -= pp[pn-1] == 0;
+
+       res = mpn_sizeinbase (pp, pn, a);
+
+       if ((res < exp) || (res - 1 > exp))
+         {
+           printf ("ERROR in -1 test %d, base = %d, exp = %d, res = %d\n",
+                   test, (int) a, (int) exp, (int) res);
+           abort();
+         }
+      }
+
+  TMP_FREE;
+  tests_end ();
+  return 0;
+}
index d3ee32a152f42eaa0fc683a6e2de15009ea7922a..47ccf81083bfb10dab371c4c837602ff879c15a6 100644 (file)
@@ -17,7 +17,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdlib.h>
index 479779f5c219f36d131f93246417c7fb1988f728..67d7a63d32f613523b484af0e0742e256738a3ed 100644 (file)
@@ -3,4 +3,6 @@
 #define MIN_AN MAX(SQR_TOOM3_THRESHOLD,MAX(SQR_TOOM4_THRESHOLD,MAX(SQR_TOOM6_THRESHOLD,MPN_TOOM6_SQR_MINSIZE)))
 #define MAX_AN SQR_TOOM8_THRESHOLD
 
+#define COUNT 250
+
 #include "toom-sqr-shared.h"
index 80df955d760707c53d6a70a1c6abbe71eb8d1646..0eee60592884a65fce8d490becaa6784f70a6145 100644 (file)
@@ -3,4 +3,6 @@
 #define MIN_AN MAX(SQR_TOOM3_THRESHOLD,MAX(SQR_TOOM4_THRESHOLD,MAX(SQR_TOOM6_THRESHOLD,MAX(SQR_TOOM8_THRESHOLD,MPN_TOOM8_SQR_MINSIZE))))
 #define MAX_AN SQR_FFT_THRESHOLD
 
+#define COUNT 250
+
 #include "toom-sqr-shared.h"
index a775f1fea3caec2da3b3ecd4402a5021206de74a..7479e7efd9ae9d4788b718f2ae212b7e1093c8bc 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdlib.h>
index f08838fd12b20b30524800a79da2540a8d21c8e2..944cfab00068de5af0e8104b89e99ecb8e986e5a 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdlib.h>
@@ -29,7 +29,7 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
  * MIN_AN, MAX_AN and then include this file. */
 
 #ifndef COUNT
-#define COUNT 500
+#define COUNT 2000
 #endif
 
 int
index e84f685da90ade53faad58965287323b8761acb0..ca8dfd9a708867961d1795ebf5a7d7aa8fb2ac5a 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 1996, 1999, 2000, 2001, 2002, 2012 Free Software Foundation, Inc.
+# Copyright 1996, 1999-2002, 2012 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
@@ -15,7 +15,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 
 
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
index 0edd0c490346acfaefbbf64207119dea99b7e790..89b3c1266fe2254ef2f16fdb6270561e36647451 100644 (file)
@@ -15,7 +15,7 @@
 
 @SET_MAKE@
 
-# Copyright 1996, 1999, 2000, 2001, 2002, 2012 Free Software Foundation, Inc.
+# Copyright 1996, 1999-2002, 2012 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
@@ -30,7 +30,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 VPATH = @srcdir@
 am__make_dryrun = \
   { \
index 404cbe9afa26a225dc05740613f345eac478107d..a1b718d2cf0958606c2712f9eaadc10922c0d1b5 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index a9bfb64f41ff9864f5f9116b342209eb6d8321d9..da60bde9403ec108566ea9ed75513faf3e11952f 100644 (file)
@@ -1,6 +1,6 @@
 /* Test that routines allow reusing a source variable as destination.
 
-Copyright 1996, 2000, 2001, 2002, 2012 Free Software Foundation, Inc.
+Copyright 1996, 2000-2002, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 97aeeb392636579ddabd0e0f164654cbe98a7ff3..a65f5d8ab88c18d5c1f7e0f52532df68c688e84b 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 9aaed6afd108eb77d28ad6546eb25e343b8c46d9..5858fa23c251b90a57bdc6f1b6a7750bbb258166 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -44,7 +44,7 @@ ref_mpq_cmp (mpq_t a, mpq_t b)
 }
 
 #ifndef SIZE
-#define SIZE 8 /* increasing this lowers the probabilty of finding an error */
+#define SIZE 8 /* increasing this lowers the probability of finding an error */
 #endif
 
 int
index d12bd19680fe317c7cee88ab08beb2ec705d1984..15252cc7ccfe23c91f1209be165e3e3fd45d5a4d 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index fec46c384b06563271093874851a702343090b93..9d2808393b333a81ee41b5be8827b28f6adff9c0 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -44,7 +44,7 @@ ref_mpq_cmp_ui (mpq_t a, unsigned long int bn, unsigned long int bd)
 }
 
 #ifndef SIZE
-#define SIZE 8 /* increasing this lowers the probabilty of finding an error */
+#define SIZE 8 /* increasing this lowers the probability of finding an error */
 #endif
 
 int
@@ -87,6 +87,18 @@ main (int argc, char **argv)
       mpq_canonicalize (a);
       mpq_canonicalize (b);
 
+      ccref = ref_mpq_cmp_ui (a, 1, 1);
+      cc = mpq_cmp_ui (a, 1, 1);
+
+      if (SGN (ccref) != SGN (cc))
+       abort ();
+
+      ccref = ref_mpq_cmp_ui (a, 0, 1);
+      cc = mpq_cmp_ui (a, 0, 1);
+
+      if (SGN (ccref) != SGN (cc))
+       abort ();
+
       bn = mpz_get_ui (NUM (b));
       bd = mpz_get_ui (DEN (b));
 
index 8d6d650e8e30e18940144db9b590c5a7a57c890c..4523dd8b1e2fedf778d904b2aa4bdae12d6c3d4e 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 484001eaa48e0b61ff37387263bdae012160d517..aa848e029c985f6fef059cd7f6999d5170c6da05 100644 (file)
@@ -1,7 +1,7 @@
 /* Test mpq_get_d and mpq_set_d
 
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002, 2003, 2012, 2013 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000-2003, 2012, 2013 Free Software
+Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 84325bbf65bfa0aec82fe767337331cd01566c56..c3c9dd6e912d639f785edda07f82878d5d06debc 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 699bc6747dd3daa6fe3f8a458142015a50bf138c..601cee3729f1084fc79d62423d12903f7e23db17 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 868eba28f26f5d23c2c5401b384eaf7b619c1245..1a0df8d72818ca58cce1eec7b143388e76cc3810 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index fb894dc33718791f1f53d2272f9935498b98f14b..c6e40285804bc3ea948fefd17d3ac0dd1a9947bd 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 3d0795acd8c6d5e937ab783d14d869bc9da63f7c..76f4a68df80cc27f77377fe333a4257b52e47d73 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index c3494f7883cacd0aa59152d3aa41101f85bb45ea..92cb9205a752b03abd3172794d96188a771b71b5 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index c1e11e7f7703a66a70f4a81911960b825c814296..8dc5721e0ae28064a16f7cfbaabc9472598d3c76 100644 (file)
@@ -1,7 +1,6 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2009, 2012 Free Software
-# Foundation, Inc.
+# Copyright 1996, 1997, 1999-2003, 2009, 2012 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
@@ -16,7 +15,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 
 
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
@@ -30,7 +29,7 @@ check_PROGRAMS = t-addsub t-cmp t-mul t-mul_i t-tdiv t-tdiv_ui t-fdiv   \
   t-fac_ui t-mfac_uiui t-primorial_ui t-fib_ui t-lucnum_ui t-scan t-fits   \
   t-divis t-divis_2exp t-cong t-cong_2exp t-sizeinbase t-set_str        \
   t-aorsmul t-cmp_d t-cmp_si t-hamdist t-oddeven t-popcount t-set_f     \
-  t-io_raw t-import t-export t-pprime_p t-nextprime t-remove
+  t-io_raw t-import t-export t-pprime_p t-nextprime t-remove t-limbs
 
 TESTS = $(check_PROGRAMS)
 
index 46a23827507a276dc315699da8943141aa83f3aa..ec96613ff382d3333b2c5810f1c5ff8f84d4e0e5 100644 (file)
@@ -15,8 +15,7 @@
 
 @SET_MAKE@
 
-# Copyright 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2009, 2012 Free Software
-# Foundation, Inc.
+# Copyright 1996, 1997, 1999-2003, 2009, 2012 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
@@ -31,7 +30,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 VPATH = @srcdir@
 am__make_dryrun = \
   { \
@@ -88,7 +87,7 @@ check_PROGRAMS = t-addsub$(EXEEXT) t-cmp$(EXEEXT) t-mul$(EXEEXT) \
        t-hamdist$(EXEEXT) t-oddeven$(EXEEXT) t-popcount$(EXEEXT) \
        t-set_f$(EXEEXT) t-io_raw$(EXEEXT) t-import$(EXEEXT) \
        t-export$(EXEEXT) t-pprime_p$(EXEEXT) t-nextprime$(EXEEXT) \
-       t-remove$(EXEEXT)
+       t-remove$(EXEEXT) t-limbs$(EXEEXT)
 subdir = tests/mpz
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -285,6 +284,11 @@ t_lcm_OBJECTS = t-lcm.$(OBJEXT)
 t_lcm_LDADD = $(LDADD)
 t_lcm_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
        $(top_builddir)/libgmp.la
+t_limbs_SOURCES = t-limbs.c
+t_limbs_OBJECTS = t-limbs.$(OBJEXT)
+t_limbs_LDADD = $(LDADD)
+t_limbs_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+       $(top_builddir)/libgmp.la
 t_lucnum_ui_SOURCES = t-lucnum_ui.c
 t_lucnum_ui_OBJECTS = t-lucnum_ui.$(OBJEXT)
 t_lucnum_ui_LDADD = $(LDADD)
@@ -428,7 +432,7 @@ SOURCES = bit.c convert.c dive.c dive_ui.c io.c logic.c reuse.c \
        t-divis_2exp.c t-export.c t-fac_ui.c t-fdiv.c t-fdiv_ui.c \
        t-fib_ui.c t-fits.c t-gcd.c t-gcd_ui.c t-get_d.c \
        t-get_d_2exp.c t-get_si.c t-hamdist.c t-import.c t-inp_str.c \
-       t-invert.c t-io_raw.c t-jac.c t-lcm.c t-lucnum_ui.c \
+       t-invert.c t-io_raw.c t-jac.c t-lcm.c t-limbs.c t-lucnum_ui.c \
        t-mfac_uiui.c t-mul.c t-mul_i.c t-nextprime.c t-oddeven.c \
        t-perfpow.c t-perfsqr.c t-popcount.c t-pow.c t-powm.c \
        t-powm_ui.c t-pprime_p.c t-primorial_ui.c t-remove.c t-root.c \
@@ -440,7 +444,7 @@ DIST_SOURCES = bit.c convert.c dive.c dive_ui.c io.c logic.c reuse.c \
        t-divis_2exp.c t-export.c t-fac_ui.c t-fdiv.c t-fdiv_ui.c \
        t-fib_ui.c t-fits.c t-gcd.c t-gcd_ui.c t-get_d.c \
        t-get_d_2exp.c t-get_si.c t-hamdist.c t-import.c t-inp_str.c \
-       t-invert.c t-io_raw.c t-jac.c t-lcm.c t-lucnum_ui.c \
+       t-invert.c t-io_raw.c t-jac.c t-lcm.c t-limbs.c t-lucnum_ui.c \
        t-mfac_uiui.c t-mul.c t-mul_i.c t-nextprime.c t-oddeven.c \
        t-perfpow.c t-perfsqr.c t-popcount.c t-pow.c t-powm.c \
        t-powm_ui.c t-pprime_p.c t-primorial_ui.c t-remove.c t-root.c \
@@ -777,6 +781,9 @@ t-jac$(EXEEXT): $(t_jac_OBJECTS) $(t_jac_DEPENDENCIES) $(EXTRA_t_jac_DEPENDENCIE
 t-lcm$(EXEEXT): $(t_lcm_OBJECTS) $(t_lcm_DEPENDENCIES) $(EXTRA_t_lcm_DEPENDENCIES) 
        @rm -f t-lcm$(EXEEXT)
        $(LINK) $(t_lcm_OBJECTS) $(t_lcm_LDADD) $(LIBS)
+t-limbs$(EXEEXT): $(t_limbs_OBJECTS) $(t_limbs_DEPENDENCIES) $(EXTRA_t_limbs_DEPENDENCIES) 
+       @rm -f t-limbs$(EXEEXT)
+       $(LINK) $(t_limbs_OBJECTS) $(t_limbs_LDADD) $(LIBS)
 t-lucnum_ui$(EXEEXT): $(t_lucnum_ui_OBJECTS) $(t_lucnum_ui_DEPENDENCIES) $(EXTRA_t_lucnum_ui_DEPENDENCIES) 
        @rm -f t-lucnum_ui$(EXEEXT)
        $(LINK) $(t_lucnum_ui_OBJECTS) $(t_lucnum_ui_LDADD) $(LIBS)
index c13cd1cec9e100235056e7ecf6728dd4d986b1fc..c42e9f0cc5ed5d410dccbd0e24736f2e8fe7ddbb 100644 (file)
@@ -1,7 +1,6 @@
 /* Test mpz_setbit, mpz_clrbit, mpz_tstbit.
 
-Copyright 1997, 2000, 2001, 2002, 2003, 2012, 2013 Free Software
-Foundation, Inc.
+Copyright 1997, 2000-2003, 2012, 2013 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 987fb237f05b6175d76f84b84f2037ba11af4182..ada6d11a1644283c2296e4ea7db835ca1bc0abc7 100644 (file)
@@ -1,7 +1,7 @@
 /* Test conversion using mpz_get_str and mpz_set_str.
 
-Copyright 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2006, 2007 Free Software
-Foundation, Inc.
+Copyright 1993, 1994, 1996, 1999-2002, 2006, 2007 Free Software Foundation,
+Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 1b9e8be8e341cfe94169c9fa968db011e442ef94..7970e718a07bf900d8cf0f4b4f4230c169b74ac1 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index de6a7922ca9f95259b233a1d655015283b01fec1..6771677f1f9e40a5568248fb2595f758bf902b0d 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 172ca66b967b41c86257539e4f85ce977d15f0e7..7674d69b1c3be49eaf637f0b61a0ab976940901b 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 04f396c8c9412d9b7cb417c69590f2508a23295d..d99cadc2bdb9cc6ba04dc6624262c6285b0fcada 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index dd33c0b06f6fe6ac5f98f3c66fbf17f96f3ca27e..4b67fbe38b144a80871876a666de3d6cb891450d 100644 (file)
@@ -6,8 +6,7 @@
        mpz_mul_si
        mpz_addmul_ui (should this really allow a+=a*c?)
 
-Copyright 1996, 1999, 2000, 2001, 2002, 2009, 2012, 2013 Free Software
-Foundation, Inc.
+Copyright 1996, 1999-2002, 2009, 2012, 2013 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -22,7 +21,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -469,7 +468,7 @@ main (int argc, char **argv)
            FAIL2 (mpz_rootrem, in1, in2, NULL);
        }
 
-      if (size_range < 18)     /* run fewer tests since gcdext lots of time */
+      if (size_range < 18)     /* run fewer tests since gcdext is slow */
        {
          mpz_gcdext (ref1, ref2, ref3, in1, in2);
          MPZ_CHECK_FORMAT (ref1);
index e19c21623deb27681604a322f14964539dff34a2..bf8984115023d0e1cd3208ec8096c45b21e0b64f 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 93573776c944f1d3f11f86f01215e3b30f392ca9..918725fdcb156fa7346dd12f1bd2aea851b01ce2 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdio.h>
index af6b4df3c4558cc6207b7ce03b87c363fe2734f4..acce41df9abdaf5803dbd7f7d42b7a08c1e8a6fe 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -212,9 +212,7 @@ void
 smallexaustive (unsigned int count)
 {
   mpz_t          n_z, want;
-  unsigned long  n, k, i, r;
-  int            tests;
-  gmp_randstate_ptr rands;
+  unsigned long  n, k;
 
   mpz_init (n_z);
   mpz_init (want);
index 807d93bb1bf1282bae306e4f48ecce4fd283b4cd..39735a92e92377f833795472797e7ac63ea31207 100644 (file)
@@ -1,7 +1,7 @@
 /* Test mpz_abs, mpz_add, mpz_cmp, mpz_cmp_ui, mpz_cdiv_qr_ui, mpz_cdiv_q_ui,
    mpz_cdiv_r_ui, , mpz_cdiv_ui, mpz_mul_ui.
 
-Copyright 1993, 1994, 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1996, 2000-2002 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 277c19471040753c40d9c7ff5b346aef2ed61752..cf0474e7f1eb69a5599392dfae09fe8d2b369516 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index cc86340d0d89b118b1ceda4d4d839c47a3dc9507..c9877fc521deb053f05f4e088b8920d3be1dc44a 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mpz_cmp_d and mpz_cmpabs_d.
 
-Copyright 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+Copyright 2001-2003, 2005 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index ced5a3b059f673d14155ee54b86d061f9e15518e..97fdbcaae3a24873beb5cd203a3f5816cd648d74 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 0f6a787c0bea3a4aea98a5cce51488aa72ec359a..1227335ec56e684ea50428050a8e51cde686f309 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 6f1719c23ecf1ab693e5293654bc8dd9c98890a9..3ccb5aab044907b3bb9d1ae3c6aa826ff838a4e2 100644 (file)
@@ -1,7 +1,7 @@
 /* test mpz_congruent_2exp_p */
 
 /*
-Copyright 2001 Free Software Foundation, Inc.
+Copyright 2001, 2013 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -81,8 +81,10 @@ check_data (void)
     { "0", "0", 0, 1 },
     { "1", "0", 0, 1 },
     { "0", "1", 0, 1 },
-    { "123", "456", 0, 1 },
+    { "123", "-456", 0, 1 },
     { "0x123456789123456789", "0x987654321987654321", 0, 1 },
+    { "0xfffffffffffffffffffffffffffffff7", "-0x9", 129, 0 },
+    { "0xfffffffffffffffffffffffffffffff6", "-0xa", 128, 1 },
 
   };
 
@@ -105,17 +107,12 @@ check_data (void)
 
 
 void
-check_random (int argc, char *argv[])
+check_random (int reps)
 {
   gmp_randstate_ptr rands = RANDS;
   unsigned long  d;
   mpz_t  a, c, ra, rc;
   int    i;
-  int    want;
-  int    reps = 5000;
-
-  if (argc >= 2)
-    reps = atoi (argv[1]);
 
   mpz_init (a);
   mpz_init (c);
@@ -137,12 +134,18 @@ check_random (int argc, char *argv[])
       mpz_fdiv_r_2exp (ra, a, d);
       mpz_fdiv_r_2exp (rc, c, d);
 
-      want = (mpz_cmp (ra, rc) == 0);
-      check_one (a, c, d, want);
-
       mpz_sub (ra, ra, rc);
-      mpz_sub (a, a, ra);
+      if (mpz_cmp_ui (ra, 0) != 0)
+       {
+         check_one (a, c, d, 0);
+         mpz_sub (a, a, ra);
+       }
       check_one (a, c, d, 1);
+      if (d != 0)
+       {
+         mpz_combit (a, urandom() % d);
+         check_one (a, c, d, 0);
+       }
     }
 
   mpz_clear (a);
@@ -151,14 +154,55 @@ check_random (int argc, char *argv[])
   mpz_clear (rc);
 }
 
+void
+check_random_bits (int reps)
+{
+  gmp_randstate_ptr rands = RANDS;
+  mp_bitcnt_t ea, ec, en, d;
+  mp_bitcnt_t m = 10 * GMP_LIMB_BITS;
+  mpz_t  a, c;
+  int    i;
+
+  mpz_init2 (a, m + 1);
+  mpz_init2 (c, m);
+
+  for (i = 0; i < reps; i++)
+    {
+      d  = urandom() % m;
+      ea = urandom() % m;
+      ec = urandom() % m;
+      en = urandom() % m;
+
+      mpz_set_ui (c, 0);
+      mpz_setbit (c, en);
+
+      mpz_set_ui (a, 0);
+      mpz_setbit (a, ec);
+      mpz_sub (c , a, c);
+
+      mpz_set_ui (a, 0);
+      mpz_setbit (a, ea);
+      mpz_add (a , a, c);
+
+      check_one (a, c, d, ea >= d);
+    }
+
+  mpz_clear (a);
+  mpz_clear (c);
+}
+
 
 int
 main (int argc, char *argv[])
 {
+  int    reps = 5000;
+
   tests_start ();
+  TESTS_REPS (reps, argv, argc);
 
   check_data ();
-  check_random (argc, argv);
+  check_random (reps);
+  check_random_bits (reps);
 
   tests_end ();
   exit (0);
index fcb31db2ce6177c64c4fb911ae36d1df01e37948..1620698b12dac30eb269db587468befa11d9640a 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index c34a0fae416df516eb79545430dad6d8d64c5064..fdfedc82b3ec8f4bf60c50f93441371694a042be 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 11b5bc1c7206536ada5f3a0918674d20b1717ed3..ecd7440eaebf97bcc25e19f7a9f63333c637b816 100644 (file)
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 07d3382cb5c63fd81fc90fdebe52c265959ba964..d07476486deccad4bace3424ad22a12c2fc1e05e 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 61e444774e2240027f6fc0676599c994ff65aa86..079bdff912eebc7d3ed996b07c296e1c730bfd9f 100644 (file)
@@ -1,6 +1,6 @@
 /* Exercise mpz_fac_ui and mpz_2fac_ui.
 
-Copyright 2000, 2001, 2002, 2012 Free Software Foundation, Inc.
+Copyright 2000-2002, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 8a17f05672f8f080c4f61b2f5d42a8d6a5616444..a616e5b101d7cba6158b79e217343e76da03cf15 100644 (file)
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 09a413999f3da15820f985e11c54b3a200b384bc..031b519f8fe5f9b96611d1b0afa51270fcfdaede 100644 (file)
@@ -1,7 +1,7 @@
 /* Test mpz_abs, mpz_add, mpz_cmp, mpz_cmp_ui, mpz_fdiv_qr_ui, mpz_fdiv_q_ui,
    mpz_fdiv_r_ui, mpz_fdiv_ui, mpz_mul_ui.
 
-Copyright 1993, 1994, 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1996, 2000-2002 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 9b40a5fec4bebf6328481a919fee7b51968af402..a7425b5b8961abcd70a002444846de440d3c8d22 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mpz_fib_ui and mpz_fib2_ui.
 
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-2002 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index de349fe4c7a6d0a1d86a66b915cbef32cc876d25..b1db2165732717fdd8aae79e91c81777101a5822 100644 (file)
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index f0dd62853a1520ef1484abd3f887a03dc7653c23..fef4fde0cf70043a3bca25cb180c56a1cb24eae6 100644 (file)
@@ -1,7 +1,7 @@
 /* Test mpz_gcd, mpz_gcdext, and mpz_gcd_ui.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005,
-2008, 2009, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2005, 2008, 2009, 2012 Free
+Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index d4de2ad262236a8fad522b8c4e14e38017cc4803..16f51e11b695b122697154a01062660015c03fd5 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index c9f2a90d98c1c4afec25b4d51b150336ac6e82e1..4a4a9304982ee54e9618764a17c8575c8a3d3d2a 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 105e869728c61c9c1c56ba47b1c9a1ffff31bd22..2f5555daf5771a79eb041c667488b32906c60c33 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 37bab0b19e6ca9217557a4842c632443cdc930ba..083ada7f1e6ff2fe09da291059856291a314eea5 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 992034caa8a711d8c726c0d5b16fd80c5ac57129..f39c8ab8c22e8e37ebe9d51a12049c886e7d72af 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 59d682d6bc74ee5213ecd60932aecb4a994d1f76..8d10fdc8aa7a1e86038b1c788153c59512f57300 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index f2656ac6aedbd2d9525c57588faac699ee12e07f..f50290bff6fc884280d091edd961e6210348fab0 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 223a743cb400212073ef7fda52ec5a519e214e92..a033409a2fd44543aa22d81386561ecddb85f0c1 100644 (file)
@@ -1,7 +1,7 @@
 /* Test mpz_invert.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005,
-2008, 2009, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2005, 2008, 2009, 2012, 2014 Free
+Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -71,11 +71,12 @@ main (int argc, char **argv)
        {
          MPZ_CHECK_FORMAT (ainv);
 
-         if (mpz_cmp_ui (ainv, 0) <= 0 || mpz_cmpabs (ainv, m) >= 0)
+         if (mpz_cmp_ui (ainv, 0) < 0 || mpz_cmpabs (ainv, m) >= 0)
            {
              fprintf (stderr, "ERROR in test %d\n", test);
              gmp_fprintf (stderr, "Inverse out of range.\n");
              gmp_fprintf (stderr, "a = %Zx\n", a);
+             gmp_fprintf (stderr, "1/a = %Zx\n", ainv);
              gmp_fprintf (stderr, "m = %Zx\n", m);
              abort ();
            }
@@ -83,7 +84,7 @@ main (int argc, char **argv)
          mpz_mul (t, ainv, a);
          mpz_mod (t, t, m);
 
-         if (mpz_cmp_ui (t, 1) != 0)
+         if (mpz_cmp_ui (t, mpz_cmpabs_ui (m, 1) != 0) != 0)
            {
              fprintf (stderr, "ERROR in test %d\n", test);
              gmp_fprintf (stderr, "a^(-1)*a != 1 (mod m)\n");
index 4148eac32c67cb54bda49291f04025be753a003d..e06e7bb14b0242b29b64f546a083b863c981362e 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
index 327a739a89532f37d334dbac19aa957ab3652546..b6a0c33106ac7279b618388b99fda3516e0f43ab 100644 (file)
@@ -1,6 +1,6 @@
 /* Exercise mpz_*_kronecker_*() and mpz_jacobi() functions.
 
-Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright 1999-2004, 2013 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 /* With no arguments the various Kronecker/Jacobi symbol routines are
@@ -631,11 +631,11 @@ check_data (void)
       "4902678867794567120224500687210807069172039735", 0 },
     { "2666617146103764067061017961903284334497474492754652499788571378062969111250584288683585223600172138551198546085281683283672592", "2666617146103764067061017961903284334497474492754652499788571378062969111250584288683585223600172138551198546085281683290481773", 1 },
 
-    /* Exersizes the case asize == 1, btwos > 0 in mpz_jacobi. */
+    /* Exercises the case asize == 1, btwos > 0 in mpz_jacobi. */
     { "804609", "421248363205206617296534688032638102314410556521742428832362659824", 1 } ,
     { "4190209", "2239744742177804210557442048984321017460028974602978995388383905961079286530650825925074203175536427000", 1 },
 
-    /* Exersizes the case asize == 1, btwos = 63 in mpz_jacobi
+    /* Exercises the case asize == 1, btwos = 63 in mpz_jacobi
        (relevant when GMP_LIMB_BITS == 64). */
     { "17311973299000934401", "1675975991242824637446753124775689449936871337036614677577044717424700351103148799107651171694863695242089956242888229458836426332300124417011114380886016", 1 },
     { "3220569220116583677", "41859917623035396746", -1 },
@@ -912,8 +912,6 @@ check_large_quotients (void)
 
   for (i = 0; i < COUNT; i++)
     {
-      unsigned j;
-      unsigned chain_len;
       int answer;
       mp_bitcnt_t msize;
 
index c4342ba6d6c44d2e6e462c8f57e91f2fabcbd721..3cc41483ef7d1dc1ff5fa4250b0283e74ab4ab9f 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdio.h>
diff --git a/tests/mpz/t-limbs.c b/tests/mpz/t-limbs.c
new file mode 100644 (file)
index 0000000..43bcfb0
--- /dev/null
@@ -0,0 +1,233 @@
+/* Test mpz_limbs_* functions
+
+Copyright 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite 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 a copy of the GNU General Public License along with
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "tests.h"
+
+#define COUNT 100
+#define BITSIZE 500
+
+/* Like mpz_add. For simplicity, support positive inputs only. */
+static void
+alt_add (mpz_ptr r, mpz_srcptr a, mpz_srcptr b)
+{
+  mp_size_t an = mpz_size (a);
+  mp_size_t bn = mpz_size (b);
+  mp_ptr rp;
+
+  ASSERT (an > 0);
+  ASSERT (bn > 0);
+  if (an < bn)
+    {
+      MP_SIZE_T_SWAP (an, bn);
+      MPZ_SRCPTR_SWAP (a, b);
+    }
+  rp = mpz_limbs_modify (r, an + 1);
+  rp[an] = mpn_add (rp, mpz_limbs_read (a), an, mpz_limbs_read (b), bn);
+  mpz_limbs_finish (r, an + 1);
+}
+
+static void
+check_funcs (const char *name,
+            void (*f)(mpz_ptr, mpz_srcptr, mpz_srcptr),
+            void (*ref_f)(mpz_ptr, mpz_srcptr, mpz_srcptr),
+            mpz_srcptr a, mpz_srcptr b)
+{
+  mpz_t r, ref;
+  mpz_inits (r, ref, NULL);
+
+  ref_f (ref, a, b);
+  MPZ_CHECK_FORMAT (ref);
+  f (r, a, b);
+  MPZ_CHECK_FORMAT (r);
+
+  if (mpz_cmp (r, ref) != 0)
+    {
+      printf ("%s failed, abits %u, bbits %u\n",
+             name,
+             (unsigned) mpz_sizeinbase (a, 2),
+             (unsigned) mpz_sizeinbase (b, 2));
+      gmp_printf ("a = %Zx\n", a);
+      gmp_printf ("b = %Zx\n", b);
+      gmp_printf ("r = %Zx (bad)\n", r);
+      gmp_printf ("ref = %Zx\n", ref);
+      abort ();
+    }
+  mpz_clears (r, ref, NULL);
+}
+
+static void
+check_add (void)
+{
+  gmp_randstate_ptr rands = RANDS;
+  mpz_t bs, a, b;
+  unsigned i;
+  mpz_inits (bs, a, b, NULL);
+  for (i = 0; i < COUNT; i++)
+    {
+      mpz_urandomb (bs, rands, 32);
+      mpz_rrandomb (a, rands, 1 + mpz_get_ui (bs) % BITSIZE);
+      mpz_urandomb (bs, rands, 32);
+      mpz_rrandomb (b, rands, 1 + mpz_get_ui (bs) % BITSIZE);
+
+      check_funcs ("add", alt_add, mpz_add, a, b);
+    }
+  mpz_clears (bs, a, b, NULL);
+}
+
+static void
+alt_mul (mpz_ptr r, mpz_srcptr a, mpz_srcptr b)
+{
+  mp_size_t an = mpz_size (a);
+  mp_size_t bn = mpz_size (b);
+  mp_srcptr ap, bp;
+  TMP_DECL;
+
+  TMP_MARK;
+
+  ASSERT (an > 0);
+  ASSERT (bn > 0);
+  if (an < bn)
+    {
+      MP_SIZE_T_SWAP (an, bn);
+      MPZ_SRCPTR_SWAP (a, b);
+    }
+  /* NOTE: This copying seems unnecessary; better to allocate new
+     result area, and free the old area when done. */
+  if (r == a)
+    {
+      mp_ptr tp =  TMP_ALLOC_LIMBS (an);
+      MPN_COPY (tp, mpz_limbs_read (a), an);
+      ap = tp;
+      bp = (a == b) ? ap : mpz_limbs_read (b);
+    }
+  else if (r == b)
+    {
+      mp_ptr tp = TMP_ALLOC_LIMBS (bn);
+      MPN_COPY (tp, mpz_limbs_read (b), bn);
+      bp = tp;
+      ap = mpz_limbs_read (a);
+    }
+  else
+    {
+      ap = mpz_limbs_read (a);
+      bp = mpz_limbs_read (b);
+    }
+  mpn_mul (mpz_limbs_write (r, an + bn),
+          ap, an, bp, bn);
+
+  mpz_limbs_finish (r, an + bn);
+}
+
+void
+check_mul (void)
+{
+  gmp_randstate_ptr rands = RANDS;
+  mpz_t bs, a, b;
+  unsigned i;
+  mpz_inits (bs, a, b, NULL);
+  for (i = 0; i < COUNT; i++)
+    {
+      mpz_urandomb (bs, rands, 32);
+      mpz_rrandomb (a, rands, 1 + mpz_get_ui (bs) % BITSIZE);
+      mpz_urandomb (bs, rands, 32);
+      mpz_rrandomb (b, rands, 1 + mpz_get_ui (bs) % BITSIZE);
+
+      check_funcs ("mul", alt_mul, mpz_mul, a, b);
+    }
+  mpz_clears (bs, a, b, NULL);
+}
+
+#define MAX_SIZE 100
+
+static void
+check_roinit (void)
+{
+  gmp_randstate_ptr rands = RANDS;
+  mpz_t bs, a, b, r, ref;
+  unsigned i;
+
+  mpz_inits (bs, a, b, r, ref, NULL);
+
+  for (i = 0; i < COUNT; i++)
+    {
+      mp_srcptr ap, bp;
+      mp_size_t an, bn;
+      mpz_urandomb (bs, rands, 32);
+      mpz_rrandomb (a, rands, 1 + mpz_get_ui (bs) % BITSIZE);
+      mpz_urandomb (bs, rands, 32);
+      mpz_rrandomb (b, rands, 1 + mpz_get_ui (bs) % BITSIZE);
+
+      an = mpz_size (a);
+      ap = mpz_limbs_read (a);
+      bn = mpz_size (b);
+      bp = mpz_limbs_read (b);
+
+      mpz_add (ref, a, b);
+      {
+       mpz_t a1, b1;
+#if __STDC_VERSION__ >= 199901
+       const mpz_t a2 = MPZ_ROINIT_N ( (mp_ptr) ap, an);
+       const mpz_t b2 = MPZ_ROINIT_N ( (mp_ptr) bp, bn);
+
+       mpz_set_ui (r, 0);
+       mpz_add (r, a2, b2);
+       if (mpz_cmp (r, ref) != 0)
+         {
+           printf ("MPZ_ROINIT_N failed\n");
+           gmp_printf ("a = %Zx\n", a);
+           gmp_printf ("b = %Zx\n", b);
+           gmp_printf ("r = %Zx (bad)\n", r);
+           gmp_printf ("ref = %Zx\n", ref);
+           abort ();
+         }
+#endif
+       mpz_set_ui (r, 0);
+       mpz_add (r, mpz_roinit_n (a1, ap, an), mpz_roinit_n (b1, bp, bn));
+       if (mpz_cmp (r, ref) != 0)
+         {
+           printf ("mpz_roinit_n failed\n");
+           gmp_printf ("a = %Zx\n", a);
+           gmp_printf ("b = %Zx\n", b);
+           gmp_printf ("r = %Zx (bad)\n", r);
+           gmp_printf ("ref = %Zx\n", ref);
+           abort ();
+         }
+      }
+    }
+  mpz_clears (bs, a, b, r, ref, NULL);
+}
+
+int
+main (int argc, char *argv[])
+{
+  tests_start ();
+  tests_end ();
+
+  check_add ();
+  check_mul ();
+  check_roinit ();
+
+  return 0;
+
+}
index e2fc2804ccea989842e15631c45eec5d91bfa55c..7cb734195bc688e2ebb10c3733d2bd8e111d1cff 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 932065bfb726a5cca8400cc02acb93823fa16839..7bf51a5dacbc67b95d9fb91e97b03da657b2cf44 100644 (file)
@@ -1,6 +1,6 @@
 /* Exercise mpz_mfac_uiui.
 
-Copyright 2000, 2001, 2002, 2012 Free Software Foundation, Inc.
+Copyright 2000-2002, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index d496628fd9e477becddc11b6100f621fa52e6055..690b89f7fdefb52e6446912c2a88a234ad5fa2f5 100644 (file)
@@ -1,7 +1,7 @@
 /* Test mpz_cmp, mpz_mul.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2003, 2004 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2004 Free Software Foundation,
+Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index dd6208f1f979e1f93ca0d597993bfe4a205905a9..cbbe54d40dfd8283d89312afc65cee895ef07aed 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 6799fc0cb9d9e908b7faea1e107a13827efa6e8f..6e291c334d610e2f0169271821a01b30894c8f76 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #include <stdio.h>
index f7568e55806a4a43706f7ccc9585d2a37891a2da..107f2436ab1f76d111897ade7564b6c6ccfbca8c 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 14a3e2201f28845bcc0c336d6c18679c7d02a08d..72fe5c519dda4766d6c124fd82febd5e48ffc1ff 100644 (file)
@@ -2,7 +2,7 @@
 
    Contributed to the GNU project by Torbjorn Granlund and Martin Boij.
 
-Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2008-2010 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -17,7 +17,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 92eff66198907a097c7d6b02b3efd46008c2658c..2a54e59e650398c8e62b25851a7d96d51ec2a6ad 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mpz_perfect_square_p.
 
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-2002 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 81f2366e515ebf1e6e6796174ff553423cced487..c27c4efda96d8ae11c14f633cc9f0ef701114ad8 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 36418e4847b8e03c2aa25bf124a3a40711e64429..312ef98884a7d033a483361a0b40328b2983a78c 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mpz_pow_ui and mpz_ui_pow_ui.
 
-Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1997, 1999-2001 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 29c513ab63d1c05fb1d642fd51a1d2f47e96ec4d..240e1c89b96d6809000b829ad2f8f4f9ea7e987f 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mpz_powm, mpz_mul, mpz_mod, mpz_mod_ui, mpz_div_ui.
 
-Copyright 1991, 1993, 1994, 1996, 1999, 2000, 2001, 2009, 2012 Free Software
+Copyright 1991, 1993, 1994, 1996, 1999-2001, 2009, 2012 Free Software
 Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index bfa7433c6011e78eb28aeb39eb8b3083a0c63a09..a95e473c3298f95fe94a30729817288c7bc2d29a 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mpz_powm_ui, mpz_mul, mpz_mod.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2013 Free Software
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2013 Free Software
 Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -25,8 +25,6 @@ the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
 #include "gmp-impl.h"
 #include "tests.h"
 
-void debug_mp (mpz_t, int);
-
 int
 main (int argc, char **argv)
 {
@@ -43,17 +41,9 @@ main (int argc, char **argv)
   tests_start ();
   rands = RANDS;
 
-  mpz_init (bs);
-
-  if (argc == 2)
-     reps = atoi (argv[1]);
+  TESTS_REPS (reps, argv, argc);
 
-  mpz_init (base);
-  mpz_init (exp);
-  mpz_init (mod);
-  mpz_init (r1);
-  mpz_init (r2);
-  mpz_init (base2);
+  mpz_inits (bs, base, exp, mod, r1, r2, base2, NULL);
 
   for (i = 0; i < reps; i++)
     {
@@ -90,16 +80,13 @@ main (int argc, char **argv)
 
 #if 0
       putc ('\n', stderr);
-      debug_mp (base, -16);
-      debug_mp (mod, -16);
+      gmp_fprintf (stderr, "B = 0x%Zx\n", base);
+      gmp_fprintf (stderr, "M = 0x%Zx\n", mod);
 #endif
 
-      mpz_powm_ui (r1, base, exp2, mod);
-      MPZ_CHECK_FORMAT (r1);
-
+      exp2 = mpz_getlimbn (exp, (mp_size_t) 0);
       mpz_set_ui (r2, 1);
       mpz_set (base2, base);
-
       mpz_mod (r2, r2, mod);   /* needed when exp==0 and mod==1 */
       while (exp2 != 0)
        {
@@ -113,39 +100,29 @@ main (int argc, char **argv)
          exp2 = exp2 / 2;
        }
 
+      exp2 = mpz_getlimbn (exp, (mp_size_t) 0);
+      mpz_powm_ui (r1, base, exp2, mod);
+      MPZ_CHECK_FORMAT (r1);
+
 #if 0
-      debug_mp (r1, -16);
-      debug_mp (r2, -16);
+      gmp_fprintf (stderr, "R   = 0x%Zx\n", r1);
+      gmp_fprintf (stderr, "REF = 0x%Zx\n", r2);
 #endif
 
       if (mpz_cmp (r1, r2) != 0)
        {
          fprintf (stderr, "\ntest %d: Incorrect results for operands:\n", i);
-         debug_mp (base, -16);
-         debug_mp (exp, -16);
-         debug_mp (mod, -16);
-         fprintf (stderr, "mpz_powm_ui result:\n");
-         debug_mp (r1, -16);
-         fprintf (stderr, "reference result:\n");
-         debug_mp (r2, -16);
+         gmp_fprintf (stderr, "B = 0x%Zx\n", base);
+         gmp_fprintf (stderr, "E = 0x%Zx\n", exp);
+         gmp_fprintf (stderr, "M = 0x%Zx\n", mod);
+         gmp_fprintf (stderr, "R   = 0x%Zx\n", r1);
+         gmp_fprintf (stderr, "REF = 0x%Zx\n", r2);
          abort ();
        }
     }
 
-  mpz_clear (bs);
-  mpz_clear (base);
-  mpz_clear (exp);
-  mpz_clear (mod);
-  mpz_clear (r1);
-  mpz_clear (r2);
-  mpz_clear (base2);
+  mpz_clears (bs, base, exp, mod, r1, r2, base2, NULL);
 
   tests_end ();
   exit (0);
 }
-
-void
-debug_mp (mpz_t x, int base)
-{
-  mpz_out_str (stderr, base, x); fputc ('\n', stderr);
-}
index 7ef7c77cbbcecb767f4f67bfcf20b9f0f5ca3124..d437299e5352654fd396c6d4f63ec20f20b1b865 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -101,12 +101,89 @@ check_small (void)
   mpz_clear (n);
 }
 
+void
+check_composites (int count)
+{
+  int i;
+  mpz_t a, b, n, bs;
+  unsigned long size_range, size;
+  gmp_randstate_ptr rands = RANDS;
+
+  mpz_init (a);
+  mpz_init (b);
+  mpz_init (n);
+  mpz_init (bs);
+
+  for (i = 0; i < count; i++)
+    {
+      mpz_urandomb (bs, rands, 32);
+      size_range = mpz_get_ui (bs) % 13 + 1; /* 0..8192 bit operands */
+
+      mpz_urandomb (bs, rands, size_range);
+      size = mpz_get_ui (bs);
+      mpz_rrandomb (a, rands, size);
+
+      mpz_urandomb (bs, rands, 32);
+      size_range = mpz_get_ui (bs) % 13 + 1; /* 0..8192 bit operands */
+      mpz_rrandomb (b, rands, size);
+
+      /* Exclude trivial factors */
+      if (mpz_cmp_ui (a, 1) == 0)
+       mpz_set_ui (a, 2);
+      if (mpz_cmp_ui (b, 1) == 0)
+       mpz_set_ui (b, 2);
+
+      mpz_mul (n, a, b);
+
+      check_pn (n, 0);
+    }
+  mpz_clear (a);
+  mpz_clear (b);
+  mpz_clear (n);
+  mpz_clear (bs);
+}
+
+static void
+check_primes (void)
+{
+  static const char * const primes[] = {
+    "2", "17", "65537",
+    /* diffie-hellman-group1-sha1, also "Well known group 2" in RFC
+       2412, 2^1024 - 2^960 - 1 + 2^64 * { [2^894 pi] + 129093 } */
+    "0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"
+    "29024E088A67CC74020BBEA63B139B22514A08798E3404DD"
+    "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"
+    "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED"
+    "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381"
+    "FFFFFFFFFFFFFFFF",
+    NULL
+  };
+
+  mpz_t n;
+  int i;
+
+  mpz_init (n);
+
+  for (i = 0; primes[i]; i++)
+    {
+      mpz_set_str_or_abort (n, primes[i], 0);
+      check_one (n, 1);
+    }
+  mpz_clear (n);
+}
+
 int
-main (void)
+main (int argc, char **argv)
 {
+  int count = 1000;
+
+  TESTS_REPS (count, argv, argc);
+
   tests_start ();
 
   check_small ();
+  check_composites (count);
+  check_primes ();
 
   tests_end ();
   exit (0);
index 9fa55279a96d35a618abff3a412550baedc0dba7..253040ca1e363e5c9b58b1a178cbb9841449b612 100644 (file)
@@ -1,6 +1,6 @@
 /* Exercise mpz_primorial_ui.
 
-Copyright 2000, 2001, 2002, 2012 Free Software Foundation, Inc.
+Copyright 2000-2002, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 49635eedc9ee04a40120ed42fa184c1420676dda..4de74675fdfe4f3a1224cf13bed49aeb8b296b2e 100644 (file)
@@ -1,7 +1,7 @@
 /* Test mpz_remove.
 
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2009, 2012, 2013
-Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2009, 2012, 2013 Free
+Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 9e6a5849e8307f8975e9d3eb575d493ba734efa2..17efe4cca8e3256137ff232408f8626477546595 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 90901df9fb2c8b2c2812cee2fc56f72b6a6ace80..95b896b1be40ee12757078cdfc207cd3b62f4a7d 100644 (file)
@@ -1,6 +1,6 @@
 /* Tests of mpz_scan0 and mpz_scan1.
 
-Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2000-2003 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index e5f2f9d996ac9a846855e33651ad2befb9c5bf32..d587e6544283c808aac95e5c109cba769ea36b92 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mpz_set_d and mpz_init_set_d.
 
-Copyright 2000, 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
+Copyright 2000-2003, 2006 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 9c0699a7626d295c0a2af182ac6f4d59db43f01d..38b5a2c438fe184ba51e7732294c472e39892043 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index e9da0c77e59b34b9555259f15135591ccbcc064f..b1e55ede332a3de271a57723f2fdac38f1dad120 100644 (file)
@@ -1,6 +1,6 @@
 /* Test mpz_set_si and mpz_init_set_si.
 
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 2000-2002 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 0eb27e747664ea099eefb5469ba3617cc4c88d7b..c6a59f2fede3769e0c2a369f1f8628ad4b74e7f7 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index a328a4a6205993219c77a76ca25e18a79cdef2d6..b5eab8846f859b4a9c689195124809d6b14b831f 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 815887f96ad5f460fdf84cdc534113e90e56e6aa..9aeb233890fed7961f6793437d029c5fd0dca7e5 100644 (file)
@@ -1,7 +1,6 @@
 /* Test mpz_add, mpz_add_ui, mpz_cmp, mpz_cmp, mpz_mul, mpz_sqrtrem.
 
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 1996, 2000-2002 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index f215f093999b556d0c5fbe68be9be786159cded8..902b51c0038e68f6df5f419c69e5d65c7b04f29b 100644 (file)
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index ccb5814650c2d01e9f9205b6c640cd69934eb9e7..db266eb9d00d272e4b8a8ad58f8ace7c953e87d9 100644 (file)
@@ -1,7 +1,7 @@
 /* Test mpz_abs, mpz_add, mpz_cmp, mpz_cmp_ui, mpz_tdiv_qr_ui, mpz_tdiv_q_ui,
    mpz_tdiv_r_ui, mpz_tdiv_ui, mpz_mul_ui.
 
-Copyright 1993, 1994, 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1996, 2000-2002 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 0f1371c90e8dc928682d7250d56d82321ed3dcb0..ed585b7edc5550c34749709324723251d490055b 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright 2000-2003 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
@@ -15,7 +15,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 
 
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
index 6d160160dfcc26930d1411c4918358b1e144579e..b902bc55865902b0c00e0d52bd5213cef409c7bf 100644 (file)
@@ -15,7 +15,7 @@
 
 @SET_MAKE@
 
-# Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright 2000-2003 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library test suite.
 #
@@ -30,7 +30,7 @@
 # Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along with
-# the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.
+# the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.
 VPATH = @srcdir@
 am__make_dryrun = \
   { \
index 89a452c5aca05e038e854f11932887ca19090501..2406c3b645e514992fdc0e0c35665f75bb01e7fd 100644 (file)
@@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index ea6d0e75104162e81495eccdd2e381d170cae6f8..65401e37515190b06150fa949d57358a76c6f553 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 /* Examples:
 
index 4b9af70be8083b22fcad86316d9029f03f598ce1..99c5cca195a7dafe02af9742583a53ef1f589fea 100644 (file)
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 /* This file requires the following header files: gmp.h */
 
index 545374daebe85afbbaaf78c78f879b56a3b31f01..596ff3a9c4da1b3fe9d0c001dfe6e028706ae32c 100644 (file)
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 /* T is upper dimension.  Z_A is the LC multiplier, which is
    relatively prime to Z_M, the LC modulus.  The result is put in
@@ -42,7 +42,7 @@ main (int argc, char *argv[])
   unsigned int n;
   mpz_t a, m;
   mpf_t res[GMP_SPECT_MAXT], res_min[GMP_SPECT_MAXT], f_tmp;
-  register int f;
+  int f;
 
 
   mpz_init (a);
index a68486ac7d55ef50dfc27493134d3f9d176d16da..1285ccfb9f97a820d3a9a55ffe4bc840c46f4b46 100644 (file)
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 /* Examples:
 
index a5f1b3d206e8a67ce73d686b7f4060cf791962ec..7cecd6dee2d75a053356fcea969c215efebe64c4 100644 (file)
@@ -17,7 +17,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 /* The theories for these functions are taken from D. Knuth's "The Art
 of Computer Programming: Volume 2, Seminumerical Algorithms", Third
index f84c3a63c46d44cb7773e31e8b78f08a4424a33d..0414037c191cf654e48ba07cd25a4a583f7b13ad 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index b2e3e13e80f19d9511d4a89b29cc387ef887b4ec..b524441f293f6f81ec614587e536fe2c73f3a76d 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 7bb0d4f69a01d653dc282b74ebfd16e42b047fc1..3aabffe88d1bf8f395498369013db9e33f781d0b 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include "gmp.h"
index 1eb33c1efbe6c983981e080dd49d34e1e47e5ab1..1265a0d0a51d360bc7130ca29583757951d4d320 100644 (file)
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -142,7 +142,7 @@ usage: t-rand [function nbits]\n\
   enum { Z, F } func = Z;
   int nbits = 1;
   int verify_mode_flag = 1;
-  register int i;
+  int i;
   struct rt *a;
 
 
index 23ef0a01dd06c682dbe90c010a9ee27e2f445ae6..bac8b6d5a043d45eb71975e2562d765f8f35af90 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -35,7 +35,7 @@ check_one (const char *name, gmp_randstate_ptr rstate)
   for (bits = 0; bits < BITS_PER_ULONG; bits++)
     {
       /* will demand got < limit */
-      limit = (1L << bits);
+      limit = (1UL << bits);
 
       for (i = 0; i < 5; i++)
         {
index c32688225c6f103e60e2b3cc2f4eec39efa207a1..c58d740f4e253082f3df97a328234c0a062a1fd0 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 99eba0d40e7fc50229bdf3a4656a9b8fa30e546e..d5a9217b402d0b7d223ac3d822d7abdbebf7c7bb 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include "gmp.h"
index 7a200515f9186d7a735efa685a08248da7983fab..3a91e3092c1f109ef3cc9a6e611f50ca818ff647 100644 (file)
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 
index a48f30d6d40c809e3b4bc0de689b7f9e9219bbe3..0ba9fbca3ae9cf78231c22e2336421023c1add54 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 9106a81a9d457e70e89e4e89d1b920bf11344a62..bcb322f352a2450aa1df984f5199bfc60e71f906 100644 (file)
@@ -1,8 +1,7 @@
 /* Reference mpn functions, designed to be simple, portable and independent
    of the normal gmp code.  Speed isn't a consideration.
 
-Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-2007, 2008, 2009, 2011, 2012, 2013 Free Software Foundation, Inc.
+Copyright 1996-2009, 2011-2013 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -17,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 /* Most routines have assertions representing what the mpn routines are
@@ -69,8 +68,8 @@ byte_overlap_p (const void *v_xp, mp_size_t xsize,
 int
 refmpn_overlap_p (mp_srcptr xp, mp_size_t xsize, mp_srcptr yp, mp_size_t ysize)
 {
-  return byte_overlap_p (xp, xsize * BYTES_PER_MP_LIMB,
-                        yp, ysize * BYTES_PER_MP_LIMB);
+  return byte_overlap_p (xp, xsize * GMP_LIMB_BYTES,
+                        yp, ysize * GMP_LIMB_BYTES);
 }
 
 /* Check overlap for a routine defined to work low to high. */
@@ -109,7 +108,7 @@ refmpn_malloc_limbs (mp_size_t size)
   ASSERT (size >= 0);
   if (size == 0)
     size = 1;
-  p = (mp_ptr) malloc ((size_t) (size * BYTES_PER_MP_LIMB));
+  p = (mp_ptr) malloc ((size_t) (size * GMP_LIMB_BYTES));
   ASSERT (p != NULL);
   return p;
 }
@@ -597,7 +596,7 @@ refmpn_sub_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
 }
 
 mp_limb_t
-refmpn_addcnd_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size, mp_limb_t cnd)
+refmpn_cnd_add_n (mp_limb_t cnd, mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
 {
   if (cnd != 0)
     return refmpn_add_n (rp, s1p, s2p, size);
@@ -608,7 +607,7 @@ refmpn_addcnd_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size, mp_lim
     }
 }
 mp_limb_t
-refmpn_subcnd_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size, mp_limb_t cnd)
+refmpn_cnd_sub_n (mp_limb_t cnd, mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
 {
   if (cnd != 0)
     return refmpn_sub_n (rp, s1p, s2p, size);
@@ -852,11 +851,11 @@ refmpn_addlsh2_n_ip2 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
 }
 mp_limb_t
 refmpn_addlsh_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
-                mp_size_t n, unsigned int s, mp_limb_t carry)
+                 mp_size_t n, unsigned int s, mp_limb_t carry)
 {
   mp_limb_t cy;
 
-  ASSERT (carry >= 0 && carry <= (CNST_LIMB(1) << s));
+  ASSERT (carry <= (CNST_LIMB(1) << s));
 
   cy = refmpn_addlsh_n (rp, up, vp, n, s);
   cy += refmpn_add_1 (rp, rp, n, carry);
@@ -934,11 +933,11 @@ refmpn_sublsh2_n_ip2 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
 }
 mp_limb_t
 refmpn_sublsh_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
-                mp_size_t n, unsigned int s, mp_limb_t carry)
+                 mp_size_t n, unsigned int s, mp_limb_t carry)
 {
   mp_limb_t cy;
 
-  ASSERT (carry >= 0 && carry <= (CNST_LIMB(1) << s));
+  ASSERT (carry <= (CNST_LIMB(1) << s));
 
   cy = refmpn_sublsh_n (rp, up, vp, n, s);
   cy += refmpn_sub_1 (rp, rp, n, carry);
@@ -986,7 +985,7 @@ refmpn_rsblsh2_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
 }
 mp_limb_signed_t
 refmpn_rsblsh_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
-                mp_size_t n, unsigned int s, mp_limb_signed_t carry)
+                 mp_size_t n, unsigned int s, mp_limb_signed_t carry)
 {
   mp_limb_signed_t cy;
 
@@ -2353,7 +2352,7 @@ refmpn_get_str (unsigned char *dst, int base, mp_ptr src, mp_size_t size)
 
   MPN_SIZEINBASE (dsize, src, size, base);
   ASSERT (dsize >= 1);
-  ASSERT (! byte_overlap_p (dst, (mp_size_t) dsize, src, size * BYTES_PER_MP_LIMB));
+  ASSERT (! byte_overlap_p (dst, (mp_size_t) dsize, src, size * GMP_LIMB_BYTES));
 
   if (size == 0)
     {
@@ -2399,7 +2398,7 @@ ref_bswap_limb (mp_limb_t src)
   int        i;
 
   dst = 0;
-  for (i = 0; i < BYTES_PER_MP_LIMB; i++)
+  for (i = 0; i < GMP_LIMB_BYTES; i++)
     {
       dst = (dst << 8) + (src & 0xFF);
       src >>= 8;
index 1d688a52f49f742420253feba7551fed87d66824..6ca51c4bc5156ff118cd129a7efecc7fa8e3e60c 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 3903ec5939ae0eb0d07a56bfa13c29d03774b08f..2aef7aaa87b9da956692640586a3433d2f83df2b 100644 (file)
@@ -1,6 +1,6 @@
 /* Reference mpz functions.
 
-Copyright 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1997, 1999-2002 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 /* always do assertion checking */
 #define WANT_ASSERT  1
index 90b20aca2cd27390d2ecf1719bad660956f86440..3435d20923d0b1b19bdb95052623393ebfceff20 100644 (file)
@@ -1,7 +1,7 @@
 /* A stupid little spinning wheel designed to make it look like useful work
    is being done.
 
-Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1999-2001 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include "config.h"
 
@@ -94,7 +94,7 @@ spinner_init (void)
     }
   alarm (1);
 
-  /* unbufferred output so the spinner will show up */
+  /* unbuffered output so the spinner will show up */
   setbuf (stdout, NULL);
 }
 
index c26ac0258cd70690361eaf8bb2f34f93bbd8c818..2543f9fc3201843791bd55fe7d8cee3b99e0f35e 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index d46299f8af36d7421a32eab6e1e923c780dd2c00..8583ccd4d62e35bab2f85980a00217324266dc97 100644 (file)
@@ -1,6 +1,6 @@
 /* Check the values of some constants.
 
-Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2000-2003, 2014 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -208,7 +208,7 @@ main (int argc, char *argv[])
 {
   int  error = 0;
 
-  CHECK_INT (BYTES_PER_MP_LIMB, (int) sizeof(mp_limb_t));
+  CHECK_INT (GMP_LIMB_BYTES, (int) sizeof(mp_limb_t));
   CHECK_INT (mp_bits_per_limb, GMP_LIMB_BITS);
 
   CHECK_BITS (GMP_LIMB_BITS, mp_limb_t);
@@ -218,8 +218,8 @@ main (int argc, char *argv[])
   CHECK_HIGHBIT (ULONG_HIGHBIT,     unsigned long,  "0x%lX");
   CHECK_HIGHBIT (UINT_HIGHBIT,      unsigned int,   "0x%X");
   CHECK_HIGHBIT (USHRT_HIGHBIT,     unsigned short, "0x%hX");
-  CHECK_HIGHBIT (LONG_HIGHBIT,      long,           "0x%lX");
 #if 0 /* Bad! */
+  CHECK_HIGHBIT (LONG_HIGHBIT,      long,           "0x%lX");
   CHECK_HIGHBIT (INT_HIGHBIT,       int,            "0x%X");
   CHECK_HIGHBIT (SHRT_HIGHBIT,      short,          "0x%hX");
 #endif
@@ -329,10 +329,10 @@ main (int argc, char *argv[])
       printf ("INT_MAX        %X\n", INT_MAX);
       printf ("INT_MIN        %X\n", INT_MIN);
 
-      printf ("USHRT_MAX      %hX\n", USHRT_MAX);
-      printf ("USHRT_HIGHBIT  %hX\n", USHRT_HIGHBIT);
-      printf ("SHRT_MAX       %hX\n", SHRT_MAX);
-      printf ("SHRT_MIN       %hX\n", SHRT_MIN);
+      printf ("USHRT_MAX      %X\n", USHRT_MAX);
+      printf ("USHRT_HIGHBIT  %X\n", USHRT_HIGHBIT);
+      printf ("SHRT_MAX       %X\n", SHRT_MAX);
+      printf ("SHRT_MIN       %X\n", SHRT_MIN);
 
       printf ("\n");
       printf ("Bits\n");
index c63f8ecf0ed14fe9585b7518ed304c566e7db8d1..117babadc61cc0e588c2be2730844f556ecda540 100644 (file)
@@ -1,6 +1,6 @@
 /* Test count_leading_zeros and count_trailing_zeros.
 
-Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2001-2003 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index b5c8a1a028e091ea29892c4b7d5c1e5cc5b5d30a..76fdd28e616657d28e012fe98f6a6f58f28a6109 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -42,12 +42,8 @@ main (int argc, char *argv[])
     }
 #endif
 
-  /* gcc 2.95.2 limits.h on solaris 2.5.1 incorrectly selects a 64-bit
-     LONG_MAX, leading to some integer overflow in ULONG_MAX and a spurious
-     __GMP_ULONG_MAX != ULONG_MAX.  Casting ULONG_MAX to unsigned long is a
-     workaround.  */
 #ifdef ULONG_MAX
-  if (__GMP_ULONG_MAX != (unsigned long) ULONG_MAX)
+  if (__GMP_ULONG_MAX != ULONG_MAX)
     {
       printf ("__GMP_ULONG_MAX incorrect\n");
       printf ("  __GMP_ULONG_MAX  %lu  0x%lX\n", __GMP_ULONG_MAX, __GMP_ULONG_MAX);
@@ -60,8 +56,8 @@ main (int argc, char *argv[])
   if (__GMP_USHRT_MAX != USHRT_MAX)
     {
       printf ("__GMP_USHRT_MAX incorrect\n");
-      printf ("  __GMP_USHRT_MAX  %hu  0x%hX\n", __GMP_USHRT_MAX, __GMP_USHRT_MAX);
-      printf ("  USHRT_MAX        %hu  0x%hX\n", USHRT_MAX, USHRT_MAX);
+      printf ("  __GMP_USHRT_MAX  %u  0x%X\n", __GMP_USHRT_MAX, __GMP_USHRT_MAX);
+      printf ("  USHRT_MAX        %u  0x%X\n", USHRT_MAX, USHRT_MAX);
       error = 1;
     }
 #endif
index 7cb17cab2d7c4466f472f730aaeb9e8d6b47d71d..1de20c94f6e7bfd5a0618e4d16386216d640ac58 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 77090faa8287b1aefe84386635976b138604b1db..8e17d7787f04ec2b3370aab1b09a2e54a714269f 100644 (file)
@@ -1,6 +1,6 @@
 /* Test binvert_limb.
 
-Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2000-2003 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 601a4d39e5af2ec92b084e1f1765a03d4dd9bc4c..b6da1127330a7c36a2f089efc52d8a90597207d6 100644 (file)
@@ -1,6 +1,6 @@
 /* Test ULONG_PARITY.
 
-Copyright 2002 Free Software Foundation, Inc.
+Copyright 2002, 2014 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -50,7 +50,7 @@ check_various (void)
   check_one (1, 0x3111L);
 
   for (i = 0; i < BITS_PER_ULONG; i++)
-    check_one (1, 1L << i);
+    check_one (1, 1UL << i);
 }
 
 
index 7f36203827e3b3a1133df149b56f962fbe12de29..c3b32886079af1d63d9ea7d15862c98262cef01e 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index 42f02c569a1ad701f17bb4e4b09394ab7b90ec2d..331705ff6fe5df864a95db2402eada32e11cddb0 100644 (file)
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include <stdlib.h>
index c1762291dab56d9f61f28a7326b83b90cfd7162d..f0c3fa780b5ba3d9c9a1a1657993462dd6558ee3 100644 (file)
@@ -1,7 +1,6 @@
 /* Tests support prototypes etc.
 
-Copyright 2000, 2001, 2002, 2003, 2004, 2008, 2009, 2010, 2011, 2012 Free
-Software Foundation, Inc.
+Copyright 2000-2004, 2008-2013 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 #ifndef __TESTS_H__
@@ -162,8 +161,8 @@ int refmpf_validate (const char *, mpf_srcptr, mpf_srcptr);
 int refmpf_validate_division (const char *, mpf_srcptr, mpf_srcptr, mpf_srcptr);
 
 
-mp_limb_t refmpn_addcnd_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_subcnd_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_cnd_add_n (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_cnd_sub_n (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
 
 mp_limb_t refmpn_add (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
 mp_limb_t refmpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
@@ -431,6 +430,7 @@ istringstream : public std::istrstream {
          exit (1);                                                     \
        }                                                               \
       count *= repfactor;                                              \
+      count = MAX (count, 1);                                          \
       reps_nondefault = 1;                                             \
     }                                                                  \
   if (reps_nondefault)                                                 \
index 9ac3028b4ba9dd2964b33867bd709a97902d4a1b..4b05bdb8244d47f259d63a81601d5a4c86a73892 100644 (file)
@@ -1,7 +1,6 @@
 /* Support for diagnostic traces.
 
-Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
-Inc.
+Copyright 1999-2005 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -16,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 
 /* Future: Would like commas printed between limbs in hex or binary, but
index e5fbcb1718cfc0486aa0048c73b6f8d49fe4c397..de2fbcde2f32eb9b16ce3911e00395e449b20961 100644 (file)
@@ -1,6 +1,6 @@
 dnl  x86 calling conventions checking.
 
-dnl  Copyright 2000, 2003, 2010 Free Software Foundation, Inc.
+dnl  Copyright 2000, 2003, 2010, 2013 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library test suite.
 
@@ -16,7 +16,7 @@ dnl  Public License for more details.
 
 dnl  You should have received a copy of the GNU General Public License along
 dnl  with the GNU MP Library test suite.  If not, see
-dnl  http://www.gnu.org/licenses/.
+dnl  https://www.gnu.org/licenses/.
 
 
 dnl  The current version of the code attempts to keep the call/return
@@ -40,10 +40,10 @@ C
 C Execute an fstcw, returning the current x87 control word.
 
 PROLOGUE(x86_fstcw)
-       xorl    %eax, %eax
-       pushl   %eax
+       xor     %eax, %eax
+       push    %eax
        fstcw   (%esp)
-       popl    %eax
+       pop     %eax
        ret
 EPILOGUE()
 
@@ -96,24 +96,24 @@ m4_assert_numargs(1)
        ALIGN(8)
 PROLOGUE(calling_conventions)
        LEA(    G(calling_conventions_values), %ecx)
-       popl    RETADDR(%ecx)
+       pop     RETADDR(%ecx)
 
-       movl    %ebx, SAVE_EBX(%ecx)
-       movl    %ebp, SAVE_EBP(%ecx)
-       movl    %esi, SAVE_ESI(%ecx)
-       movl    %edi, SAVE_EDI(%ecx)
+       mov     %ebx, SAVE_EBX(%ecx)
+       mov     %ebp, SAVE_EBP(%ecx)
+       mov     %esi, SAVE_ESI(%ecx)
+       mov     %edi, SAVE_EDI(%ecx)
 
        C Values we expect to see unchanged, as per amd64check.c
-       movl    WANT_EBX(%ecx), %ebx
-       movl    WANT_EBP(%ecx), %ebp
-       movl    WANT_ESI(%ecx), %esi
-       movl    WANT_EDI(%ecx), %edi
+       mov     WANT_EBX(%ecx), %ebx
+       mov     WANT_EBP(%ecx), %ebp
+       mov     WANT_ESI(%ecx), %esi
+       mov     WANT_EDI(%ecx), %edi
 
        C Try to provoke a problem by starting with junk in the caller-saves
        C registers, especially in %eax and %edx which will be return values
-       movl    JUNK_EAX(%ecx), %eax
-       movl    JUNK_EDX(%ecx), %edx
-C      movl    JUNK_ECX(%ecx), %ecx
+       mov     JUNK_EAX(%ecx), %eax
+       mov     JUNK_EDX(%ecx), %edx
+C      mov     JUNK_ECX(%ecx), %ecx
 
 ifdef(`PIC',`
        LEA(    G(calling_conventions_function), %ecx)
@@ -124,21 +124,21 @@ ifdef(`PIC',`
 
        LEA(    G(calling_conventions_values), %ecx)
 
-       movl    %ebx, EBX(%ecx)
-       movl    %ebp, EBP(%ecx)
-       movl    %esi, ESI(%ecx)
-       movl    %edi, EDI(%ecx)
+       mov     %ebx, EBX(%ecx)
+       mov     %ebp, EBP(%ecx)
+       mov     %esi, ESI(%ecx)
+       mov     %edi, EDI(%ecx)
 
        pushf
-       popl    %ebx
-       movl    %ebx, EFLAGS(%ecx)
+       pop     %ebx
+       mov     %ebx, EFLAGS(%ecx)
 
-       movl    SAVE_EBX(%ecx), %ebx
-       movl    SAVE_ESI(%ecx), %esi
-       movl    SAVE_EDI(%ecx), %edi
-       movl    SAVE_EBP(%ecx), %ebp
+       mov     SAVE_EBX(%ecx), %ebx
+       mov     SAVE_ESI(%ecx), %esi
+       mov     SAVE_EDI(%ecx), %edi
+       mov     SAVE_EBP(%ecx), %ebp
 
-       pushl   RETADDR(%ecx)
+       push    RETADDR(%ecx)
 
 ifdef(`PIC',`
        LEA(    G(calling_conventions_fenv), %ecx)
index 8fa0f06ca723dfc45db3b55a9ea2fc0b54dd937b..067c8155b94d41349231c8c6115403c0ea338567 100644 (file)
@@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 Public License for more details.
 
 You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite.  If not, see http://www.gnu.org/licenses/.  */
+the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
 
 #include <stdio.h>
 #include "gmp.h"
index 07d2808fd51932f9567c62d10d3e935a14b94f5a..bbe503a201979abf14745be34d744d74f9a6e957 100644 (file)
@@ -1,22 +1,32 @@
 ## Process this file with automake to generate Makefile.in
 
-# Copyright 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009,
-# 2010, 2011 Free Software Foundation, Inc.
+# Copyright 2000-2003, 2005-2011 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
@@ -42,6 +52,7 @@ EXTRA_LTLIBRARIES = libspeed.la
 
 libspeed_la_SOURCES =                                                  \
   common.c divrem1div.c divrem1inv.c divrem2div.c divrem2inv.c         \
+  div_qr_1n_pi1_1.c div_qr_1n_pi1_2.c div_qr_1_tune.c                  \
   freq.c                                                               \
   gcdext_single.c gcdext_double.c gcdextod.c gcdextos.c                        \
   hgcd_lehmer.c hgcd_appr_lehmer.c hgcd_reduce_1.c hgcd_reduce_2.c     \
@@ -133,7 +144,7 @@ TUNE_MPN_SRCS_BASIC = div_qr_2.c bdiv_q.c bdiv_qr.c                 \
   invertappr.c invert.c binvert.c divrem_2.c gcd.c gcdext.c            \
   get_str.c set_str.c matrix22_mul.c                                   \
   hgcd.c hgcd_appr.c hgcd_reduce.c                                     \
-  mul_n.c sqr.c powm_sec.c                                             \
+  mul_n.c sqr.c sec_powm.c                                             \
   mullo_n.c mul_fft.c mul.c tdiv_qr.c mulmod_bnm1.c sqrmod_bnm1.c      \
   mulmid.c mulmid_n.c toom42_mulmid.c                                  \
   nussbaumer_mul.c toom6h_mul.c toom8h_mul.c toom6_sqr.c toom8_sqr.c   \
index 6c339b31a292ac06251270a5f817393d46a1c239..07abb022a38d154d03c751567e8cf51eb83d4494 100644 (file)
 
 @SET_MAKE@
 
-# Copyright 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009,
-# 2010, 2011 Free Software Foundation, Inc.
+# Copyright 2000-2003, 2005-2011 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
-# Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
-# Inc.
+# Copyright 1996, 1998-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
 #
-# This file is part of the GNU MP Library.
+#    * 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.
 #
-# The GNU MP Library is free software; you can redistribute it and/or modify
-# it under the terms of 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 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 Lesser General Public
-# License for more details.
+#  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 a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  You should have received copies of the GNU General Public License and the
+#  GNU Lesser General Public License along with the GNU MP Library.  If not,
+#  see https://www.gnu.org/licenses/.
 
 VPATH = @srcdir@
 am__make_dryrun = \
@@ -105,7 +125,8 @@ am__DEPENDENCIES_1 =
 am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) \
        $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
 am_libspeed_la_OBJECTS = common.lo divrem1div.lo divrem1inv.lo \
-       divrem2div.lo divrem2inv.lo freq.lo gcdext_single.lo \
+       divrem2div.lo divrem2inv.lo div_qr_1n_pi1_1.lo \
+       div_qr_1n_pi1_2.lo div_qr_1_tune.lo freq.lo gcdext_single.lo \
        gcdext_double.lo gcdextod.lo gcdextos.lo hgcd_lehmer.lo \
        hgcd_appr_lehmer.lo hgcd_reduce_1.lo hgcd_reduce_2.lo \
        jacbase1.lo jacbase2.lo jacbase3.lo jacbase4.lo mod_1_div.lo \
@@ -148,7 +169,7 @@ am__objects_1 = div_qr_2.$(OBJEXT) bdiv_q.$(OBJEXT) bdiv_qr.$(OBJEXT) \
        divrem_2.$(OBJEXT) gcd.$(OBJEXT) gcdext.$(OBJEXT) \
        get_str.$(OBJEXT) set_str.$(OBJEXT) matrix22_mul.$(OBJEXT) \
        hgcd.$(OBJEXT) hgcd_appr.$(OBJEXT) hgcd_reduce.$(OBJEXT) \
-       mul_n.$(OBJEXT) sqr.$(OBJEXT) powm_sec.$(OBJEXT) \
+       mul_n.$(OBJEXT) sqr.$(OBJEXT) sec_powm.$(OBJEXT) \
        mullo_n.$(OBJEXT) mul_fft.$(OBJEXT) mul.$(OBJEXT) \
        tdiv_qr.$(OBJEXT) mulmod_bnm1.$(OBJEXT) sqrmod_bnm1.$(OBJEXT) \
        mulmid.$(OBJEXT) mulmid_n.$(OBJEXT) toom42_mulmid.$(OBJEXT) \
@@ -368,6 +389,7 @@ noinst_HEADERS = speed.h
 EXTRA_LTLIBRARIES = libspeed.la
 libspeed_la_SOURCES = \
   common.c divrem1div.c divrem1inv.c divrem2div.c divrem2inv.c         \
+  div_qr_1n_pi1_1.c div_qr_1n_pi1_2.c div_qr_1_tune.c                  \
   freq.c                                                               \
   gcdext_single.c gcdext_double.c gcdextod.c gcdextos.c                        \
   hgcd_lehmer.c hgcd_appr_lehmer.c hgcd_reduce_1.c hgcd_reduce_2.c     \
@@ -429,7 +451,7 @@ TUNE_MPN_SRCS_BASIC = div_qr_2.c bdiv_q.c bdiv_qr.c                 \
   invertappr.c invert.c binvert.c divrem_2.c gcd.c gcdext.c            \
   get_str.c set_str.c matrix22_mul.c                                   \
   hgcd.c hgcd_appr.c hgcd_reduce.c                                     \
-  mul_n.c sqr.c powm_sec.c                                             \
+  mul_n.c sqr.c sec_powm.c                                             \
   mullo_n.c mul_fft.c mul.c tdiv_qr.c mulmod_bnm1.c sqrmod_bnm1.c      \
   mulmid.c mulmid_n.c toom42_mulmid.c                                  \
   nussbaumer_mul.c toom6h_mul.c toom8h_mul.c toom6_sqr.c toom8_sqr.c   \
index 80acd7b1e4fd836532d16e79c05c964030695f87..f76407f7ca276de5c6fc09008e04539c6f7248a8 100644 (file)
@@ -1,19 +1,30 @@
-Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+Copyright 2000-2002, 2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
 
 
 
@@ -287,7 +298,7 @@ mpn_divrem_1, using division by 32 as an example.
 
 EXAMPLE COMPARISONS - MULTIPLICATION
 
-mul_basecase takes a ".<r>" parameter. If positivie, it gives the second
+mul_basecase takes a ".<r>" parameter. If positive, it gives the second
 (smaller) operand size.  For example to show speeds for 3x3 up to 20x3 in
 cycles,
 
index b44746208336a0709ca128aef644a603caa76c75..888c77fe9d41a2dd5b02412f9dc5abd22551e359 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Alpha time stamp counter access routine.
 
 dnl  Copyright 2000, 2005 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index daac5f10941d6bc5863f7899621612af84809960..8d06b4dc0201092e946d546f7da1a87b94fc7c0f 100644 (file)
@@ -1,22 +1,32 @@
 /* Shared speed subroutines.
 
-Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010,
-2011, 2012 Free Software Foundation, Inc.
+Copyright 1999-2006, 2008-2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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_NO_ATTRIBUTE_CONST_PURE
 
@@ -165,6 +175,9 @@ speed_measure (double (*fun) (struct speed_params *s), struct speed_params *s)
                  fprintf (stderr, "Fatal error: too many (%d) failed measurements (0.0)\n", zeros);
                  abort ();
                }
+            if (s->reps < 10000)
+              s->reps *= 2;
+
              continue;
            }
 
@@ -347,7 +360,7 @@ speed_cache_fill (struct speed_params *s)
 }
 
 
-/* Miscellanous options accepted by tune and speed programs under -o. */
+/* Miscellaneous options accepted by tune and speed programs under -o. */
 
 void
 speed_option_set (const char *s)
@@ -461,9 +474,9 @@ speed_mpn_com (struct speed_params *s)
   SPEED_ROUTINE_MPN_COPY (mpn_com);
 }
 double
-speed_mpn_tabselect (struct speed_params *s)
+speed_mpn_sec_tabselect (struct speed_params *s)
 {
-  SPEED_ROUTINE_MPN_TABSELECT (mpn_tabselect);
+  SPEED_ROUTINE_MPN_TABSELECT (mpn_sec_tabselect);
 }
 
 
@@ -685,6 +698,28 @@ speed_mpn_divrem_2_inv (struct speed_params *s)
   SPEED_ROUTINE_MPN_DIVREM_2 (mpn_divrem_2_inv);
 }
 
+double
+speed_mpn_div_qr_1n_pi1 (struct speed_params *s)
+{
+  SPEED_ROUTINE_MPN_DIV_QR_1N_PI1 (mpn_div_qr_1n_pi1);
+}
+double
+speed_mpn_div_qr_1n_pi1_1 (struct speed_params *s)
+{
+  SPEED_ROUTINE_MPN_DIV_QR_1N_PI1 (mpn_div_qr_1n_pi1_1);
+}
+double
+speed_mpn_div_qr_1n_pi1_2 (struct speed_params *s)
+{
+  SPEED_ROUTINE_MPN_DIV_QR_1N_PI1 (mpn_div_qr_1n_pi1_2);
+}
+
+double
+speed_mpn_div_qr_1 (struct speed_params *s)
+{
+  SPEED_ROUTINE_MPN_DIV_QR_1 (mpn_div_qr_1);
+}
+
 double
 speed_mpn_div_qr_2n (struct speed_params *s)
 {
@@ -906,6 +941,12 @@ speed_mpn_ni_invertappr (struct speed_params *s)
   SPEED_ROUTINE_MPN_INVERTAPPR (mpn_ni_invertappr, mpn_invertappr_itch);
 }
 
+double
+speed_mpn_sec_invert (struct speed_params *s)
+{
+  SPEED_ROUTINE_MPN_SEC_INVERT (mpn_sec_invert, mpn_sec_invert_itch);
+}
+
 double
 speed_mpn_redc_1 (struct speed_params *s)
 {
@@ -986,14 +1027,14 @@ speed_mpn_add_n_sub_n (struct speed_params *s)
 }
 #endif
 
-#if HAVE_NATIVE_mpn_addlsh1_n
+#if HAVE_NATIVE_mpn_addlsh1_n == 1
 double
 speed_mpn_addlsh1_n (struct speed_params *s)
 {
   SPEED_ROUTINE_MPN_BINARY_N (mpn_addlsh1_n);
 }
 #endif
-#if HAVE_NATIVE_mpn_sublsh1_n
+#if HAVE_NATIVE_mpn_sublsh1_n == 1
 double
 speed_mpn_sublsh1_n (struct speed_params *s)
 {
@@ -1021,21 +1062,21 @@ speed_mpn_sublsh1_n_ip1 (struct speed_params *s)
   SPEED_ROUTINE_MPN_COPY (mpn_sublsh1_n_ip1);
 }
 #endif
-#if HAVE_NATIVE_mpn_rsblsh1_n
+#if HAVE_NATIVE_mpn_rsblsh1_n == 1
 double
 speed_mpn_rsblsh1_n (struct speed_params *s)
 {
   SPEED_ROUTINE_MPN_BINARY_N (mpn_rsblsh1_n);
 }
 #endif
-#if HAVE_NATIVE_mpn_addlsh2_n
+#if HAVE_NATIVE_mpn_addlsh2_n == 1
 double
 speed_mpn_addlsh2_n (struct speed_params *s)
 {
   SPEED_ROUTINE_MPN_BINARY_N (mpn_addlsh2_n);
 }
 #endif
-#if HAVE_NATIVE_mpn_sublsh2_n
+#if HAVE_NATIVE_mpn_sublsh2_n == 1
 double
 speed_mpn_sublsh2_n (struct speed_params *s)
 {
@@ -1063,7 +1104,7 @@ speed_mpn_sublsh2_n_ip1 (struct speed_params *s)
   SPEED_ROUTINE_MPN_COPY (mpn_sublsh2_n_ip1);
 }
 #endif
-#if HAVE_NATIVE_mpn_rsblsh2_n
+#if HAVE_NATIVE_mpn_rsblsh2_n == 1
 double
 speed_mpn_rsblsh2_n (struct speed_params *s)
 {
@@ -1128,14 +1169,14 @@ speed_mpn_rsh1sub_n (struct speed_params *s)
 #endif
 
 double
-speed_mpn_addcnd_n (struct speed_params *s)
+speed_mpn_cnd_add_n (struct speed_params *s)
 {
-  SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_addcnd_n (wp, xp, yp, s->size, 1));
+  SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_cnd_add_n (1, wp, xp, yp, s->size));
 }
 double
-speed_mpn_subcnd_n (struct speed_params *s)
+speed_mpn_cnd_sub_n (struct speed_params *s)
 {
-  SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_subcnd_n (wp, xp, yp, s->size, 1));
+  SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_cnd_sub_n (1, wp, xp, yp, s->size));
 }
 
 /* mpn_and_n etc can be macros and so have to be handled with
@@ -1835,7 +1876,7 @@ speed_noop_wxys (struct speed_params *s)
 double
 speed_malloc_free (struct speed_params *s)
 {
-  size_t  bytes = s->size * BYTES_PER_MP_LIMB;
+  size_t  bytes = s->size * GMP_LIMB_BYTES;
   SPEED_ROUTINE_ALLOC_FREE (void *p,
                            p = malloc (bytes);
                            free (p));
@@ -1844,9 +1885,9 @@ speed_malloc_free (struct speed_params *s)
 double
 speed_malloc_realloc_free (struct speed_params *s)
 {
-  size_t  bytes = s->size * BYTES_PER_MP_LIMB;
+  size_t  bytes = s->size * GMP_LIMB_BYTES;
   SPEED_ROUTINE_ALLOC_FREE (void *p,
-                           p = malloc (BYTES_PER_MP_LIMB);
+                           p = malloc (GMP_LIMB_BYTES);
                            p = realloc (p, bytes);
                            free (p));
 }
@@ -1854,7 +1895,7 @@ speed_malloc_realloc_free (struct speed_params *s)
 double
 speed_gmp_allocate_free (struct speed_params *s)
 {
-  size_t  bytes = s->size * BYTES_PER_MP_LIMB;
+  size_t  bytes = s->size * GMP_LIMB_BYTES;
   SPEED_ROUTINE_ALLOC_FREE (void *p,
                            p = (*__gmp_allocate_func) (bytes);
                            (*__gmp_free_func) (p, bytes));
@@ -1863,11 +1904,11 @@ speed_gmp_allocate_free (struct speed_params *s)
 double
 speed_gmp_allocate_reallocate_free (struct speed_params *s)
 {
-  size_t  bytes = s->size * BYTES_PER_MP_LIMB;
+  size_t  bytes = s->size * GMP_LIMB_BYTES;
   SPEED_ROUTINE_ALLOC_FREE
     (void *p,
-     p = (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
-     p = (*__gmp_reallocate_func) (p, bytes, BYTES_PER_MP_LIMB);
+     p = (*__gmp_allocate_func) (GMP_LIMB_BYTES);
+     p = (*__gmp_reallocate_func) (p, bytes, GMP_LIMB_BYTES);
      (*__gmp_free_func) (p, bytes));
 }
 
diff --git a/tune/div_qr_1_tune.c b/tune/div_qr_1_tune.c
new file mode 100644 (file)
index 0000000..7e928dc
--- /dev/null
@@ -0,0 +1,47 @@
+/* mpn/generic/div_qr_1, using tuned threshold and method.
+
+Copyright 2013 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 TUNE_PROGRAM_BUILD 1
+
+#include "gmp.h"
+#include "gmp-impl.h"
+
+mp_limb_t mpn_div_qr_1n_pi1_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t);
+mp_limb_t mpn_div_qr_1n_pi1_2 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t);
+
+#if !HAVE_NATIVE_mpn_div_qr_1n_pi1
+#define __gmpn_div_qr_1n_pi1 \
+  (div_qr_1n_pi1_method == 1 ? mpn_div_qr_1n_pi1_1 : mpn_div_qr_1n_pi1_2)
+#endif
+
+#undef mpn_div_qr_1
+#define mpn_div_qr_1 mpn_div_qr_1_tune
+
+#include "mpn/generic/div_qr_1.c"
diff --git a/tune/div_qr_1n_pi1_1.c b/tune/div_qr_1n_pi1_1.c
new file mode 100644 (file)
index 0000000..6dd8ceb
--- /dev/null
@@ -0,0 +1,39 @@
+/* mpn/generic/div_qr_1n_pi1.c method 1.
+
+Copyright 2013 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.h"
+#include "gmp-impl.h"
+
+#undef DIV_QR_1N_METHOD
+#define DIV_QR_1N_METHOD 1
+#undef mpn_div_qr_1n_pi1
+#define mpn_div_qr_1n_pi1 mpn_div_qr_1n_pi1_1
+
+#include "mpn/generic/div_qr_1n_pi1.c"
diff --git a/tune/div_qr_1n_pi1_2.c b/tune/div_qr_1n_pi1_2.c
new file mode 100644 (file)
index 0000000..acc80d4
--- /dev/null
@@ -0,0 +1,39 @@
+/* mpn/generic/div_qr_1n_pi1.c method 2.
+
+Copyright 2013 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.h"
+#include "gmp-impl.h"
+
+#undef DIV_QR_1N_METHOD
+#define DIV_QR_1N_METHOD 2
+#undef mpn_div_qr_1n_pi1
+#define mpn_div_qr_1n_pi1 mpn_div_qr_1n_pi1_2
+
+#include "mpn/generic/div_qr_1n_pi1.c"
index 5580f8057832495f55889c80c49e38ba848eaa39..b680f9d222929324180429c210110d4760784092 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2000, 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 OPERATION_divrem_1
 
index 73ed57f41188df21b58ae185f8b35e328a3972f3..598c03c7399b30f86cd055731ef261bd6abdbcfe 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2000, 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 OPERATION_divrem_1
 
index 10b50e2f83e01e16b7c752884994acddcabb2298..cd7f3f5a88a57fd906007c854c1df35015046e35 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 05644b25607257957db79bed85de618c3f6e5aeb..bd7c4268f757523b61130f5de24a951b2c3ecd1a 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index f1092e264059af9c23140ed128c05b1a62caf052..210f42564e543960c108b92c0b5602d8b55915eb 100644 (file)
@@ -1,21 +1,32 @@
 /* CPU frequency determination.
 
-Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright 1999-2004 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /* Currently we don't get a CPU frequency on the following systems,
@@ -459,7 +470,7 @@ freq_sunos_sysinfo (int help)
 
 
 /* "/etc/hw -r cpu" for SCO OpenUnix 8, printing a line like
-       The speed of the CPU is approximately 450Mhz
+       The speed of the CPU is approximately 450MHz
  */
 static int
 freq_sco_etchw (int help)
@@ -480,7 +491,7 @@ freq_sco_etchw (int help)
       while (fgets (buf, sizeof (buf), fp) != NULL)
         {
           end = 0;
-          if (sscanf (buf, " The speed of the CPU is approximately %lfMhz%n",
+          if (sscanf (buf, " The speed of the CPU is approximately %lfMHz%n",
                       &val, &end) == 1 && end != 0)
             {
               speed_cycletime = 1e-6 / val;
index 5470f1aff5391421bb33d9d620c48be7d844d890..c72f07ea9f62013076b0d1af1037e26f7e78c9c8 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2000 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 1bc47e786e05f9cb66954556479c82f145e88a77..292e9e87e03743a84555ae9565e780950c9842e0 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2000 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 957864c5e98f7fc25cb083f69b140cad0ed05f79..c08087d4808d32b0a71bc021b49b3a5a6cea2baf 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2000 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index afde776f7de6f8fadbb3e94d43306e1f0b6ea902..fb8af29279a950ec190466a944d678f487ea35a4 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2000 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 18123e951385c205b334fe28ea4a2c11af090af4..790e61e3cbc4c384bf3fbf81c74281d292218279 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2010, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 309d2c50dc00e0491bf51785e26adb9a199bcffb..11d0ef882174c2293906322dac30ee093afa3c93 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 9963624148d1b9c791c02c6ba007e7150cdf1b06..383c2d700992395b5b173208dd9778982e6b1c2c 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 1eed4ba11f2ee7c4e739b56cd472a1b6cbd6747f..ac18b6033a74af8cfdf37721127dd27a00864e7d 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index e99a399e4a3a3c7537fcf030077dae248000575e..fc9d62e3b2909df7738934fada6f4179360c108d 100644 (file)
@@ -1,21 +1,32 @@
 dnl  HPPA 32-bit time stamp counter access routine.
 
 dnl  Copyright 2000, 2002, 2005 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 9755c907d23faebb99be94c8bd0855bf199c3bda..57ef4c4683e0a9e58a5bca4530d97b2acff55758 100644 (file)
@@ -1,21 +1,32 @@
 dnl  HPPA 64-bit time stamp counter access routine.
 
 dnl  Copyright 2000, 2002, 2005 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index ddf0ea9b0a69bb4d1a0675f575fa77b50d6cc4bd..215a0cc5c22b19bcf83c9cf4ffd6ec2c2808e029 100644 (file)
@@ -1,21 +1,32 @@
 dnl  HPPA 64-bit time stamp counter access routine.
 
 dnl  Copyright 2000, 2002, 2005 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index ef487db8f6f7ddb5400feade95ca816342a371fc..065111103159223203589b3830c378173da99af1 100644 (file)
@@ -1,21 +1,32 @@
 dnl  IA-64 time stamp counter access routine.
 
 dnl  Copyright 2000, 2005 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 2a0b859c2cd03ae98b48eea78ed7f772db544de0..a73df8b723006d24dd6eee96ee47ea829d9b6ecf 100644 (file)
@@ -5,17 +5,28 @@ Copyright 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 6bbe7e9e9379c60cd59d7f0a3d1d3eac5e4a6cff..b99ebe906102db9e8763189fb10c3a78045b4e68 100644 (file)
@@ -5,17 +5,28 @@ Copyright 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index f8f89d49be7b222dd6aff7f949cd6491d8b6871d..408b0fed6bd3e158d0dc074ed66488df26509550 100644 (file)
@@ -5,17 +5,28 @@ Copyright 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 19fe251149fc882ac9431283a253a921e4d7bcb1..70d535240bc89e1929b7fcb0a9b48081e18cb1e1 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2002, 2010 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 5c5648a10fe02b2c6a76b76cdd0334fca5b0ffca..524a67dd1e9b7f48077442775e820fcf33bbb661 100644 (file)
@@ -1,21 +1,32 @@
 #! /usr/bin/perl -w
 
-# Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright 2000-2002 Free Software Foundation, Inc.
 #
-# This file is part of the GNU MP Library.
+#  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 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.
+#  The GNU MP Library is free software; you can redistribute it and/or modify
+#  it under the terms of either:
 #
-# 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 Lesser General Public
-# License for more details.
+#    * 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.
 #
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+#  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/.
 
 
 # Usage:  cd $builddir/tune
index 763d591bbdcad366cd976348de195adee2413e3b..7eb7fcdf794555a8bfac2a87d713689f923f000b 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 10d7bed88099596d14d0b86ea1a17ed29a8d3be4..52ca57749bb94f27e1e6fe41343de6efd08fc1fd 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index e29921f4f0222d2c402ad9d6ccdefa2f79690a7d..a0663be055ce2b77160471eddd2a79078b97da01 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2000, 2003 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 OPERATION_mod_1
 
index 5c09fb5727441793605a9d4bd6a812581595f957..92c936ddcff3a5a254862d8354bec02f32e62b31 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2000 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 OPERATION_mod_1
 
index 77c7013ba5908494e3c69c203a5749ee84e23998..e3f2063e07251dd089ac36394ee36d58e12ea91f 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2000, 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General 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.h"
index 7c7f1b5fe64fafd4ace1cef6152360e56e67823e..5c13c96ee32a5046c660bfe76b6536cc1b50e36c 100644 (file)
@@ -9,17 +9,28 @@ Copyright 1999, 2000 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 369a8ea76fd458f69323c50a000cb95b2346aa1a..fb1e8332c839ece6246b4fb464d00b03d3697e56 100644 (file)
@@ -1,21 +1,32 @@
 dnl  x86 pentium time stamp counter access routine.
 
 dnl  Copyright 1999, 2000, 2005 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
index 4391ec102a65f3afcec81a39e21c168824369aac..2f4ac27bea296fcfaceb0197341a19d4112adfaa 100644 (file)
@@ -1,21 +1,32 @@
 dnl  PowerPC mftb_function -- read time base registers.
 
 dnl  Copyright 2002 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundationn; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index eb705466daa23bd8e88da01a7b3a9ef8fceb8a46..1ade99638a4e102393882ec7db1ebb0fb1bb9488 100644 (file)
@@ -1,21 +1,32 @@
 dnl  PowerPC mftb_function -- read time base registers, 64-bit integer.
 
-dnl  Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 2002-2004 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundationn; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index e65f512e85308df128132dce91925558ce4984f7..7c20f53e70faad93aff890a5cc64e682d8b4f362 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2000 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index a9e4bb502a7c051729dad58af34e4f79a9a9298f..c34bb2e0a502a522ccb4a4f099c31db750f803c8 100644 (file)
@@ -6,17 +6,28 @@ Copyright 2000 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index 2b3fb79e2288b3b7ca65c65886fa9e0084f68a65..388ca4150a671c9eeeb687a497272b1019e1c040 100644 (file)
@@ -5,17 +5,28 @@ Copyright 2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
index c67b09ccaa45a7061959e1b57510bd0a3b679b0e..842ec4cd4416efca822e2349ca20e2efe7c44770 100644 (file)
@@ -5,17 +5,28 @@ Copyright 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 __gmpn_set_str mpn_set_str_basecase
 #define __gmpn_bc_set_str mpn_bc_set_str_basecase
index 701ab2bf2beac81f93a8db0993df4f9ba773dce0..5520f28696357bc5350b3e952e76686359863ffe 100644 (file)
@@ -5,17 +5,28 @@ Copyright 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 TUNE_PROGRAM_BUILD  1   /* for gmp-impl.h */
 
index d8edc7dfde0a56e1f6f49d2dc610e06653625372..75b6f39b4d82af229d8af86e06c1f55366fd1161 100644 (file)
@@ -5,17 +5,28 @@ Copyright 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 __gmpn_set_str mpn_set_str_subquad
 #define __gmpn_bc_set_str mpn_bc_set_str_subquad
index b951ff3de2bfa7c96497d60112f128fcc8adcd84..f0981c70fea9918583cefb6fb3fd204a60b91c08 100644 (file)
@@ -1,21 +1,32 @@
 dnl  Sparc v9 32-bit time stamp counter access routine.
 
 dnl  Copyright 2000, 2005 Free Software Foundation, Inc.
-dnl
+
 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
 
index 08899120f0ed407582b9534db08f4c0226db8dba..e7fb8b9f60d98713a235736fcc03bb5c83c39dcc 100644 (file)
@@ -5,17 +5,28 @@ Copyright 1999, 2000, 2002, 2003, 2005 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /* The extension here is three versions of an mpn arithmetic mean.  These
index fe8254d04d1007634cd8e11f829e7885e7b44c05..12d53bcaa3af97f8baf3d361f9947de653483c5a 100644 (file)
@@ -1,22 +1,32 @@
 /* Speed measuring program.
 
-Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008, 2009, 2010,
-2011, 2012 Free Software Foundation, Inc.
+Copyright 1999-2003, 2005, 2006, 2008-2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 /* Usage message is in the code below, run with no arguments to print it.
    See README for interesting applications.
@@ -237,6 +247,11 @@ const struct routine_t {
   { "mpn_divrem_2_div",  speed_mpn_divrem_2_div,    },
   { "mpn_divrem_2_inv",  speed_mpn_divrem_2_inv,    },
 
+  { "mpn_div_qr_1n_pi1", speed_mpn_div_qr_1n_pi1, FLAG_R  },
+  { "mpn_div_qr_1n_pi1_1",speed_mpn_div_qr_1n_pi1_1, FLAG_R  },
+  { "mpn_div_qr_1n_pi1_2",speed_mpn_div_qr_1n_pi1_2, FLAG_R  },
+  { "mpn_div_qr_1",      speed_mpn_div_qr_1,      FLAG_R },
+
   { "mpn_div_qr_2n",     speed_mpn_div_qr_2n,       },
   { "mpn_div_qr_2u",     speed_mpn_div_qr_2u,       },
 
@@ -357,6 +372,7 @@ const struct routine_t {
   { "mpn_invertappr",          speed_mpn_invertappr          },
   { "mpn_ni_invertappr",       speed_mpn_ni_invertappr       },
   { "mpn_binvert",             speed_mpn_binvert             },
+  { "mpn_sec_invert",          speed_mpn_sec_invert          },
 
   { "mpn_sbpi1_div_qr",        speed_mpn_sbpi1_div_qr,    FLAG_R_OPTIONAL},
   { "mpn_dcpi1_div_qr",        speed_mpn_dcpi1_div_qr,    FLAG_R_OPTIONAL},
@@ -412,11 +428,11 @@ const struct routine_t {
 #if HAVE_NATIVE_mpn_copyd
   { "mpn_copyd",         speed_mpn_copyd            },
 #endif
-  { "mpn_tabselect",     speed_mpn_tabselect, FLAG_R_OPTIONAL },
-#if HAVE_NATIVE_mpn_addlsh1_n
+  { "mpn_sec_tabselect", speed_mpn_sec_tabselect, FLAG_R_OPTIONAL },
+#if HAVE_NATIVE_mpn_addlsh1_n == 1
   { "mpn_addlsh1_n",     speed_mpn_addlsh1_n, FLAG_R_OPTIONAL },
 #endif
-#if HAVE_NATIVE_mpn_sublsh1_n
+#if HAVE_NATIVE_mpn_sublsh1_n == 1
   { "mpn_sublsh1_n",     speed_mpn_sublsh1_n, FLAG_R_OPTIONAL },
 #endif
 #if HAVE_NATIVE_mpn_addlsh1_n_ip1
@@ -428,13 +444,13 @@ const struct routine_t {
 #if HAVE_NATIVE_mpn_sublsh1_n_ip1
   { "mpn_sublsh1_n_ip1", speed_mpn_sublsh1_n_ip1    },
 #endif
-#if HAVE_NATIVE_mpn_rsblsh1_n
+#if HAVE_NATIVE_mpn_rsblsh1_n == 1
   { "mpn_rsblsh1_n",     speed_mpn_rsblsh1_n, FLAG_R_OPTIONAL },
 #endif
-#if HAVE_NATIVE_mpn_addlsh2_n
+#if HAVE_NATIVE_mpn_addlsh2_n == 1
   { "mpn_addlsh2_n",     speed_mpn_addlsh2_n, FLAG_R_OPTIONAL },
 #endif
-#if HAVE_NATIVE_mpn_sublsh2_n
+#if HAVE_NATIVE_mpn_sublsh2_n == 1
   { "mpn_sublsh2_n",     speed_mpn_sublsh2_n, FLAG_R_OPTIONAL },
 #endif
 #if HAVE_NATIVE_mpn_addlsh2_n_ip1
@@ -446,7 +462,7 @@ const struct routine_t {
 #if HAVE_NATIVE_mpn_sublsh2_n_ip1
   { "mpn_sublsh2_n_ip1", speed_mpn_sublsh2_n_ip1    },
 #endif
-#if HAVE_NATIVE_mpn_rsblsh2_n
+#if HAVE_NATIVE_mpn_rsblsh2_n == 1
   { "mpn_rsblsh2_n",     speed_mpn_rsblsh2_n, FLAG_R_OPTIONAL },
 #endif
 #if HAVE_NATIVE_mpn_addlsh_n
@@ -474,8 +490,8 @@ const struct routine_t {
   { "mpn_rsh1sub_n",     speed_mpn_rsh1sub_n, FLAG_R_OPTIONAL },
 #endif
 
-  { "mpn_addcnd_n",     speed_mpn_addcnd_n, FLAG_R_OPTIONAL },
-  { "mpn_subcnd_n",     speed_mpn_subcnd_n, FLAG_R_OPTIONAL },
+  { "mpn_cnd_add_n",     speed_mpn_cnd_add_n, FLAG_R_OPTIONAL },
+  { "mpn_cnd_sub_n",     speed_mpn_cnd_sub_n, FLAG_R_OPTIONAL },
 
   { "MPN_ZERO",          speed_MPN_ZERO             },
 
index 3ab12d63db6620b97636f14fd27982ba6f37c5e9..d9474adb35232131dd882bdfdccf663a5caf9d68 100644 (file)
@@ -1,22 +1,32 @@
 /* Header for speed and threshold things.
 
-Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008, 2009, 2010, 2011,
-2012 Free Software Foundation, Inc.
+Copyright 1999-2003, 2005, 2006, 2008-2013 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 #ifndef __SPEED_H__
 #define __SPEED_H__
@@ -56,7 +66,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 */
 #define CACHE_LINE_SIZE   64 /* bytes */
 
-#define SPEED_TMP_ALLOC_ADJUST_MASK  (CACHE_LINE_SIZE/BYTES_PER_MP_LIMB - 1)
+#define SPEED_TMP_ALLOC_ADJUST_MASK  (CACHE_LINE_SIZE/GMP_LIMB_BYTES - 1)
 
 /* Set ptr to a TMP_ALLOC block of the given limbs, with the given limb
    alignment.  */
@@ -65,7 +75,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
     mp_ptr     __ptr;                                                  \
     mp_size_t  __ptr_align, __ptr_add;                                 \
                                                                        \
-    ASSERT ((CACHE_LINE_SIZE % BYTES_PER_MP_LIMB) == 0);               \
+    ASSERT ((CACHE_LINE_SIZE % GMP_LIMB_BYTES) == 0);          \
     __ptr = TMP_ALLOC_LIMBS ((limbs) + SPEED_TMP_ALLOC_ADJUST_MASK);   \
     __ptr_align = (__ptr - (mp_ptr) NULL);                             \
     __ptr_add = ((align) - __ptr_align) & SPEED_TMP_ALLOC_ADJUST_MASK; \
@@ -148,7 +158,6 @@ double speed_mpn_add_n (struct speed_params *);
 double speed_mpn_add_err1_n (struct speed_params *);
 double speed_mpn_add_err2_n (struct speed_params *);
 double speed_mpn_add_err3_n (struct speed_params *);
-double speed_mpn_addcnd_n (struct speed_params *);
 double speed_mpn_addlsh_n (struct speed_params *);
 double speed_mpn_addlsh1_n (struct speed_params *);
 double speed_mpn_addlsh2_n (struct speed_params *);
@@ -169,13 +178,15 @@ double speed_mpn_addmul_5 (struct speed_params *);
 double speed_mpn_addmul_6 (struct speed_params *);
 double speed_mpn_addmul_7 (struct speed_params *);
 double speed_mpn_addmul_8 (struct speed_params *);
+double speed_mpn_cnd_add_n (struct speed_params *);
+double speed_mpn_cnd_sub_n (struct speed_params *);
 double speed_mpn_com (struct speed_params *);
 double speed_mpn_copyd (struct speed_params *);
 double speed_mpn_copyi (struct speed_params *);
 double speed_MPN_COPY (struct speed_params *);
 double speed_MPN_COPY_DECR (struct speed_params *);
 double speed_MPN_COPY_INCR (struct speed_params *);
-double speed_mpn_tabselect (struct speed_params *);
+double speed_mpn_sec_tabselect (struct speed_params *);
 double speed_mpn_divexact_1 (struct speed_params *);
 double speed_mpn_divexact_by3 (struct speed_params *);
 double speed_mpn_bdiv_q_1 (struct speed_params *);
@@ -192,6 +203,10 @@ double speed_mpn_divrem_1f_inv (struct speed_params *);
 double speed_mpn_divrem_2 (struct speed_params *);
 double speed_mpn_divrem_2_div (struct speed_params *);
 double speed_mpn_divrem_2_inv (struct speed_params *);
+double speed_mpn_div_qr_1n_pi1 (struct speed_params *);
+double speed_mpn_div_qr_1n_pi1_1 (struct speed_params *);
+double speed_mpn_div_qr_1n_pi1_2 (struct speed_params *);
+double speed_mpn_div_qr_1 (struct speed_params *);
 double speed_mpn_div_qr_2n (struct speed_params *);
 double speed_mpn_div_qr_2u (struct speed_params *);
 double speed_mpn_fib2_ui (struct speed_params *);
@@ -287,6 +302,7 @@ double speed_mpn_brootinv (struct speed_params *);
 double speed_mpn_invert (struct speed_params *);
 double speed_mpn_invertappr (struct speed_params *);
 double speed_mpn_ni_invertappr (struct speed_params *);
+double speed_mpn_sec_invert (struct speed_params *s);
 double speed_mpn_binvert (struct speed_params *);
 double speed_mpn_redc_1 (struct speed_params *);
 double speed_mpn_redc_2 (struct speed_params *);
@@ -314,7 +330,6 @@ double speed_mpn_sub_n (struct speed_params *);
 double speed_mpn_sub_err1_n (struct speed_params *);
 double speed_mpn_sub_err2_n (struct speed_params *);
 double speed_mpn_sub_err3_n (struct speed_params *);
-double speed_mpn_subcnd_n (struct speed_params *);
 double speed_mpn_sublsh_n (struct speed_params *);
 double speed_mpn_sublsh1_n (struct speed_params *);
 double speed_mpn_sublsh2_n (struct speed_params *);
@@ -464,6 +479,9 @@ extern int  speed_option_verbose;
 extern int  speed_option_cycles_broken;
 void speed_option_set (const char *);
 
+mp_limb_t mpn_div_qr_1n_pi1_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t);
+mp_limb_t mpn_div_qr_1n_pi1_2 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t);
+
 mp_limb_t mpn_divrem_1_div (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
 mp_limb_t mpn_divrem_1_inv (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
 mp_limb_t mpn_divrem_2_div (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr);
@@ -635,7 +653,36 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
   SPEED_ROUTINE_MPN_COPY_CALL (function (wp, s->xp, s->size))
 
 #define SPEED_ROUTINE_MPN_TABSELECT(function)                          \
-  SPEED_ROUTINE_MPN_COPY_CALL (function (wp, s->xp, s->size, 1, s->r))
+  {                                                                    \
+    mp_ptr    xp, wp;                                                  \
+    unsigned  i;                                                       \
+    double    t;                                                       \
+    TMP_DECL;                                                          \
+                                                                       \
+    SPEED_RESTRICT_COND (s->size >= 0);                                        \
+                                                                       \
+    if (s->r == 0)                                                     \
+      s->r = s->size;  /* default to a quadratic shape */              \
+                                                                       \
+    TMP_MARK;                                                          \
+    SPEED_TMP_ALLOC_LIMBS (xp, s->size * s->r, s->align_xp);           \
+    SPEED_TMP_ALLOC_LIMBS (wp, s->size, s->align_wp);                  \
+                                                                       \
+    speed_operand_src (s, xp, s->size * s->r);                         \
+    speed_operand_dst (s, wp, s->size);                                        \
+    speed_cache_fill (s);                                              \
+                                                                       \
+    speed_starttime ();                                                        \
+    i = s->reps;                                                       \
+    do                                                                 \
+      function (wp, xp, s->size, s->r, (s->r) / 2);                    \
+    while (--i != 0);                                                  \
+    t = speed_endtime () / s->r;                                       \
+                                                                       \
+    TMP_FREE;                                                          \
+    return t;                                                          \
+  }
+
 
 #define SPEED_ROUTINE_MPN_COPYC(function)                              \
   {                                                                    \
@@ -685,7 +732,7 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
     speed_starttime ();                                                        \
     i = s->reps;                                                       \
     do                                                                 \
-      function (wp, s->xp, s->size * BYTES_PER_MP_LIMB);               \
+      function (wp, s->xp, s->size * GMP_LIMB_BYTES);          \
     while (--i != 0);                                                  \
     t = speed_endtime ();                                              \
                                                                        \
@@ -758,7 +805,7 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
     TMP_MARK;                                                          \
     SPEED_TMP_ALLOC_LIMBS (wp, s->size, s->align_wp);                  \
                                                                        \
-    /* (don't have a mechnanism to specify zp alignments) */           \
+    /* (don't have a mechanism to specify zp alignments) */            \
     for (i = 0; i < K; i++)                                            \
       SPEED_TMP_ALLOC_LIMBS (zp[i], s->size, 0);                       \
                                                                        \
@@ -2255,6 +2302,43 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
     return t;                                                          \
   }
 
+#define SPEED_ROUTINE_MPN_SEC_INVERT(function,itchfn)                  \
+  {                                                                    \
+    long  i;                                                           \
+    mp_ptr    up, mp, tp, ip;                                          \
+    double    t;                                                       \
+    TMP_DECL;                                                          \
+                                                                       \
+    SPEED_RESTRICT_COND (s->size >= 1);                                        \
+                                                                       \
+    TMP_MARK;                                                          \
+    SPEED_TMP_ALLOC_LIMBS (ip, s->size, s->align_xp);                  \
+    SPEED_TMP_ALLOC_LIMBS (up, s->size, s->align_yp);                  \
+    SPEED_TMP_ALLOC_LIMBS (mp, s->size, s->align_yp);                  \
+    SPEED_TMP_ALLOC_LIMBS (tp, itchfn (s->size), s->align_wp);         \
+                                                                       \
+    speed_operand_src (s, up, s->size);                                        \
+    speed_operand_dst (s, tp, s->size);                                        \
+    speed_operand_dst (s, ip, s->size);                                        \
+    speed_cache_fill (s);                                              \
+                                                                       \
+    MPN_COPY (mp, s->yp, s->size);                                     \
+    /* Must be odd */                                                  \
+    mp[0] |= 1;                                                                \
+    speed_starttime ();                                                        \
+    i = s->reps;                                                       \
+    do                                                                 \
+      {                                                                        \
+       MPN_COPY (up, s->xp, s->size);                                  \
+       function (ip, up, mp, s->size, 2*s->size*GMP_NUMB_BITS, tp);    \
+      }                                                                        \
+    while (--i != 0);                                                  \
+    t = speed_endtime ();                                              \
+                                                                       \
+    TMP_FREE;                                                          \
+    return t;                                                          \
+  }
+
 #define SPEED_ROUTINE_REDC_1(function)                                 \
   {                                                                    \
     unsigned   i;                                                      \
@@ -3085,6 +3169,71 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
     return t;                                                          \
   }
 
+#define SPEED_ROUTINE_MPN_DIV_QR_1(function)                           \
+  {                                                                    \
+    mp_ptr    wp, xp;                                                  \
+    mp_limb_t d;                                                       \
+    mp_limb_t r;                                                       \
+    unsigned  i;                                                       \
+    double    t;                                                       \
+    TMP_DECL;                                                          \
+                                                                       \
+    SPEED_RESTRICT_COND (s->size >= 1);                                        \
+                                                                       \
+    TMP_MARK;                                                          \
+    SPEED_TMP_ALLOC_LIMBS (wp, s->size, s->align_wp);                  \
+                                                                       \
+    d = s->r;                                                          \
+    if (d == 0)                                                                \
+      d = 1;                                                           \
+    speed_operand_src (s, s->xp, s->size);                             \
+    speed_operand_dst (s, wp, s->size);                                        \
+    speed_cache_fill (s);                                              \
+                                                                       \
+    speed_starttime ();                                                        \
+    i = s->reps;                                                       \
+    do                                                                 \
+      r = function (wp, wp+s->size-1, s->xp, s->size, d);              \
+    while (--i != 0);                                                  \
+    t = speed_endtime ();                                              \
+                                                                       \
+    TMP_FREE;                                                          \
+    return t;                                                          \
+  }
+
+#define SPEED_ROUTINE_MPN_DIV_QR_1N_PI1(function)                      \
+  {                                                                    \
+    mp_ptr    wp, xp;                                                  \
+    mp_limb_t d, dinv;                                                 \
+    mp_limb_t r;                                                       \
+    unsigned  i;                                                       \
+    double    t;                                                       \
+    TMP_DECL;                                                          \
+                                                                       \
+    SPEED_RESTRICT_COND (s->size >= 1);                                        \
+                                                                       \
+    TMP_MARK;                                                          \
+    SPEED_TMP_ALLOC_LIMBS (wp, s->size, s->align_wp);                  \
+                                                                       \
+    d = s->r;                                                          \
+    /* divisor must be normalized */                                   \
+    SPEED_RESTRICT_COND (d & GMP_NUMB_HIGHBIT);                                \
+    invert_limb (dinv, d);                                             \
+    speed_operand_src (s, s->xp, s->size);                             \
+    speed_operand_dst (s, wp, s->size);                                        \
+    speed_cache_fill (s);                                              \
+                                                                       \
+    speed_starttime ();                                                        \
+    i = s->reps;                                                       \
+    do                                                                 \
+      r = function (wp, s->xp, s->size, 0, d, dinv);                   \
+    while (--i != 0);                                                  \
+    t = speed_endtime ();                                              \
+                                                                       \
+    TMP_FREE;                                                          \
+    return t;                                                          \
+  }
+
 #define SPEED_ROUTINE_MPN_DIV_QR_2(function, norm)                     \
   {                                                                    \
     mp_ptr    wp, xp;                                                  \
@@ -3253,7 +3402,7 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
                                                                        \
     speed_operand_src (s, s->xp, s->size);                             \
     speed_operand_dst (s, xp, s->size);                                        \
-    speed_operand_dst (s, (mp_ptr) wp, wn/BYTES_PER_MP_LIMB);          \
+    speed_operand_dst (s, (mp_ptr) wp, wn/GMP_LIMB_BYTES);             \
     speed_cache_fill (s);                                              \
                                                                        \
     speed_starttime ();                                                        \
@@ -3301,7 +3450,7 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
     ASSERT_ALWAYS (mpn_set_str (wp, xp, s->size, base) <= wn);         \
     */                                                                 \
                                                                        \
-    speed_operand_src (s, (mp_ptr) xp, s->size/BYTES_PER_MP_LIMB);     \
+    speed_operand_src (s, (mp_ptr) xp, s->size/GMP_LIMB_BYTES);        \
     speed_operand_dst (s, wp, wn);                                     \
     speed_cache_fill (s);                                              \
                                                                        \
index 1670f6ecd3d825108bc6960bc69ff9694babc2d3..0178b345af834dbacb31620f4ccb3c56fb34e2eb 100644 (file)
@@ -1,22 +1,32 @@
-/* Time routines for speed measurments.
+/* Time routines for speed measurements.
 
-Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2010, 2011, 2012 Free Software
-Foundation, Inc.
+Copyright 1999-2004, 2010-2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /* Usage:
@@ -794,7 +804,7 @@ cgt_works_p (void)
       duration = (end.tv_sec + end.tv_nsec * 1e-9
                  - start.tv_sec - start.tv_nsec * 1e-9);
       if (speed_option_verbose)
-       printf ("delay loop of %d rounds took %s (according to clock_get_time)\n",
+       printf ("delay loop of %d rounds took %s (according to clock_gettime)\n",
                CGT_DELAY_COUNT, unittime_string (duration));
       if (duration < 100e-9)
        {
index 6d88631787689677977bc8fde87ee55f5010da9d..4d52f5610c3b83d6eca0d2db1b9ba896cf43e67b 100644 (file)
@@ -7,17 +7,28 @@ Copyright 2008, 2010, 2011 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU 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 TUNE_GCD_P 1
 
index 20f9161e6d7963b2b5d7b1723d2c35c083cc1c3d..2fba6b29554c5e0fb0ba49c43c29401fdf8437c0 100644 (file)
@@ -1,22 +1,32 @@
 /* Create tuned thresholds for various algorithms.
 
-Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008, 2009, 2010,
-2011, 2012 Free Software Foundation, Inc.
+Copyright 1999-2003, 2005, 2006, 2008-2012 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
 
 
 /* Usage: tuneup [-t] [-t] [-p precision]
@@ -198,6 +208,9 @@ mp_size_t  hgcd_appr_threshold          = MP_SIZE_T_MAX;
 mp_size_t  hgcd_reduce_threshold        = MP_SIZE_T_MAX;
 mp_size_t  gcd_dc_threshold             = MP_SIZE_T_MAX;
 mp_size_t  gcdext_dc_threshold          = MP_SIZE_T_MAX;
+int       div_qr_1n_pi1_method         = 0;
+mp_size_t  div_qr_1_norm_threshold      = MP_SIZE_T_MAX;
+mp_size_t  div_qr_1_unnorm_threshold    = MP_SIZE_T_MAX;
 mp_size_t  divrem_1_norm_threshold      = MP_SIZE_T_MAX;
 mp_size_t  divrem_1_unnorm_threshold    = MP_SIZE_T_MAX;
 mp_size_t  mod_1_norm_threshold         = MP_SIZE_T_MAX;
@@ -250,6 +263,9 @@ struct param_t {
 #ifndef HAVE_NATIVE_mpn_divexact_1
 #define HAVE_NATIVE_mpn_divexact_1 0
 #endif
+#ifndef HAVE_NATIVE_mpn_div_qr_1n_pi1
+#define HAVE_NATIVE_mpn_div_qr_1n_pi1 0
+#endif
 #ifndef HAVE_NATIVE_mpn_divrem_1
 #define HAVE_NATIVE_mpn_divrem_1 0
 #endif
@@ -367,9 +383,10 @@ analyze_dat (int final)
 }
 
 
-/* Measuring for recompiled mpn/generic/divrem_1.c, mpn/generic/mod_1.c
- * and mpz/fac_ui.c */
+/* Measuring for recompiled mpn/generic/div_qr_1.c,
+ * mpn/generic/divrem_1.c, mpn/generic/mod_1.c and mpz/fac_ui.c */
 
+mp_limb_t mpn_div_qr_1_tune (mp_ptr, mp_limb_t *, mp_srcptr, mp_size_t, mp_limb_t);
 mp_limb_t mpn_divrem_1_tune (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
 mp_limb_t mpn_mod_1_tune (mp_srcptr, mp_size_t, mp_limb_t);
 void mpz_fac_ui_tune (mpz_ptr, unsigned long);
@@ -389,7 +406,11 @@ speed_mpz_fac_ui_tune (struct speed_params *s)
 {
   SPEED_ROUTINE_MPZ_FAC_UI (mpz_fac_ui_tune);
 }
-
+double
+speed_mpn_div_qr_1_tune (struct speed_params *s)
+{
+  SPEED_ROUTINE_MPN_DIV_QR_1 (mpn_div_qr_1_tune);
+}
 
 double
 tuneup_measure (speed_function_t fun,
@@ -1828,7 +1849,7 @@ tune_gcdext_dc (void)
 
 /* In tune_powm_sec we compute the table used by the win_size function.  The
    cutoff points are in exponent bits, disregarding other operand sizes.  It is
-   not possible to use the one framework since it currently uses a granilarity
+   not possible to use the one framework since it currently uses a granularity
    of full limbs.
 */
 
@@ -1860,7 +1881,7 @@ tune_powm_sec (void)
   k = 1;
 
   winsize = 10;                        /* the itch function needs this */
-  itch = mpn_powm_sec_itch (n_max, n_max, n_max);
+  itch = mpn_sec_powm_itch (n_max, n_max * GMP_NUMB_BITS, n_max);
 
   rp = TMP_ALLOC_LIMBS (n_max);
   bp = TMP_ALLOC_LIMBS (n_max);
@@ -1890,7 +1911,10 @@ tune_powm_sec (void)
 
   printf ("#define POWM_SEC_TABLE  ");
 
-  for (nbits = 1; nbits <= n_max * GMP_NUMB_BITS; )
+  /* For nbits == 1, we should always use k == 1, so no need to tune
+     that. Starting with nbits == 2 also ensure that nbits always is
+     larger than the windowsize k+1. */
+  for (nbits = 2; nbits <= n_max * GMP_NUMB_BITS; )
     {
       n = (nbits - 1) / GMP_NUMB_BITS + 1;
 
@@ -1899,16 +1923,11 @@ tune_powm_sec (void)
       for (i = 0; i < n; i++)
        ep[i] = ~CNST_LIMB(0);
 
-      /* Truncate E to be exactly nbits large.  */
-      if (nbits % GMP_NUMB_BITS != 0)
-       mpn_rshift (ep, ep, n, GMP_NUMB_BITS - nbits % GMP_NUMB_BITS);
-      ep[n - 1] |= CNST_LIMB(1) << (nbits - 1) % GMP_NUMB_BITS;
-
       winsize = k;
       for (i = 0; i < n_measurements; i++)
        {
          speed_starttime ();
-         mpn_powm_sec (rp, bp, n, ep, n, mp, n, tp);
+         mpn_sec_powm (rp, bp, n, ep, nbits, mp, n, tp);
          ttab[i] = speed_endtime ();
        }
       tk = median (ttab, n_measurements);
@@ -1918,7 +1937,7 @@ tune_powm_sec (void)
       for (i = 0; i < n_measurements; i++)
        {
          speed_starttime ();
-         mpn_powm_sec (rp, bp, n, ep, n, mp, n, tp);
+         mpn_sec_powm (rp, bp, n, ep, nbits, mp, n, tp);
          ttab[i] = speed_endtime ();
        }
       tkp1 = median (ttab, n_measurements);
@@ -1931,6 +1950,10 @@ tune_powm_sec (void)
          if (possible_nbits_cutoff)
            {
              /* Two consecutive sizes indicate k increase, obey.  */
+
+             /* Must always have x[k] >= k */
+             ASSERT_ALWAYS (possible_nbits_cutoff >= k);
+
              if (k > 1)
                printf (",");
              printf ("%ld", (long) possible_nbits_cutoff);
@@ -1941,7 +1964,10 @@ tune_powm_sec (void)
            {
              /* One measurement indicate k increase, save nbits for further
                 consideration.  */
-             possible_nbits_cutoff = nbits;
+             /* The new larger k gets used for sizes > the cutoff
+                value, hence the cutoff should be one less than the
+                smallest size where it gives a speedup. */
+             possible_nbits_cutoff = nbits - 1;
            }
        }
       else
@@ -2026,6 +2052,55 @@ tune_divrem_1 (void)
   }
 }
 
+void
+tune_div_qr_1 (void)
+{
+  static struct param_t  param;
+  double            t1, t2;
+
+  if (!HAVE_NATIVE_mpn_div_qr_1n_pi1)
+    {
+      static struct param_t  param;
+      double   t1, t2;
+
+      s.size = 10;
+      s.r = randlimb_norm ();
+
+      t1 = tuneup_measure (speed_mpn_div_qr_1n_pi1_1, &param, &s);
+      t2 = tuneup_measure (speed_mpn_div_qr_1n_pi1_2, &param, &s);
+
+      if (t1 == -1.0 || t2 == -1.0)
+       {
+         printf ("Oops, can't measure all mpn_div_qr_1n_pi1 methods at %ld\n",
+                 (long) s.size);
+         abort ();
+       }
+      div_qr_1n_pi1_method = (t1 < t2) ? 1 : 2;
+      print_define ("DIV_QR_1N_PI1_METHOD", div_qr_1n_pi1_method);
+    }
+
+  {
+    static struct param_t  param;
+    param.name = "DIV_QR_1_NORM_THRESHOLD";
+    DIV_1_PARAMS;
+    param.min_size = 1;
+    param.min_is_always = 0;
+    s.r = randlimb_norm ();
+    param.function = speed_mpn_div_qr_1_tune;
+    one (&div_qr_1_norm_threshold, &param);
+  }
+  {
+    static struct param_t  param;
+    param.name = "DIV_QR_1_UNNORM_THRESHOLD";
+    DIV_1_PARAMS;
+    param.min_size = 1;
+    param.min_is_always = 0;
+    s.r = randlimb_half();
+    param.function = speed_mpn_div_qr_1_tune;
+    one (&div_qr_1_unnorm_threshold, &param);
+  }
+}
+
 
 void
 tune_mod_1 (void)
@@ -2540,7 +2615,7 @@ speed_mpn_pre_set_str (struct speed_params *s)
   ASSERT_ALWAYS (mpn_set_str (wp, str, s->size, base) <= wn);
   */
 
-  speed_operand_src (s, (mp_ptr) str, s->size/BYTES_PER_MP_LIMB);
+  speed_operand_src (s, (mp_ptr) str, s->size/GMP_LIMB_BYTES);
   speed_operand_dst (s, wp, wn);
   speed_cache_fill (s);
 
@@ -2722,6 +2797,7 @@ all (void)
   tune_divrem_1 ();
   tune_mod_1 ();
   tune_preinv_divrem_1 ();
+  tune_div_qr_1 ();
 #if 0
   tune_divrem_2 ();
 #endif
index 509909002a62222370e9464ccba579c4f29f5d63..b7ec44c54458d8a03795e85dca788431676e4050 100644 (file)
@@ -1,21 +1,32 @@
 dnl  x86 pentium time stamp counter access routine.
 
-dnl  Copyright 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
-dnl
+dnl  Copyright 1999, 2000, 2003-2005 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
-dnl  modify it under the terms of the GNU Lesser General Public License as
-dnl  published by the Free Software Foundation; either version 3 of the
-dnl  License, or (at your option) any later version.
+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,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+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 a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  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')
index da16b7790e943a9ad9a533ff5aeabe974caf8d62..b75a3389e0e5260f9cbe357f88878b418e87255a 100644 (file)
--- a/version.c
+++ b/version.c
@@ -1,21 +1,32 @@
 /* gmp_version -- version number compiled into the library.
 
-Copyright 1996, 1999, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1996, 1999-2001 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 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.
+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 Lesser General Public
-License for more details.
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+You should have received copies of the GNU General Public License and the
+GNU Lesser 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/ylwrap b/ylwrap
index 84d563405e6e29a64a4ffdb07da262e2e5628dba..92536350cba49fa4cc8e76c1655488b5924a5c82 100755 (executable)
--- a/ylwrap
+++ b/ylwrap
@@ -1,10 +1,10 @@
 #! /bin/sh
 # ylwrap - wrapper for lex/yacc invocations.
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2011-08-25.18; # UTC
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
-# 2007, 2009 Free Software Foundation, Inc.
+# 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
 #
 # Written by Tom Tromey <tromey@cygnus.com>.
 #
@@ -99,7 +99,11 @@ esac
 # FIXME: add hostname here for parallel makes that run commands on
 # other machines.  But that might take us over the 14-char limit.
 dirname=ylwrap$$
-trap "cd '`pwd`'; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
+do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret'
+trap "ret=129; $do_exit" 1
+trap "ret=130; $do_exit" 2
+trap "ret=141; $do_exit" 13
+trap "ret=143; $do_exit" 15
 mkdir $dirname || exit 1
 
 cd $dirname
@@ -133,19 +137,19 @@ if test $ret -eq 0; then
     # Handle y_tab.c and y_tab.h output by DOS
     if test $y_tab_nodot = "yes"; then
       if test $from = "y.tab.c"; then
-       from="y_tab.c"
+        from="y_tab.c"
       else
-       if test $from = "y.tab.h"; then
-         from="y_tab.h"
-       fi
+        if test $from = "y.tab.h"; then
+          from="y_tab.h"
+        fi
       fi
     fi
     if test -f "$from"; then
       # If $2 is an absolute path name, then just use that,
       # otherwise prepend `../'.
       case "$2" in
-       [\\/]* | ?:[\\/]*) target="$2";;
-       *) target="../$2";;
+        [\\/]* | ?:[\\/]*) target="$2";;
+        *) target="../$2";;
       esac
 
       # We do not want to overwrite a header file if it hasn't
@@ -155,8 +159,8 @@ if test $ret -eq 0; then
       # Makefile.  Divert the output of all other files to a temporary
       # file so we can compare them to existing versions.
       if test $first = no; then
-       realtarget="$target"
-       target="tmp-`echo $target | sed s/.*[\\/]//g`"
+        realtarget="$target"
+        target="tmp-`echo $target | sed s/.*[\\/]//g`"
       fi
       # Edit out `#line' or `#' directives.
       #
@@ -180,10 +184,10 @@ if test $ret -eq 0; then
 
       # Check whether header files must be updated.
       if test $first = no; then
-       if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
-         echo "$2" is unchanged
-         rm -f "$target"
-       else
+        if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
+          echo "$2" is unchanged
+          rm -f "$target"
+        else
           echo updating "$2"
           mv -f "$target" "$realtarget"
         fi